Ticket #21273: 21273-6.patch
| File 21273-6.patch, 2.4 KB (added by azaozz, 10 months ago) |
|---|
-
wp-admin/js/common.dev.js
95 95 page: null, // #wpcontent 96 96 97 97 init: function() { 98 var self = this; 99 98 100 this.element = $('#screen-meta'); 99 101 this.toggles = $('.screen-meta-toggle a'); 100 102 this.page = $('#wpcontent'); 101 103 102 104 this.toggles.click( this.toggleEvent ); 105 106 $(document).ready( function(){ 107 $(document.body).bind('click.help-tabs focus.help-tabs', function(e){ 108 if ( e.target.href && /#tab-panel-/.test(e.target.href) ) { 109 self.triggerHelpPanel( e.target.href.replace(/.*?#/, '#') ); 110 e.preventDefault(); 111 } 112 }); 113 }); 103 114 }, 104 115 105 116 toggleEvent: function( e ) { … … 131 142 $('.screen-meta-toggle').css('visibility', ''); 132 143 panel.parent().hide(); 133 144 }); 134 } 135 }; 145 }, 136 146 137 /** 138 * Help tabs. 139 */ 140 $('.contextual-help-tabs').delegate('a', 'click focus', function(e) { 141 var link = $(this), 142 panel; 147 triggerHelpPanel: function( panel ) { 148 panel = panel || window.location.hash; 143 149 144 e.preventDefault(); 150 // Check if the panel exists 151 if ( !panel || !$('#contextual-help-wrap '+panel).length ) 152 return; 145 153 146 // Don't do anything if the click is for the tab already showing.147 if ( link.is('.active a') )148 return false;154 // Don't do anything if the panel is already visible and the click is for the active tab. 155 if ( $('#contextual-help-wrap').is(':visible') && $( panel ).hasClass('active') ) 156 return false; 149 157 150 // Links151 $('.contextual-help-tabs .active').removeClass('active');152 link.parent('li').addClass('active');158 // Active the clicked panel. 159 $('.contextual-help-tabs li, div.help-tab-content').removeClass('active'); 160 $( panel+', '+panel.replace(/tab-panel-/, 'tab-link-') ).addClass('active'); 153 161 154 panel = $( link.attr('href') ); 162 // Open the help panel. 163 $('html').animate({ scrollTop: 0 }, 'fast', function(){ 164 if ( $('#contextual-help-wrap').is(':hidden') ) 165 screenMeta.open( $('#contextual-help-wrap'), $('#contextual-help-link') ); 166 }); 167 } 168 }; 155 169 156 // Panels157 $('.help-tab-content').not( panel ).removeClass('active').hide();158 panel.addClass('active').show();159 });160 161 170 $(document).ready( function() { 162 171 var lastClicked = false, checks, first, last, checked, menu = $('#adminmenu'), 163 172 pageInput = $('input.current-page'), currentPage = pageInput.val(), refresh;
