]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/common.js
WordPress 4.0.1-scripts
[autoinstalls/wordpress.git] / wp-admin / js / common.js
index 510f2952fcf7ccbd13500601e08d29dfaa202964..b61763af06a0e3dd19fc85fad4cef1327f7741fa 100644 (file)
@@ -131,6 +131,8 @@ screenMeta = {
                        panel.focus();
                        link.addClass('screen-meta-active').attr('aria-expanded', true);
                });
+
+               $( document ).trigger( 'screen:options:open' );
        },
 
        close: function( panel, link ) {
@@ -139,13 +141,15 @@ screenMeta = {
                        $('.screen-meta-toggle').css('visibility', '');
                        panel.parent().hide();
                });
+
+               $( document ).trigger( 'screen:options:close' );
        }
 };
 
 /**
  * Help tabs.
  */
-$('.contextual-help-tabs').delegate('a', 'click focus', function(e) {
+$('.contextual-help-tabs').delegate('a', 'click', function(e) {
        var link = $(this),
                panel;
 
@@ -179,7 +183,7 @@ $(document).ready( function() {
        });
 
        $('#collapse-menu').on('click.collapse-menu', function() {
-               var body = $( document.body ), respWidth;
+               var body = $( document.body ), respWidth, state;
 
                // reset any compensation for submenus near the bottom of the screen
                $('#adminmenu div.wp-submenu').css('margin-top', '');
@@ -189,27 +193,33 @@ $(document).ready( function() {
                        respWidth = Math.max( window.innerWidth, document.documentElement.clientWidth );
                } else {
                        // IE < 9 doesn't support @media CSS rules
-                       respWidth = 901;
+                       respWidth = 961;
                }
 
-               if ( respWidth && respWidth < 900 ) {
+               if ( respWidth && respWidth < 960 ) {
                        if ( body.hasClass('auto-fold') ) {
                                body.removeClass('auto-fold').removeClass('folded');
                                setUserSetting('unfold', 1);
                                setUserSetting('mfold', 'o');
+                               state = 'open';
                        } else {
                                body.addClass('auto-fold');
                                setUserSetting('unfold', 0);
+                               state = 'folded';
                        }
                } else {
                        if ( body.hasClass('folded') ) {
                                body.removeClass('folded');
                                setUserSetting('mfold', 'o');
+                               state = 'open';
                        } else {
                                body.addClass('folded');
                                setUserSetting('mfold', 'f');
+                               state = 'folded';
                        }
                }
+
+               $( document ).trigger( 'wp-collapse-menu', { state: state } );
        });
 
        if ( 'ontouchstart' in window || /IEMobile\/[1-9]/.test(navigator.userAgent) ) { // touch screen device
@@ -581,8 +591,7 @@ $(document).ready( function() {
 
        window.wpResponsive = {
                init: function() {
-                       var self = this,
-                               scrollStart = 0;
+                       var self = this;
 
                        // Modify functionality based on custom activate/deactivate event
                        $document.on( 'wp-responsive-activate.wp-responsive', function() {
@@ -606,12 +615,8 @@ $(document).ready( function() {
                        } );
 
                        // Add menu events
-                       $adminmenu.on( 'touchstart.wp-responsive', 'li.wp-has-submenu > a', function() {
-                               scrollStart = $window.scrollTop();
-                       }).on( 'touchend.wp-responsive click.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
-                               if ( ! $adminmenu.data('wp-responsive') ||
-                                       ( event.type === 'touchend' && $window.scrollTop() !== scrollStart ) ) {
-
+                       $adminmenu.on( 'click.wp-responsive', 'li.wp-has-submenu > a', function( event ) {
+                               if ( ! $adminmenu.data('wp-responsive') ) {
                                        return;
                                }
 
@@ -721,7 +726,7 @@ $(document).ready( function() {
        window.wpResponsive.init();
 });
 
-// make Windows 8 devices playing along nicely
+// Make Windows 8 devices play along nicely.
 (function(){
        if ( '-ms-user-select' in document.documentElement.style && navigator.userAgent.match(/IEMobile\/10\.0/) ) {
                var msViewportStyle = document.createElement( 'style' );