]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/admin-bar.js
Wordpress 3.6
[autoinstalls/wordpress.git] / wp-includes / js / admin-bar.js
index cb4e1184918136d8ffda237ccf9cf86a249db440..b75823ce8b700ac97bd0419e344ce401f61d2ad0 100644 (file)
@@ -1,8 +1,9 @@
 // use jQuery and hoverIntent if loaded
 if ( typeof(jQuery) != 'undefined' ) {
-       if ( typeof(jQuery.fn.hoverIntent) == 'undefined' )
-               (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);
-
+       if ( typeof(jQuery.fn.hoverIntent) == 'undefined' ) {
+               // hoverIntent r6 - Copy of wp-includes/js/hoverIntent.min.js
+               (function(a){a.fn.hoverIntent=function(m,d,h){var j={interval:100,sensitivity:7,timeout:0};if(typeof m==="object"){j=a.extend(j,m)}else{if(a.isFunction(d)){j=a.extend(j,{over:m,out:d,selector:h})}else{j=a.extend(j,{over:m,out:m,selector:d})}}var l,k,g,f;var e=function(n){l=n.pageX;k=n.pageY};var c=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if((Math.abs(g-l)+Math.abs(f-k))<j.sensitivity){a(n).off("mousemove.hoverIntent",e);n.hoverIntent_s=1;return j.over.apply(n,[o])}else{g=l;f=k;n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}};var i=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);n.hoverIntent_s=0;return j.out.apply(n,[o])};var b=function(p){var o=jQuery.extend({},p);var n=this;if(n.hoverIntent_t){n.hoverIntent_t=clearTimeout(n.hoverIntent_t)}if(p.type=="mouseenter"){g=o.pageX;f=o.pageY;a(n).on("mousemove.hoverIntent",e);if(n.hoverIntent_s!=1){n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}}else{a(n).off("mousemove.hoverIntent",e);if(n.hoverIntent_s==1){n.hoverIntent_t=setTimeout(function(){i(o,n)},j.timeout)}}};return this.on({"mouseenter.hoverIntent":b,"mouseleave.hoverIntent":b},j.selector)}})(jQuery);
+       }
        jQuery(document).ready(function($){
                var adminbar = $('#wpadminbar'), refresh, touchOpen, touchClose, disableHoverIntent = false;
 
@@ -124,12 +125,25 @@ if ( typeof(jQuery) != 'undefined' ) {
 
                        var id = $(this).attr('href');
 
-                       if ( $.browser.webkit && id && id.charAt(0) == '#' ) {
+                       var ua = navigator.userAgent.toLowerCase();
+                       if ( ua.indexOf('applewebkit') != -1 && id && id.charAt(0) == '#' ) {
                                setTimeout(function () {
                                        $(id).focus();
                                }, 100);
                        }
                });
+
+               // Empty sessionStorage on logging out
+               if ( 'sessionStorage' in window ) {
+                       $('#wp-admin-bar-logout a').click( function() {
+                               try {
+                                       for ( var key in sessionStorage ) {
+                                               if ( key.indexOf('wp-autosave-') != -1 )
+                                                       sessionStorage.removeItem(key);
+                                       }
+                               } catch(e) {}
+                       });
+               }
        });
 } else {
        (function(d, w) {
@@ -308,6 +322,17 @@ if ( typeof(jQuery) != 'undefined' ) {
                                addEvent(aB, 'click', function(e) {
                                        scrollToTop( e.target || e.srcElement );
                                });
+
+                               addEvent( document.getElementById('wp-admin-bar-logout'), 'click', function() {
+                                       if ( 'sessionStorage' in window ) {
+                                               try {
+                                                       for ( var key in sessionStorage ) {
+                                                               if ( key.indexOf('wp-autosave-') != -1 )
+                                                                       sessionStorage.removeItem(key);
+                                                       }
+                                               } catch(e) {}
+                                       }
+                               });
                        }
 
                        if ( w.location.hash )