Ticket #20614: 20614-3.patch
File 20614-3.patch, 6.9 KB (added by , 12 years ago) |
---|
-
wp-admin/js/common.js
195 195 } 196 196 }); 197 197 198 $('li.wp-has-submenu', menu).hoverIntent({ 199 over: function(e){ 200 var b, h, o, f, m = $(this).find('.wp-submenu'), menutop, wintop, maxtop, top = parseInt( m.css('top'), 10 ); 198 if ( 'ontouchstart' in window ) { // touch screen device 199 // close any open submenus 200 $(document.body).on('click.wp-mobile-adminmenu-hover', function() { 201 menu.find('li.wp-has-submenu.opensub').removeClass('opensub'); 202 }); 201 203 202 if ( isNaN(top) || top > -5 ) // meaning the submenu is visible203 return;204 menu.find('li.wp-has-submenu').on('click.wp-mobile-adminmenu-hover', function(e) { 205 var el = $(this); 204 206 205 menutop = $(this).offset().top; 206 wintop = $(window).scrollTop(); 207 maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar 207 if ( !el.hasClass('opensub') ) { 208 e.preventDefault(); 209 e.stopPropagation(); 210 el.addClass('opensub'); 211 } 212 }).on('mousedown.wp-mobile-adminmenu-hover', function(e){ 213 menu.find('li.wp-has-submenu.opensub').removeClass('opensub'); 214 }); 215 } else { 216 menu.find('li.wp-has-submenu').hoverIntent({ 217 over: function(e){ 218 var b, h, o, f, m = $(this).find('.wp-submenu'), menutop, wintop, maxtop, top = parseInt( m.css('top'), 10 ); 208 219 209 b = menutop + m.height() + 1; // Bottom offset of the menu 210 h = $('#wpwrap').height(); // Height of the entire page 211 o = 60 + b - h; 212 f = $(window).height() + wintop - 15; // The fold 220 if ( isNaN(top) || top > -5 ) // meaning the submenu is visible 221 return; 213 222 214 if ( f < (b - o) ) 215 o = b - f; 223 menutop = $(this).offset().top; 224 wintop = $(window).scrollTop(); 225 maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar 216 226 217 if ( o > maxtop ) 218 o = maxtop; 227 b = menutop + m.height() + 1; // Bottom offset of the menu 228 h = $('#wpwrap').height(); // Height of the entire page 229 o = 60 + b - h; 230 f = $(window).height() + wintop - 15; // The fold 219 231 220 if ( o > 1 ) 221 m.css('margin-top', '-'+o+'px'); 222 else 223 m.css('margin-top', ''); 232 if ( f < (b - o) ) 233 o = b - f; 224 234 225 menu.find('li.menu-top').removeClass('opensub'); 226 $(this).addClass('opensub'); 227 }, 228 out: function(){ 229 $(this).removeClass('opensub').find('.wp-submenu').css('margin-top', ''); 230 }, 231 timeout: 200, 232 sensitivity: 7, 233 interval: 90 234 }); 235 if ( o > maxtop ) 236 o = maxtop; 235 237 236 menu.on('focus.adminmenu', '.wp-submenu a', function(e){ 237 $(e.target).closest('li.menu-top').addClass('opensub'); 238 }).on('blur.adminmenu', '.wp-submenu a', function(e){ 239 $(e.target).closest('li.menu-top').removeClass('opensub'); 240 }); 238 if ( o > 1 ) 239 m.css('margin-top', '-'+o+'px'); 240 else 241 m.css('margin-top', ''); 241 242 243 menu.find('li.menu-top').removeClass('opensub'); 244 $(this).addClass('opensub'); 245 }, 246 out: function(){ 247 $(this).removeClass('opensub').find('.wp-submenu').css('margin-top', ''); 248 }, 249 timeout: 200, 250 sensitivity: 7, 251 interval: 90 252 }); 253 254 menu.on('focus.adminmenu', '.wp-submenu a', function(e){ 255 $(e.target).closest('li.menu-top').addClass('opensub'); 256 }).on('blur.adminmenu', '.wp-submenu a', function(e){ 257 $(e.target).closest('li.menu-top').removeClass('opensub'); 258 }); 259 } 260 242 261 // Move .updated and .error alert boxes. Don't move boxes designed to be inline. 243 262 $('div.wrap h2:first').nextAll('div.updated, div.error').addClass('below-h2'); 244 263 $('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') ); -
wp-includes/js/admin-bar.js
4 4 (function(a){a.fn.hoverIntent=function(l,j){var m={sensitivity:7,interval:100,timeout:0};m=a.extend(m,j?{over:l,out:j}:l);var o,n,h,d;var e=function(f){o=f.pageX;n=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-o)+Math.abs(d-n))<m.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return m.over.apply(f,[g])}else{h=o;d=n;f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return m.out.apply(f,[g])};var b=function(q){var f=this;var g=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(g&&g!=this){try{g=g.parentNode}catch(q){g=this}}if(g==this){if(a.browser.mozilla){if(q.type=="mouseout"){f.mtout=setTimeout(function(){k(q,f)},30)}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}}}return}else{if(f.mtout){f.mtout=clearTimeout(f.mtout)}k(q,f)}};var k=function(p,f){var g=jQuery.extend({},p);if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(p.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},m.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},m.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery); 5 5 6 6 jQuery(document).ready(function($){ 7 var refresh = function(i, el){ // force the browser to refresh the tabbing index7 var adminbar = $('#wpadminbar'), refresh = function(i, el){ // force the browser to refresh the tabbing index 8 8 var node = $(el), tab = node.attr('tabindex'); 9 9 if ( tab ) 10 10 node.attr('tabindex', '0').attr('tabindex', tab); 11 11 }; 12 12 13 $('#wpadminbar').removeClass('nojq').removeClass('nojs').find('li.menupop').hoverIntent({ 14 over: function(e){ 15 $(this).addClass('hover'); 16 }, 17 out: function(e){ 18 $(this).removeClass('hover'); 19 }, 20 timeout: 180, 21 sensitivity: 7, 22 interval: 100 23 }); 13 adminbar.removeClass('nojq').removeClass('nojs'); 14 15 if ( 'ontouchstart' in window ) { // touch screen device 16 // close any open drop-downs 17 $(document.body).on('click.wp-mobile-adminbar-hover', function() { 18 adminbar.find('li.menupop.hover').removeClass('hover'); 19 }); 24 20 21 adminbar.find('li.menupop').on('click.wp-mobile-adminbar-hover', function(e) { 22 var el = $(this); 23 24 if ( !el.hasClass('hover') ) { 25 e.preventDefault(); 26 e.stopPropagation(); 27 el.addClass('hover'); 28 } 29 }).on('mousedown.wp-mobile-adminbar-hover', function(e) { 30 // close any open drop-downs earlier when "clicking" on the toolbar 31 adminbar.find('li.menupop.hover').removeClass('hover'); 32 }); 33 } else { 34 adminbar.find('li.menupop').hoverIntent({ 35 over: function(e){ 36 $(this).addClass('hover'); 37 }, 38 out: function(e){ 39 $(this).removeClass('hover'); 40 }, 41 timeout: 180, 42 sensitivity: 7, 43 interval: 100 44 }); 45 } 46 25 47 $('#wp-admin-bar-get-shortlink').click(function(e){ 26 48 e.preventDefault(); 27 49 $(this).addClass('selected').children('.shortlink-input').blur(function(){