Plugin Directory

Changeset 2288475


Ignore:
Timestamp:
04/21/2020 02:39:28 PM (6 years ago)
Author:
rm2773
Message:

Update to version 1.0.4.

Location:
wp-studio-tabs
Files:
26 added
3 edited

Legend:

Unmodified
Added
Removed
  • wp-studio-tabs/trunk/readme.txt

    r2286513 r2288475  
    66Requires at least: 2.9
    77Tested up to: 5.4
    8 Stable tag: 1.0.3
     8Stable tag: 1.0.4
    99
    1010WP Studio Tabs allows you to create/manage simple animated tabs for your Wordpress website.
     
    2929== Changelog ==
    3030
     31= 1.0.4 =
     32
     33* Fixed the active tab setting, which was previously not working. If the "Active?" radio button is selected for a particular tab, it will now be open immediately once the page loads.
     34
    3135= 1.0.3 =
    3236
  • wp-studio-tabs/trunk/tabs/js/cbpFWTabs.js

    r2242091 r2288475  
    99 * http://www.codrops.com
    1010 */
     11
    1112;( function( window ) {
    12    
    13     'use strict';
     13   
     14    'use strict';
     15   
     16    function extend( a, b ) {
     17        for( var key in b ) {
     18            if( b.hasOwnProperty( key ) ) {
     19                a[key] = b[key];
     20            }
     21        }
     22        return a;
     23    }
    1424
    15     function extend( a, b ) {
    16         for( var key in b ) {
    17             if( b.hasOwnProperty( key ) ) {
    18                 a[key] = b[key];
    19             }
    20         }
    21         return a;
    22     }
     25    function CBPFWTabs( el, options ) {
     26        this.el = el;
     27        this.options = extend( {}, this.options );
     28          extend( this.options, options );
     29          this._init();
     30    }
    2331
    24     function CBPFWTabs( el, options ) {
    25         this.el = el;
    26         this.options = extend( {}, this.options );
    27         extend( this.options, options );
    28         this._init();
    29     }
     32    CBPFWTabs.prototype.options = {
     33       
     34        //start : 1
     35    };
    3036
    31     CBPFWTabs.prototype.options = {
    32         start : 0
    33     };
     37    CBPFWTabs.prototype._init = function() {
    3438
    35     CBPFWTabs.prototype._init = function() {
    36         // tabs elemes
    37         this.tabs = [].slice.call( this.el.querySelectorAll( 'nav > ul > li' ) );
    38         // content items
    39         this.items = [].slice.call( this.el.querySelectorAll( '.content > section' ) );
    40         // current index
    41         this.current = -1;
    42         // show current content item
    43         this._show();
    44         // init events
    45         this._initEvents();
    46     };
     39        // tabs elemes
     40        this.tabs = [].slice.call( this.el.querySelectorAll( 'nav > ul > li' ) );
    4741
    48     CBPFWTabs.prototype._initEvents = function() {
    49         var self = this;
    50         this.tabs.forEach( function( tab, idx ) {
    51             tab.addEventListener( 'click', function( ev ) {
    52                 ev.preventDefault();
    53                 self._show( idx );
    54             } );
    55         } );
    56     };
     42        // content items
     43        this.items = [].slice.call( this.el.querySelectorAll( '.content > section' ) );
    5744
    58     CBPFWTabs.prototype._show = function( idx ) {
    59         if( this.current >= 0 ) {
    60             this.tabs[ this.current ].className = '';
    61             this.items[ this.current ].className = '';
    62         }
    63         // change current
    64         this.current = idx != undefined ? idx : this.options.start >= 0 && this.options.start < this.items.length ? this.options.start : 0;
    65         this.tabs[ this.current ].className = 'tab-current';
    66         this.items[ this.current ].className = 'content-current';
    67     };
     45        this.current = tabs_index
     46       
     47        this._show(this.current);
    6848
    69     // add to global namespace
    70     window.CBPFWTabs = CBPFWTabs;
     49        // init events
     50        this._initEvents();
     51
     52       
     53    };
     54
     55    CBPFWTabs.prototype._initEvents = function() {
     56        var self = this;
     57        this.tabs.forEach( function( tab, idx ) {
     58            tab.addEventListener( 'click', function( ev ) {
     59                ev.preventDefault();
     60                self._show( idx );
     61            } );
     62        } );
     63    };
     64
     65    CBPFWTabs.prototype._show = function( idx ) {
     66       
     67        if( this.current >= 0) {
     68            this.tabs[ this.current ].className = '';
     69            this.items[ this.current ].className = '';
     70        }
     71
     72        // change current
     73        this.current = idx != undefined ? idx : this.options.start >= 0 && this.options.start < this.items.length ? this.options.start : 0;
     74
     75        this.tabs[ this.current ].className = 'tab-current';
     76        this.items[ this.current ].className = 'content-current';
     77       
     78    };
     79
     80    // add to global namespace
     81    window.CBPFWTabs = CBPFWTabs;
    7182
    7283})( window );
  • wp-studio-tabs/trunk/wpstudio-tabs.php

    r2286513 r2288475  
    55 * Plugin URI:        http://wp-studio.net
    66 * Description:       WP Studio Tabs allows you to create/manage simple animated tabs for your Wordpress website.
    7  * Version:           1.0.3
     7 * Version:           1.0.4
    88 * Requires at least: 2.9
    99 * Author:            WP Studio
     
    5151    wp_enqueue_style('styles-basic', plugins_url('css/styles-basic.css',__FILE__), '', PLUGIN_VER, '');
    5252    wp_enqueue_style('component', plugins_url('tabs/css/component.css',__FILE__), '', PLUGIN_VER, '');
    53     wp_enqueue_script('cbpFWTabs.js', plugins_url('tabs/js/cbpFWTabs.js',__FILE__), array('jquery'), PLUGIN_VER, '');
    54     wp_enqueue_script('responsive-tabs', plugins_url('js/responsive-tabs.js',__FILE__), array('jquery'), PLUGIN_VER, '');
     53    wp_enqueue_script('cbpFWTabs.js', plugins_url('tabs/js/cbpFWTabs.js',__FILE__), array('jquery'), PLUGIN_VER, false);
     54    wp_enqueue_script('responsive-tabs', plugins_url('js/responsive-tabs.js',__FILE__), array('jquery'), PLUGIN_VER, false);
    5555  }
    5656
     
    6262    wp_enqueue_script('jquery-ui-sortable');
    6363    wp_enqueue_script('wp-color-picker');
    64     wp_enqueue_script('scripts-admin', plugins_url('js/scripts-admin.js',__FILE__), '', PLUGIN_VER, '');
    65    
     64    wp_enqueue_script('scripts-admin', plugins_url('js/scripts-admin.js',__FILE__), '', PLUGIN_VER, false);
     65
    6666    //wp_enqueue_script('scripts-tabs-input', plugins_url('js/scripts-tabs-input.js',__FILE__), '', PLUGIN_VER, '');
    6767    //wp_enqueue_script('scripts-tabs-manager', plugins_url('js/scripts-tabs-manager.js',__FILE__), '', PLUGIN_VER, '');
     
    131131      $tabs_section_bg = get_post_meta( $post_id, 'tabs_section_bg', true );
    132132      $tab_font_color = get_post_meta( $post_id, 'tab_font_color', true );
     133      $tab_active = get_post_meta( $post_id, 'wpst_tab_active', true);
    133134     
    134135      ob_start(); ?>
     
    141142              $tabs_order = get_post_meta($post_id, 'wpst_tabs_order', true);
    142143              $tabs_order_array = explode(',', $tabs_order);
    143 
    144               //print_r($tabs_order_array);
     144              $tabs_idx = 0;
    145145
    146146              foreach ($tabs_order_array as $ordered_tab):
     147                $active_idx = ($tab_active == 'wpst_tab_active_'.$ordered_tab ? $tabs_idx : 0);
    147148                $id = !empty($ordered_tab) ? $ordered_tab : 'tab-1';
    148149                $wpst_tab_label = get_post_meta($post_id, 'wpst_tab_label_'.$id, true);
    149150                $wpst_tab_content = get_post_meta($post_id, 'wpst_tab_content_'.$id, true);
    150151                $html  = '';
    151                 $html .= '<li><a href="#section-1" class="icon-shop"><span>'.$wpst_tab_label.'</span></a></li>';
     152                $html .= '<li><a href="#"><span>'.$wpst_tab_label.'</span></a></li>';
    152153                echo $html;
     154                $tabs_idx++;
    153155              endforeach; ?>
    154156            </ul>
     
    157159          <div class="content">
    158160          <?php
    159             $i = 1;
     161
     162            $content_idx = 1;
    160163            foreach ($tabs_order_array as $ordered_tab):
    161164              $id = !empty($ordered_tab) ? $ordered_tab : 'tab-1';
    162165              $wpst_tab_label = get_post_meta($post_id, 'wpst_tab_label_'.$id, true);
    163166              $wpst_tab_content = get_post_meta($post_id, 'wpst_tab_content_'.$id, true);
     167
    164168              $tml  = '';
    165               $tml .= '<section id="section-'.$id.'">';
     169    $tml .= '<section id="section-'.$id.'" class="'.(($tab_active == 'wpst_tab_active_'.$ordered_tab) ? 'admin-content-current' : '').'">';
    166170              $tml .= '<div>';
    167171              $tml .= '<div><p>'.esc_attr($wpst_tab_content).'</p></div>';
    168172              $tml .= '</div>';
    169173              $tml .= '</section>';
    170               echo $tml; $i++;
     174              echo $tml; $content_idx++;
    171175            endforeach; ?>
    172176          </div><!-- .content -->
    173177        </div><!-- #tabs -->
    174         <script>var tabs_id = '<?= 'tabs-'.$post_id; ?>'; new CBPFWTabs(document.getElementById(tabs_id));</script>
     178        <script>
     179          var tabs_id = '<?= 'tabs-'.$post_id; ?>';
     180          var tabs_index = '<?= $active_idx; ?>';
     181          var tab_current = jQuery('.tabs li');
     182          new CBPFWTabs(document.getElementById(tabs_id), tabs_index);
     183        </script>
    175184      </section>
    176185
Note: See TracChangeset for help on using the changeset viewer.