Skip to content

Commit

Permalink
Coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
mboynes committed Feb 20, 2016
1 parent e33dbc6 commit 75c2d04
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions js/fieldmanager-group-tabs.js
Expand Up @@ -19,31 +19,31 @@ var FieldmanagerGroupTabs;
*/
bindEvents: function() {

$('.fm-tab-bar').each( $.proxy( function( k, el ){
this.bindClickEvents( $(el) );
$('.fm-tab-bar').each( $.proxy( function( k, el ) {
this.bindClickEvents( $( el ) );
}, this ) );
$( document ).on( 'fm_added_element', $.proxy( function( e ){
var el = $(e.target);
$( document ).on( 'fm_added_element', $.proxy( function( e ) {
var el = $( e.target );
if ( ! $( '.fm-tab-bar a', el ).length ) {
return;
}
counter = el.parent().data( 'fm-group-counter');
counter = el.parent().data( 'fm-group-counter' );
if ( ! counter ) {
counter = el.siblings('.fm-item').length - 1;
counter = el.siblings( '.fm-item' ).length - 1;
} else {
counter++;
}
el.parent().data( 'fm-group-counter', counter );
var replaceProto = function( el, attr ) {
el.attr( attr, el.attr( attr ).replace( '-proto-', '-'+counter+'-' ) );
el.attr( attr, el.attr( attr ).replace( '-proto-', '-' + counter + '-' ) );
};

// We also need to set these unique IDs, because FM doesn't do it for us.
$( '.fm-tab-bar a', el ).each( function(){
replaceProto( $(this), 'href' );
$( '.fm-tab-bar a', el ).each( function() {
replaceProto( $( this ), 'href' );
});
$( '.wp-tabs-panel', el ).each( function(){
replaceProto( $(this), 'id' );
$( '.wp-tabs-panel', el ).each( function() {
replaceProto( $( this ), 'id' );
});
this.bindClickEvents( el );
}, this ) );
Expand Down

0 comments on commit 75c2d04

Please sign in to comment.