diff --git a/src/wp-admin/js/common.js b/src/wp-admin/js/common.js
index 200d3e4..9335d60 100644
|
a
|
b
|
|
| 1 | | /* global setUserSetting, ajaxurl, commonL10n, alert, confirm, pagenow */ |
| | 1 | /* global setUserSetting, commonL10n, alert, confirm, pagenow */ |
| 2 | 2 | var showNotice, adminMenu, columns, validateForm, screenMeta; |
| 3 | 3 | ( function( $, window, undefined ) { |
| 4 | 4 | var $document = $( document ), |
| … |
… |
columns = { |
| 28 | 28 | |
| 29 | 29 | columns.saveManageColumnsState(); |
| 30 | 30 | }); |
| | 31 | |
| | 32 | $( '#adv-settings' ).on( 'submit', columns.delaySubmitIfAjaxRequest ); |
| 31 | 33 | }, |
| 32 | 34 | |
| 33 | | saveManageColumnsState : function() { |
| | 35 | saveManageColumnsState : _.debounce( function() { |
| 34 | 36 | var hidden = this.hidden(); |
| 35 | | $.post(ajaxurl, { |
| 36 | | action: 'hidden-columns', |
| | 37 | |
| | 38 | if ( columns.ajaxRequest ) { |
| | 39 | columns.ajaxRequest.abort(); |
| | 40 | } |
| | 41 | columns.ajaxRequest = wp.ajax.post( 'hidden-columns', { |
| 37 | 42 | hidden: hidden, |
| 38 | | screenoptionnonce: $('#screenoptionnonce').val(), |
| | 43 | screenoptionnonce: $( '#screenoptionnonce' ).val(), |
| 39 | 44 | page: pagenow |
| 40 | 45 | }); |
| | 46 | columns.ajaxRequest.always( function() { |
| | 47 | columns.ajaxRequest = null; |
| | 48 | } ); |
| | 49 | }, 2000, true ), |
| | 50 | |
| | 51 | delaySubmitIfAjaxRequest: function( event ) { |
| | 52 | if ( columns.ajaxRequest ) { |
| | 53 | event.preventDefault(); |
| | 54 | columns.ajaxRequest.always( function() { |
| | 55 | $( event.currentTarget ).trigger( event.type ); |
| | 56 | } ); |
| | 57 | } else { |
| | 58 | return true; |
| | 59 | } |
| 41 | 60 | }, |
| 42 | 61 | |
| 43 | 62 | checked : function(column) { |
diff --git a/src/wp-admin/js/nav-menu.js b/src/wp-admin/js/nav-menu.js
index abb437d..7673cb0 100644
|
a
|
b
|
var wpNavMenu; |
| 603 | 603 | // hide fields |
| 604 | 604 | api.menuList.hideAdvancedMenuItemFields(); |
| 605 | 605 | |
| 606 | | $('.hide-postbox-tog').click(function () { |
| 607 | | var hidden = $( '.accordion-container li.accordion-section' ).filter(':hidden').map(function() { return this.id; }).get().join(','); |
| 608 | | $.post(ajaxurl, { |
| 609 | | action: 'closed-postboxes', |
| 610 | | hidden: hidden, |
| 611 | | closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(), |
| 612 | | page: 'nav-menus' |
| 613 | | }); |
| 614 | | }); |
| | 606 | $( '.hide-postbox-tog' ).click( api.handleMenuScreenOptionClick ); |
| 615 | 607 | }, |
| 616 | 608 | |
| | 609 | /** |
| | 610 | * Handle click on menu screen option checkbox. |
| | 611 | * |
| | 612 | * On click, create a debounced wp.ajax call, based on which box is clicked. |
| | 613 | * This toggles the displayed state of the the menu item field. |
| | 614 | * |
| | 615 | * @returns {void} |
| | 616 | */ |
| | 617 | handleMenuScreenOptionClick : _.debounce( function() { |
| | 618 | var hidden = $( '.accordion-container li.accordion-section' ).filter( ':hidden' ).map(function() { return this.id; }).get().join( ',' ); |
| | 619 | |
| | 620 | if ( api.menuList._updateBasedOnScreenOptions ) { |
| | 621 | api.menuList._updateBasedOnScreenOptions.abort(); |
| | 622 | } |
| | 623 | api.menuList._updateBasedOnScreenOptions = wp.ajax.post( 'closed-postboxes', { |
| | 624 | hidden: hidden, |
| | 625 | closedpostboxesnonce: $( '#closedpostboxesnonce' ).val(), |
| | 626 | page: 'nav-menus' |
| | 627 | } ); |
| | 628 | api.menuList._updateBasedOnScreenOptions.always( function() { |
| | 629 | api.menuList._updateBasedOnScreenOptions = null; |
| | 630 | } ); |
| | 631 | }, 2000 ), |
| | 632 | |
| 617 | 633 | initSortables : function() { |
| 618 | 634 | var currentDepth = 0, originalDepth, minDepth, maxDepth, |
| 619 | 635 | prev, next, prevBottom, nextThreshold, helperHeight, transport, |
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index a7019b0..1767960 100644
|
a
|
b
|
function wp_default_scripts( &$scripts ) { |
| 75 | 75 | 'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ), |
| 76 | 76 | ) ); |
| 77 | 77 | |
| 78 | | $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 ); |
| | 78 | $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils', 'underscore', 'wp-util' ), false, 1 ); |
| 79 | 79 | did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array( |
| 80 | 80 | 'warnDelete' => __( "You are about to permanently delete these items.\n 'Cancel' to stop, 'OK' to delete." ), |
| 81 | 81 | 'dismiss' => __( 'Dismiss this notice.' ), |
| … |
… |
function wp_default_scripts( &$scripts ) { |
| 724 | 724 | ) ); |
| 725 | 725 | |
| 726 | 726 | // Navigation Menus |
| 727 | | $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'json2' ) ); |
| | 727 | $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'json2', 'underscore', 'wp-util' ) ); |
| 728 | 728 | did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array( |
| 729 | 729 | 'noResultsFound' => __( 'No results found.' ), |
| 730 | 730 | 'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ), |