Ticket #10021: 10021.2.diff
File 10021.2.diff, 17.7 KB (added by , 16 years ago) |
---|
-
wp-admin/js/common.dev.js
4 4 adminMenu = { 5 5 6 6 init : function() { 7 $('#adminmenu 8 if ( $(this).siblings(' .wp-submenu').length )9 $(this).click(function(){ adminMenu.toggle( $(this).siblings(' .wp-submenu') ); });7 $('#adminmenu').find('div.wp-menu-toggle').each( function() { 8 if ( $(this).siblings('div.wp-submenu').length ) 9 $(this).click(function(){ adminMenu.toggle( $(this).siblings('div.wp-submenu') ); }); 10 10 else 11 11 $(this).hide(); 12 12 }); 13 13 logScript("$('#adminmenu div.wp-menu-toggle').each"); 14 14 15 this.favorites(); 15 16 logScript("this.favorites();"); 17 16 18 $('a.separator').click(function(){ 17 19 if ( $('body').hasClass('folded') ) { 18 20 adminMenu.fold(1); … … 23 25 } 24 26 return false; 25 27 }); 26 28 logScript("$('a.separator').click"); 29 27 30 if ( $('body').hasClass('folded') ) { 28 31 this.fold(); 29 32 } 33 logScript("$('body').hasClass('folded')"); 34 30 35 this.restoreMenuState(); 36 logScript("this.restoreMenuState();"); 31 37 }, 32 38 33 39 restoreMenuState : function() { 34 $('#adminmenu 40 $('#adminmenu').find('li.wp-has-submenu').each(function(i, e) { 35 41 var v = getUserSetting( 'm'+i ); 36 42 if ( $(e).hasClass('wp-has-current-submenu') ) return true; // leave the current parent open 37 43 … … 44 50 45 51 el['slideToggle'](150, function(){el.css('display','');}).parent().toggleClass( 'wp-menu-open' ); 46 52 47 $('#adminmenu 53 $('#adminmenu').find('li.wp-has-submenu').each(function(i, e) { 48 54 var v = $(e).hasClass('wp-menu-open') ? 'o' : 'c'; 49 55 setUserSetting( 'm'+i, v ); 50 56 }); … … 55 61 fold : function(off) { 56 62 if (off) { 57 63 $('body').removeClass('folded'); 58 $('#adminmenu 64 $('#adminmenu').find('li.wp-has-submenu').unbind(); 59 65 } else { 60 66 $('body').addClass('folded'); 61 $('#adminmenu 67 $('#adminmenu').find('li.wp-has-submenu').hoverIntent({ 62 68 over: function(e){ 63 69 var m, b, h, o, f; 64 m = $(this).find(' .wp-submenu');70 m = $(this).find('div.wp-submenu'); 65 71 b = m.parent().offset().top + m.height() + 1; // Bottom offset of the menu 66 72 h = $('#wpwrap').height(); // Height of the entire page 67 73 o = 60 + b - h; … … 76 82 } 77 83 m.addClass('sub-open'); 78 84 }, 79 out: function(){ $(this).find(' .wp-submenu').removeClass('sub-open').css({'marginTop':''}); },85 out: function(){ $(this).find('div.wp-submenu').removeClass('sub-open').css({'marginTop':''}); }, 80 86 timeout: 220, 81 87 sensitivity: 8, 82 88 interval: 100 … … 93 99 } 94 100 }; 95 101 96 $(document).ready(function(){ adminMenu.init();});102 $(document).ready(function(){logScript('adminMenu.init()');adminMenu.init();logScript('end adminMenu.init()');}); 97 103 98 104 // show/hide/save table columns 99 105 columns = { 100 106 init : function() { 101 $(' .hide-column-tog').click( function() {107 $('input.hide-column-tog').click( function() { 102 108 var column = $(this).val(), show = $(this).attr('checked'); 103 109 if ( show ) { 104 110 $('.column-' + column).show(); … … 120 126 } 121 127 } 122 128 123 $(document).ready(function(){ columns.init();});129 $(document).ready(function(){logScript('columns.init()');columns.init();logScript('end columns.init()');}); 124 130 125 131 })(jQuery); 126 132 … … 140 146 } 141 147 }; 142 148 143 jQuery(document).ready( function($) { 149 jQuery(document).ready( function($) {logScript('commons.ready()'); 144 150 var lastClicked = false, checks, first, last, checked; 145 151 146 152 // pulse 147 153 $('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300); 154 logScript("$('.fade').animate"); 148 155 149 156 // Move .updated and .error alert boxes 150 $('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2'); 151 $('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first'); 157 $('div.wrap').find('h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2'); 158 logScript("$('div.wrap h2 ~ div.updated, div.wrap h2 ~ div.error').addClass('below-h2');"); 159 160 $('div.updated, div.error').not('.below-h2').insertAfter($('div.wrap').find('h2:first')); 161 logScript("$('div.updated, div.error').not('.below-h2').insertAfter('div.wrap h2:first');"); 152 162 153 163 // show warnings 154 164 $('#doaction, #doaction2').click(function(){ … … 156 166 return showNotice.warn(); 157 167 } 158 168 }); 169 logScript("$('#doaction, #doaction2').click"); 159 170 160 171 // screen settings tab 161 172 $('#show-settings-link').click(function () { … … 174 185 }); 175 186 return false; 176 187 }); 188 logScript("$('#show-settings-link').click"); 177 189 178 190 // help tab 179 191 $('#contextual-help-link').click(function () { … … 192 204 }); 193 205 return false; 194 206 }); 207 logScript("$('#contextual-help-link').click"); 208 195 209 $('#contextual-help-link-wrap, #screen-options-link-wrap').show(); 210 logScript("$('#contextual-help-link-wrap, #screen-options-link-wrap').show();"); 196 211 197 212 // check all checkboxes 198 $( 'table:visible tbody .check-column :checkbox').click( function(e) {213 $('table:visible').children('tbody').children().children('.check-column').find('input:checkbox').click( function(e) { 199 214 if ( 'undefined' == e.shiftKey ) { return true; } 200 215 if ( e.shiftKey ) { 201 216 if ( !lastClicked ) { return true; } 202 checks = $( lastClicked ).parents( 'form:first' ).find( ' :checkbox' );217 checks = $( lastClicked ).parents( 'form:first' ).find( 'input:checkbox' ); 203 218 first = checks.index( lastClicked ); 204 219 last = checks.index( this ); 205 220 checked = $(this).attr('checked'); … … 215 230 lastClicked = this; 216 231 return true; 217 232 } ); 218 $( 'thead :checkbox, tfoot :checkbox' ).click( function(e) { 233 logScript("$( 'table:visible tbody .check-column :checkbox' ).click"); 234 235 $('thead, tfoot').find('input:checkbox').click( function(e) { 219 236 var c = $(this).attr('checked'), kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, toggle = e.shiftKey || kbtoggle; 220 237 221 238 222 $(this).parents( 'form:first' ).find( 'table tbody:visible' ).find( '.check-column:checkbox' ).attr( 'checked', function() {239 $(this).parents( 'form:first' ).find( 'table' ).children( 'tbody:visible' ).children().children('.check-column').find( 'input:checkbox' ).attr( 'checked', function() { 223 240 if ( $(this).parents('tr').is(':hidden') ) 224 241 return ''; 225 242 if ( toggle ) … … 228 245 return 'checked'; 229 246 return ''; 230 247 }); 231 $(this).parents( 'form:first' ).find( 'table thead:visible, table tfoot:visible').find( '.check-column:checkbox' ).attr( 'checked', function() {248 $(this).parents( 'form:first' ).find('table').children( 'thead:visible, tfoot:visible').children().children('.check-column').find( 'input:checkbox' ).attr( 'checked', function() { 232 249 if ( toggle ) 233 250 return ''; 234 251 else if (c) … … 236 253 return ''; 237 254 }); 238 255 }); 256 logScript("$( 'thead :checkbox, tfoot :checkbox' ).click"); 257 239 258 $('#default-password-nag-no').click( function() { 240 259 setUserSetting('default_password_nag', 'hide'); 241 260 $('div.default-password-nag').hide(); 242 261 return false; 243 262 }); 263 logScript("$('#default-password-nag-no').click"); 244 264 245 265 logScript('end commons.ready()'); 246 266 }); 247 267 248 jQuery(document).ready( function($){ 249 var turboNag = $(' .turbo-nag');268 jQuery(document).ready( function($){logScript('turbo.ready()'); 269 var turboNag = $('span.turbo-nag'); 250 270 251 271 if ( !turboNag.length || ('undefined' != typeof(google) && google.gears) ) 252 272 return; … … 263 283 } 264 284 265 285 turboNag.show(); 266 286 logScript('end turbo.ready()'); 267 287 }); -
wp-admin/js/utils.dev.js
164 164 165 165 return wpCookies.getHash('wp-settings-' + userSettings.uid) || {}; 166 166 } 167 168 169 function logScript(stop) { 170 if ( !window.d ) 171 window.d = new Date(); 172 var d = new Date(); 173 jQuery('body').append('<div>' + ( d.getTime() - window.d.getTime() ) + 'ms -- ' + stop + '</div>'); 174 window.d = d; 175 } 176 No newline at end of file -
wp-admin/js/widgets.dev.js
9 9 if ( $('body').hasClass('widgets_access') ) { 10 10 return; 11 11 } 12 13 $('#widgets-right div.sidebar-name').click(function(){ 14 var c = $(this).siblings('.widgets-sortables'); 12 logScript("$('body').hasClass('widgets_access')"); 13 14 var sortableSidebars = $('div.widgets-sortables'); 15 16 $('#widgets-right').find('div.sidebar-name').click(function(){ 17 var c = $(this).siblings('div.widgets-sortables'); 15 18 if ( c.is(':visible') ) { 16 19 c.sortable('disable'); 17 20 $(this).parent().addClass('closed'); … … 20 23 c.sortable('enable').sortable('refresh'); 21 24 } 22 25 }); 26 logScript("$('#widgets-right div.sidebar-name').click"); 23 27 24 $('#widgets-left 25 if ( $(this).siblings(' .widget-holder').is(':visible') ) {28 $('#widgets-left').find('div.sidebar-name').click(function(){ 29 if ( $(this).siblings('div.widget-holder').is(':visible') ) { 26 30 $(this).parent().addClass('closed'); 27 31 } else { 28 32 $(this).parent().removeClass('closed'); 29 33 } 30 34 }); 35 logScript("$('#widgets-left div.sidebar-name').click"); 31 36 32 $('#widgets-right .widget, #wp_inactive_widgets.widget').each(function(){37 $('#widgets-right, #wp_inactive_widgets').find('div.widget-holder').children('div.widget').each(function(){ 33 38 wpWidgets.appendTitle(this); 34 39 }); 40 logScript("$('#widgets-right .widget, #wp_inactive_widgets .widget').each"); 35 41 36 42 this.addEvents(); 37 $('.widget-error').parents('.widget').find('a.widget-action').click(); 43 logScript("this.addEvents();"); 44 45 $('.widget-error').parents('div.widget').find('a.widget-action').click(); 46 logScript("$('.widget-error').parents('.widget').find('a.widget-action').click();"); 38 47 39 48 $('#available-widgets').droppable({ 40 49 tolerance: 'pointer', … … 50 59 $('.widget-placeholder').hide(); 51 60 52 61 if ( ui.draggable.hasClass('ui-sortable-helper') ) 53 $('#removing-widget').show().children('span').html( ui.draggable.find(' .widget-titleh4').html() );62 $('#removing-widget').show().children('span').html( ui.draggable.find('div.widget-title').children('h4').html() ); 54 63 }, 55 64 out: function(e,ui) { 56 65 ui.draggable.removeClass('deleting'); … … 58 67 $('#removing-widget').hide().children('span').html(''); 59 68 } 60 69 }); 70 logScript("$('#available-widgets').droppable"); 61 71 62 $('#widget-list 63 connectToSortable: '.widgets-sortables',64 handle: ' .widget-title',72 $('#widget-list').find('div.widget').draggable({ 73 connectToSortable: sortableSidebars, 74 handle: 'div.widget-title', 65 75 distance: 2, 66 76 helper: 'clone', 67 77 zIndex: 5, 68 78 containment: 'document', 69 79 start: function(e,ui) { 70 80 wpWidgets.fixWebkit(1); 71 ui.helper.find(' .widget-description').hide();81 ui.helper.find('div.widget-description').hide(); 72 82 }, 73 83 stop: function(e,ui) { 74 84 if ( rem ) … … 77 87 wpWidgets.fixWebkit(); 78 88 } 79 89 }); 80 81 $('.widgets-sortables').sortable({ 90 logScript("$('#widget-list .widget').draggable"); 91 92 $('div.widgets-sortables').sortable({ 82 93 placeholder: 'widget-placeholder', 83 connectWith: '.widgets-sortables',84 items: ' .widget',85 handle: ' .widget-title',94 connectWith: sortableSidebars, 95 items: 'div.widget', 96 handle: 'div.widget-title', 86 97 cursor: 'move', 87 98 distance: 2, 88 99 containment: 'document', 89 100 start: function(e,ui) { 90 101 wpWidgets.fixWebkit(1); 91 ui.item.find(' .widget-inside').hide();102 ui.item.find('div.widget-inside').hide(); 92 103 ui.item.css({'marginLeft':'','width':''}); 93 104 }, 94 105 stop: function(e,ui) { … … 128 139 $(this).sortable('cancel'); 129 140 } 130 141 }).not(':visible').sortable('disable'); 142 logScript("$('.widgets-sortables').sortable"); 143 131 144 wpWidgets.resize(); 145 logScript("wpWidgets.resize();"); 146 132 147 wpWidgets.fixLabels(); 148 logScript("wpWidgets.fixLabels();"); 133 149 }, 134 150 135 151 saveOrder : function(sb) { 136 152 if ( sb ) 137 $('#' + sb).parents(' .widgets-holder-wrap').find('.ajax-feedback').css('visibility', 'visible');153 $('#' + sb).parents('div.widgets-holder-wrap').find('img.ajax-feedback').css('visibility', 'visible'); 138 154 139 155 var a = { 140 156 action: 'widgets-order', … … 142 158 sidebars: [] 143 159 }; 144 160 145 $(' .widgets-sortables').each( function() {161 $('div.widgets-sortables').each( function() { 146 162 a['sidebars[' + $(this).attr('id') + ']'] = $(this).sortable('toArray').join(','); 147 163 }); 148 164 149 165 $.post( ajaxurl, a, function() { 150 $(' .ajax-feedback').css('visibility', 'hidden');166 $('img.ajax-feedback').css('visibility', 'hidden'); 151 167 }); 152 168 this.resize(); 153 169 }, 154 170 155 171 save : function(widget, del, animate, order) { 156 var sb = widget.parents(' .widgets-sortables').attr('id'), data = widget.find('form').serialize(), a;172 var sb = widget.parents('div.widgets-sortables:first').attr('id'), data = widget.find('form').serialize(), a; 157 173 widget = $(widget); 158 174 widget.find('.ajax-feedback').css('visibility', 'visible'); 159 175 … … 172 188 var id; 173 189 174 190 if ( del ) { 175 if ( !$(' .widget_number', widget).val() ) {176 id = $(' .widget-id', widget).val();177 $('#available-widgets 191 if ( !$('input.widget_number', widget).val() ) { 192 id = $('input.widget-id', widget).val(); 193 $('#available-widgets').find('input.widget-id').each(function(){ 178 194 if ( $(this).val() == id ) 179 $(this).parents(' .widget').show();195 $(this).parents('div.widget:first').show(); 180 196 }); 181 197 } 182 198 … … 193 209 } else { 194 210 $('.ajax-feedback').css('visibility', 'hidden'); 195 211 if ( r && r.length > 2 ) { 196 $(' .widget-content', widget).html(r);212 $('div.widget-content', widget).html(r); 197 213 wpWidgets.appendTitle(widget); 198 214 wpWidgets.fixLabels(widget); 199 215 } … … 209 225 if ( this.id.indexOf('title') != -1 ) { 210 226 title = $(this).val().replace(/<[^<>]+>/g, '').replace(/</g, '<').replace(/>/g, '>'); 211 227 if ( title ) 212 $(' .widget-title .in-widget-title', widget).html(': ' + title);228 $('div.widget-title', widget).find('span.in-widget-title').html(': ' + title); 213 229 return false; 214 230 } 215 231 }); 216 232 }, 217 233 218 234 resize : function() { 219 $(' .widgets-sortables').not('#wp_inactive_widgets').each(function(){220 var h = 50, H = $(' .widget', this).length;235 $('div.widgets-sortables').not('#wp_inactive_widgets').each(function(){ 236 var h = 50, H = $('div.widget', this).length; 221 237 h = h + parseInt(H * 48, 10); 222 238 $(this).css( 'minHeight', h + 'px' ); 223 239 }); … … 234 250 fixLabels : function(sc) { 235 251 sc = sc || document; 236 252 237 $(' .widget-inside label', sc).each(function(){253 $('textarea', sc).parents('label').each(function(){ 238 254 var f = $(this).attr('for'); 239 255 240 256 if ( f && f == $('input', this).attr('id') ) … … 243 259 }, 244 260 245 261 close : function(widget) { 246 widget.find(' .widget-inside').slideUp('fast', function(){262 widget.find('div.widget-inside').slideUp('fast', function(){ 247 263 widget.css({'width':'','marginLeft':''}); 248 264 }); 249 265 }, 250 266 251 267 addEvents : function(sc) { 252 sc = sc || document; 253 $('a.widget-action', sc).click(function(){ 254 var w = parseInt( $(this).parents('.widget').find('.widget-width').val(), 10 ), css = {}, inside = $(this).parents('.widget-top').siblings('.widget-inside'); 268 var a, c; 269 if ( sc ) { 270 a = $(sc).find('div.widget-title-action:first'); 271 c = $(sc).find('div.widget-control-actions:first'); 272 } else { 273 a = $('div.widget-title-action'); 274 c = $('div.widget-control-actions'); 275 } 276 277 a.children('a.widget-action').click(function(){ 278 var w = parseInt( $(this).parents('div.widget:first').find('input.widget-width:first').val(), 10 ), css = {}, inside = $(this).parents('div.widget-top:first').siblings('div.widget-inside:first'); 255 279 if ( inside.is(':hidden') ) { 256 if ( w > 250 && inside.parents(' .widgets-sortables').length ) {280 if ( w > 250 && inside.parents('div.widgets-sortables:first').length ) { 257 281 css['width'] = w + 30 + 'px'; 258 if ( inside.parents(' .widget-liquid-right').length )282 if ( inside.parents('div.widget-liquid-right:first').length ) 259 283 css['marginLeft'] = 235 - w + 'px'; 260 inside.parents(' .widget').css(css);284 inside.parents('div.widget').css(css); 261 285 } 262 286 inside.slideDown('fast'); 263 287 } else { 264 inside.slideUp('fast', function(){ inside.parents(' .widget').css({'width':'','marginLeft':''}); });288 inside.slideUp('fast', function(){ inside.parents('div.widget:first').css({'width':'','marginLeft':''}); }); 265 289 } 266 290 return false; 267 291 }); 268 $('.widget-control-save', sc).click(function(){269 wpWidgets.save( $(this).parents(' .widget'), 0, 1, 0 );292 c.children('input.widget-control-save').click(function(){ 293 wpWidgets.save( $(this).parents('div.widget:first'), 0, 1, 0 ); 270 294 return false; 271 295 }); 272 $('.widget-control-remove', sc).click(function(){273 wpWidgets.save( $(this).parents(' .widget'), 1, 1, 0 );296 c.children('a.widget-control-remove').click(function(){ 297 wpWidgets.save( $(this).parents('div.widget:first'), 1, 1, 0 ); 274 298 return false; 275 299 }); 276 $('.widget-control-close', sc).click(function(){277 wpWidgets.close( $(this).parents(' .widget') );300 c.children('a.widget-control-close').click(function(){ 301 wpWidgets.close( $(this).parents('div.widget:first') ); 278 302 return false; 279 303 }); 280 304 } 281 305 }; 282 $(document).ready(function(){ wpWidgets.init();});306 $(document).ready(function(){logScript('widgets.init()');wpWidgets.init();logScript('end widgets.init()');}); 283 307 284 308 })(jQuery);