Edit File by line
/home/barbar84/www/wp-admin/js
File: common.js
.addClass( 'form-invalid' )
[500] Fix | Delete
.find( ':input:visible' )
[501] Fix | Delete
.on( 'change', function() { $( this ).closest( '.form-invalid' ).removeClass( 'form-invalid' ); } )
[502] Fix | Delete
.length;
[503] Fix | Delete
};
[504] Fix | Delete
[505] Fix | Delete
// Stub for doing better warnings.
[506] Fix | Delete
/**
[507] Fix | Delete
* Shows message pop-up notice or confirmation message.
[508] Fix | Delete
*
[509] Fix | Delete
* @since 2.7.0
[510] Fix | Delete
*
[511] Fix | Delete
* @type {{warn: showNotice.warn, note: showNotice.note}}
[512] Fix | Delete
*
[513] Fix | Delete
* @return {void}
[514] Fix | Delete
*/
[515] Fix | Delete
window.showNotice = {
[516] Fix | Delete
[517] Fix | Delete
/**
[518] Fix | Delete
* Shows a delete confirmation pop-up message.
[519] Fix | Delete
*
[520] Fix | Delete
* @since 2.7.0
[521] Fix | Delete
*
[522] Fix | Delete
* @return {boolean} Returns true if the message is confirmed.
[523] Fix | Delete
*/
[524] Fix | Delete
warn : function() {
[525] Fix | Delete
if ( confirm( __( 'You are about to permanently delete these items from your site.\nThis action cannot be undone.\n\'Cancel\' to stop, \'OK\' to delete.' ) ) ) {
[526] Fix | Delete
return true;
[527] Fix | Delete
}
[528] Fix | Delete
[529] Fix | Delete
return false;
[530] Fix | Delete
},
[531] Fix | Delete
[532] Fix | Delete
/**
[533] Fix | Delete
* Shows an alert message.
[534] Fix | Delete
*
[535] Fix | Delete
* @since 2.7.0
[536] Fix | Delete
*
[537] Fix | Delete
* @param text The text to display in the message.
[538] Fix | Delete
*/
[539] Fix | Delete
note : function(text) {
[540] Fix | Delete
alert(text);
[541] Fix | Delete
}
[542] Fix | Delete
};
[543] Fix | Delete
[544] Fix | Delete
/**
[545] Fix | Delete
* Represents the functions for the meta screen options panel.
[546] Fix | Delete
*
[547] Fix | Delete
* @since 3.2.0
[548] Fix | Delete
*
[549] Fix | Delete
* @type {{element: null, toggles: null, page: null, init: screenMeta.init,
[550] Fix | Delete
* toggleEvent: screenMeta.toggleEvent, open: screenMeta.open,
[551] Fix | Delete
* close: screenMeta.close}}
[552] Fix | Delete
*
[553] Fix | Delete
* @return {void}
[554] Fix | Delete
*/
[555] Fix | Delete
window.screenMeta = {
[556] Fix | Delete
element: null, // #screen-meta
[557] Fix | Delete
toggles: null, // .screen-meta-toggle
[558] Fix | Delete
page: null, // #wpcontent
[559] Fix | Delete
[560] Fix | Delete
/**
[561] Fix | Delete
* Initializes the screen meta options panel.
[562] Fix | Delete
*
[563] Fix | Delete
* @since 3.2.0
[564] Fix | Delete
*
[565] Fix | Delete
* @return {void}
[566] Fix | Delete
*/
[567] Fix | Delete
init: function() {
[568] Fix | Delete
this.element = $('#screen-meta');
[569] Fix | Delete
this.toggles = $( '#screen-meta-links' ).find( '.show-settings' );
[570] Fix | Delete
this.page = $('#wpcontent');
[571] Fix | Delete
[572] Fix | Delete
this.toggles.on( 'click', this.toggleEvent );
[573] Fix | Delete
},
[574] Fix | Delete
[575] Fix | Delete
/**
[576] Fix | Delete
* Toggles the screen meta options panel.
[577] Fix | Delete
*
[578] Fix | Delete
* @since 3.2.0
[579] Fix | Delete
*
[580] Fix | Delete
* @return {void}
[581] Fix | Delete
*/
[582] Fix | Delete
toggleEvent: function() {
[583] Fix | Delete
var panel = $( '#' + $( this ).attr( 'aria-controls' ) );
[584] Fix | Delete
[585] Fix | Delete
if ( !panel.length )
[586] Fix | Delete
return;
[587] Fix | Delete
[588] Fix | Delete
if ( panel.is(':visible') )
[589] Fix | Delete
screenMeta.close( panel, $(this) );
[590] Fix | Delete
else
[591] Fix | Delete
screenMeta.open( panel, $(this) );
[592] Fix | Delete
},
[593] Fix | Delete
[594] Fix | Delete
/**
[595] Fix | Delete
* Opens the screen meta options panel.
[596] Fix | Delete
*
[597] Fix | Delete
* @since 3.2.0
[598] Fix | Delete
*
[599] Fix | Delete
* @param {jQuery} panel The screen meta options panel div.
[600] Fix | Delete
* @param {jQuery} button The toggle button.
[601] Fix | Delete
*
[602] Fix | Delete
* @return {void}
[603] Fix | Delete
*/
[604] Fix | Delete
open: function( panel, button ) {
[605] Fix | Delete
[606] Fix | Delete
$( '#screen-meta-links' ).find( '.screen-meta-toggle' ).not( button.parent() ).css( 'visibility', 'hidden' );
[607] Fix | Delete
[608] Fix | Delete
panel.parent().show();
[609] Fix | Delete
[610] Fix | Delete
/**
[611] Fix | Delete
* Sets the focus to the meta options panel and adds the necessary CSS classes.
[612] Fix | Delete
*
[613] Fix | Delete
* @since 3.2.0
[614] Fix | Delete
*
[615] Fix | Delete
* @return {void}
[616] Fix | Delete
*/
[617] Fix | Delete
panel.slideDown( 'fast', function() {
[618] Fix | Delete
panel.trigger( 'focus' );
[619] Fix | Delete
button.addClass( 'screen-meta-active' ).attr( 'aria-expanded', true );
[620] Fix | Delete
});
[621] Fix | Delete
[622] Fix | Delete
$document.trigger( 'screen:options:open' );
[623] Fix | Delete
},
[624] Fix | Delete
[625] Fix | Delete
/**
[626] Fix | Delete
* Closes the screen meta options panel.
[627] Fix | Delete
*
[628] Fix | Delete
* @since 3.2.0
[629] Fix | Delete
*
[630] Fix | Delete
* @param {jQuery} panel The screen meta options panel div.
[631] Fix | Delete
* @param {jQuery} button The toggle button.
[632] Fix | Delete
*
[633] Fix | Delete
* @return {void}
[634] Fix | Delete
*/
[635] Fix | Delete
close: function( panel, button ) {
[636] Fix | Delete
/**
[637] Fix | Delete
* Hides the screen meta options panel.
[638] Fix | Delete
*
[639] Fix | Delete
* @since 3.2.0
[640] Fix | Delete
*
[641] Fix | Delete
* @return {void}
[642] Fix | Delete
*/
[643] Fix | Delete
panel.slideUp( 'fast', function() {
[644] Fix | Delete
button.removeClass( 'screen-meta-active' ).attr( 'aria-expanded', false );
[645] Fix | Delete
$('.screen-meta-toggle').css('visibility', '');
[646] Fix | Delete
panel.parent().hide();
[647] Fix | Delete
});
[648] Fix | Delete
[649] Fix | Delete
$document.trigger( 'screen:options:close' );
[650] Fix | Delete
}
[651] Fix | Delete
};
[652] Fix | Delete
[653] Fix | Delete
/**
[654] Fix | Delete
* Initializes the help tabs in the help panel.
[655] Fix | Delete
*
[656] Fix | Delete
* @param {Event} e The event object.
[657] Fix | Delete
*
[658] Fix | Delete
* @return {void}
[659] Fix | Delete
*/
[660] Fix | Delete
$('.contextual-help-tabs').on( 'click', 'a', function(e) {
[661] Fix | Delete
var link = $(this),
[662] Fix | Delete
panel;
[663] Fix | Delete
[664] Fix | Delete
e.preventDefault();
[665] Fix | Delete
[666] Fix | Delete
// Don't do anything if the click is for the tab already showing.
[667] Fix | Delete
if ( link.is('.active a') )
[668] Fix | Delete
return false;
[669] Fix | Delete
[670] Fix | Delete
// Links.
[671] Fix | Delete
$('.contextual-help-tabs .active').removeClass('active');
[672] Fix | Delete
link.parent('li').addClass('active');
[673] Fix | Delete
[674] Fix | Delete
panel = $( link.attr('href') );
[675] Fix | Delete
[676] Fix | Delete
// Panels.
[677] Fix | Delete
$('.help-tab-content').not( panel ).removeClass('active').hide();
[678] Fix | Delete
panel.addClass('active').show();
[679] Fix | Delete
});
[680] Fix | Delete
[681] Fix | Delete
/**
[682] Fix | Delete
* Update custom permalink structure via buttons.
[683] Fix | Delete
*/
[684] Fix | Delete
var permalinkStructureFocused = false,
[685] Fix | Delete
$permalinkStructure = $( '#permalink_structure' ),
[686] Fix | Delete
$permalinkStructureInputs = $( '.permalink-structure input:radio' ),
[687] Fix | Delete
$permalinkCustomSelection = $( '#custom_selection' ),
[688] Fix | Delete
$availableStructureTags = $( '.form-table.permalink-structure .available-structure-tags button' );
[689] Fix | Delete
[690] Fix | Delete
// Change permalink structure input when selecting one of the common structures.
[691] Fix | Delete
$permalinkStructureInputs.on( 'change', function() {
[692] Fix | Delete
if ( 'custom' === this.value ) {
[693] Fix | Delete
return;
[694] Fix | Delete
}
[695] Fix | Delete
[696] Fix | Delete
$permalinkStructure.val( this.value );
[697] Fix | Delete
[698] Fix | Delete
// Update button states after selection.
[699] Fix | Delete
$availableStructureTags.each( function() {
[700] Fix | Delete
changeStructureTagButtonState( $( this ) );
[701] Fix | Delete
} );
[702] Fix | Delete
} );
[703] Fix | Delete
[704] Fix | Delete
$permalinkStructure.on( 'click input', function() {
[705] Fix | Delete
$permalinkCustomSelection.prop( 'checked', true );
[706] Fix | Delete
} );
[707] Fix | Delete
[708] Fix | Delete
// Check if the permalink structure input field has had focus at least once.
[709] Fix | Delete
$permalinkStructure.on( 'focus', function( event ) {
[710] Fix | Delete
permalinkStructureFocused = true;
[711] Fix | Delete
$( this ).off( event );
[712] Fix | Delete
} );
[713] Fix | Delete
[714] Fix | Delete
/**
[715] Fix | Delete
* Enables or disables a structure tag button depending on its usage.
[716] Fix | Delete
*
[717] Fix | Delete
* If the structure is already used in the custom permalink structure,
[718] Fix | Delete
* it will be disabled.
[719] Fix | Delete
*
[720] Fix | Delete
* @param {Object} button Button jQuery object.
[721] Fix | Delete
*/
[722] Fix | Delete
function changeStructureTagButtonState( button ) {
[723] Fix | Delete
if ( -1 !== $permalinkStructure.val().indexOf( button.text().trim() ) ) {
[724] Fix | Delete
button.attr( 'data-label', button.attr( 'aria-label' ) );
[725] Fix | Delete
button.attr( 'aria-label', button.attr( 'data-used' ) );
[726] Fix | Delete
button.attr( 'aria-pressed', true );
[727] Fix | Delete
button.addClass( 'active' );
[728] Fix | Delete
} else if ( button.attr( 'data-label' ) ) {
[729] Fix | Delete
button.attr( 'aria-label', button.attr( 'data-label' ) );
[730] Fix | Delete
button.attr( 'aria-pressed', false );
[731] Fix | Delete
button.removeClass( 'active' );
[732] Fix | Delete
}
[733] Fix | Delete
}
[734] Fix | Delete
[735] Fix | Delete
// Check initial button state.
[736] Fix | Delete
$availableStructureTags.each( function() {
[737] Fix | Delete
changeStructureTagButtonState( $( this ) );
[738] Fix | Delete
} );
[739] Fix | Delete
[740] Fix | Delete
// Observe permalink structure field and disable buttons of tags that are already present.
[741] Fix | Delete
$permalinkStructure.on( 'change', function() {
[742] Fix | Delete
$availableStructureTags.each( function() {
[743] Fix | Delete
changeStructureTagButtonState( $( this ) );
[744] Fix | Delete
} );
[745] Fix | Delete
} );
[746] Fix | Delete
[747] Fix | Delete
$availableStructureTags.on( 'click', function() {
[748] Fix | Delete
var permalinkStructureValue = $permalinkStructure.val(),
[749] Fix | Delete
selectionStart = $permalinkStructure[ 0 ].selectionStart,
[750] Fix | Delete
selectionEnd = $permalinkStructure[ 0 ].selectionEnd,
[751] Fix | Delete
textToAppend = $( this ).text().trim(),
[752] Fix | Delete
textToAnnounce = $( this ).attr( 'data-added' ),
[753] Fix | Delete
newSelectionStart;
[754] Fix | Delete
[755] Fix | Delete
// Remove structure tag if already part of the structure.
[756] Fix | Delete
if ( -1 !== permalinkStructureValue.indexOf( textToAppend ) ) {
[757] Fix | Delete
permalinkStructureValue = permalinkStructureValue.replace( textToAppend + '/', '' );
[758] Fix | Delete
[759] Fix | Delete
$permalinkStructure.val( '/' === permalinkStructureValue ? '' : permalinkStructureValue );
[760] Fix | Delete
[761] Fix | Delete
// Announce change to screen readers.
[762] Fix | Delete
$( '#custom_selection_updated' ).text( textToAnnounce );
[763] Fix | Delete
[764] Fix | Delete
// Disable button.
[765] Fix | Delete
changeStructureTagButtonState( $( this ) );
[766] Fix | Delete
[767] Fix | Delete
return;
[768] Fix | Delete
}
[769] Fix | Delete
[770] Fix | Delete
// Input field never had focus, move selection to end of input.
[771] Fix | Delete
if ( ! permalinkStructureFocused && 0 === selectionStart && 0 === selectionEnd ) {
[772] Fix | Delete
selectionStart = selectionEnd = permalinkStructureValue.length;
[773] Fix | Delete
}
[774] Fix | Delete
[775] Fix | Delete
$permalinkCustomSelection.prop( 'checked', true );
[776] Fix | Delete
[777] Fix | Delete
// Prepend and append slashes if necessary.
[778] Fix | Delete
if ( '/' !== permalinkStructureValue.substr( 0, selectionStart ).substr( -1 ) ) {
[779] Fix | Delete
textToAppend = '/' + textToAppend;
[780] Fix | Delete
}
[781] Fix | Delete
[782] Fix | Delete
if ( '/' !== permalinkStructureValue.substr( selectionEnd, 1 ) ) {
[783] Fix | Delete
textToAppend = textToAppend + '/';
[784] Fix | Delete
}
[785] Fix | Delete
[786] Fix | Delete
// Insert structure tag at the specified position.
[787] Fix | Delete
$permalinkStructure.val( permalinkStructureValue.substr( 0, selectionStart ) + textToAppend + permalinkStructureValue.substr( selectionEnd ) );
[788] Fix | Delete
[789] Fix | Delete
// Announce change to screen readers.
[790] Fix | Delete
$( '#custom_selection_updated' ).text( textToAnnounce );
[791] Fix | Delete
[792] Fix | Delete
// Disable button.
[793] Fix | Delete
changeStructureTagButtonState( $( this ) );
[794] Fix | Delete
[795] Fix | Delete
// If input had focus give it back with cursor right after appended text.
[796] Fix | Delete
if ( permalinkStructureFocused && $permalinkStructure[0].setSelectionRange ) {
[797] Fix | Delete
newSelectionStart = ( permalinkStructureValue.substr( 0, selectionStart ) + textToAppend ).length;
[798] Fix | Delete
$permalinkStructure[0].setSelectionRange( newSelectionStart, newSelectionStart );
[799] Fix | Delete
$permalinkStructure.trigger( 'focus' );
[800] Fix | Delete
}
[801] Fix | Delete
} );
[802] Fix | Delete
[803] Fix | Delete
$document.ready( function() {
[804] Fix | Delete
var checks, first, last, checked, sliced, mobileEvent, transitionTimeout, focusedRowActions,
[805] Fix | Delete
lastClicked = false,
[806] Fix | Delete
pageInput = $('input.current-page'),
[807] Fix | Delete
currentPage = pageInput.val(),
[808] Fix | Delete
isIOS = /iPhone|iPad|iPod/.test( navigator.userAgent ),
[809] Fix | Delete
isAndroid = navigator.userAgent.indexOf( 'Android' ) !== -1,
[810] Fix | Delete
$adminMenuWrap = $( '#adminmenuwrap' ),
[811] Fix | Delete
$wpwrap = $( '#wpwrap' ),
[812] Fix | Delete
$adminmenu = $( '#adminmenu' ),
[813] Fix | Delete
$overlay = $( '#wp-responsive-overlay' ),
[814] Fix | Delete
$toolbar = $( '#wp-toolbar' ),
[815] Fix | Delete
$toolbarPopups = $toolbar.find( 'a[aria-haspopup="true"]' ),
[816] Fix | Delete
$sortables = $('.meta-box-sortables'),
[817] Fix | Delete
wpResponsiveActive = false,
[818] Fix | Delete
$adminbar = $( '#wpadminbar' ),
[819] Fix | Delete
lastScrollPosition = 0,
[820] Fix | Delete
pinnedMenuTop = false,
[821] Fix | Delete
pinnedMenuBottom = false,
[822] Fix | Delete
menuTop = 0,
[823] Fix | Delete
menuState,
[824] Fix | Delete
menuIsPinned = false,
[825] Fix | Delete
height = {
[826] Fix | Delete
window: $window.height(),
[827] Fix | Delete
wpwrap: $wpwrap.height(),
[828] Fix | Delete
adminbar: $adminbar.height(),
[829] Fix | Delete
menu: $adminMenuWrap.height()
[830] Fix | Delete
},
[831] Fix | Delete
$headerEnd = $( '.wp-header-end' );
[832] Fix | Delete
[833] Fix | Delete
/**
[834] Fix | Delete
* Makes the fly-out submenu header clickable, when the menu is folded.
[835] Fix | Delete
*
[836] Fix | Delete
* @param {Event} e The event object.
[837] Fix | Delete
*
[838] Fix | Delete
* @return {void}
[839] Fix | Delete
*/
[840] Fix | Delete
$adminmenu.on('click.wp-submenu-head', '.wp-submenu-head', function(e){
[841] Fix | Delete
$(e.target).parent().siblings('a').get(0).click();
[842] Fix | Delete
});
[843] Fix | Delete
[844] Fix | Delete
/**
[845] Fix | Delete
* Collapses the admin menu.
[846] Fix | Delete
*
[847] Fix | Delete
* @return {void}
[848] Fix | Delete
*/
[849] Fix | Delete
$( '#collapse-button' ).on( 'click.collapse-menu', function() {
[850] Fix | Delete
var viewportWidth = getViewportWidth() || 961;
[851] Fix | Delete
[852] Fix | Delete
// Reset any compensation for submenus near the bottom of the screen.
[853] Fix | Delete
$('#adminmenu div.wp-submenu').css('margin-top', '');
[854] Fix | Delete
[855] Fix | Delete
if ( viewportWidth < 960 ) {
[856] Fix | Delete
if ( $body.hasClass('auto-fold') ) {
[857] Fix | Delete
$body.removeClass('auto-fold').removeClass('folded');
[858] Fix | Delete
setUserSetting('unfold', 1);
[859] Fix | Delete
setUserSetting('mfold', 'o');
[860] Fix | Delete
menuState = 'open';
[861] Fix | Delete
} else {
[862] Fix | Delete
$body.addClass('auto-fold');
[863] Fix | Delete
setUserSetting('unfold', 0);
[864] Fix | Delete
menuState = 'folded';
[865] Fix | Delete
}
[866] Fix | Delete
} else {
[867] Fix | Delete
if ( $body.hasClass('folded') ) {
[868] Fix | Delete
$body.removeClass('folded');
[869] Fix | Delete
setUserSetting('mfold', 'o');
[870] Fix | Delete
menuState = 'open';
[871] Fix | Delete
} else {
[872] Fix | Delete
$body.addClass('folded');
[873] Fix | Delete
setUserSetting('mfold', 'f');
[874] Fix | Delete
menuState = 'folded';
[875] Fix | Delete
}
[876] Fix | Delete
}
[877] Fix | Delete
[878] Fix | Delete
$document.trigger( 'wp-collapse-menu', { state: menuState } );
[879] Fix | Delete
});
[880] Fix | Delete
[881] Fix | Delete
/**
[882] Fix | Delete
* Handles the `aria-haspopup` attribute on the current menu item when it has a submenu.
[883] Fix | Delete
*
[884] Fix | Delete
* @since 4.4.0
[885] Fix | Delete
*
[886] Fix | Delete
* @return {void}
[887] Fix | Delete
*/
[888] Fix | Delete
function currentMenuItemHasPopup() {
[889] Fix | Delete
var $current = $( 'a.wp-has-current-submenu' );
[890] Fix | Delete
[891] Fix | Delete
if ( 'folded' === menuState ) {
[892] Fix | Delete
// When folded or auto-folded and not responsive view, the current menu item does have a fly-out sub-menu.
[893] Fix | Delete
$current.attr( 'aria-haspopup', 'true' );
[894] Fix | Delete
} else {
[895] Fix | Delete
// When expanded or in responsive view, reset aria-haspopup.
[896] Fix | Delete
$current.attr( 'aria-haspopup', 'false' );
[897] Fix | Delete
}
[898] Fix | Delete
}
[899] Fix | Delete
[900] Fix | Delete
$document.on( 'wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate', currentMenuItemHasPopup );
[901] Fix | Delete
[902] Fix | Delete
/**
[903] Fix | Delete
* Ensures an admin submenu is within the visual viewport.
[904] Fix | Delete
*
[905] Fix | Delete
* @since 4.1.0
[906] Fix | Delete
*
[907] Fix | Delete
* @param {jQuery} $menuItem The parent menu item containing the submenu.
[908] Fix | Delete
*
[909] Fix | Delete
* @return {void}
[910] Fix | Delete
*/
[911] Fix | Delete
function adjustSubmenu( $menuItem ) {
[912] Fix | Delete
var bottomOffset, pageHeight, adjustment, theFold, menutop, wintop, maxtop,
[913] Fix | Delete
$submenu = $menuItem.find( '.wp-submenu' );
[914] Fix | Delete
[915] Fix | Delete
menutop = $menuItem.offset().top;
[916] Fix | Delete
wintop = $window.scrollTop();
[917] Fix | Delete
maxtop = menutop - wintop - 30; // max = make the top of the sub almost touch admin bar.
[918] Fix | Delete
[919] Fix | Delete
bottomOffset = menutop + $submenu.height() + 1; // Bottom offset of the menu.
[920] Fix | Delete
pageHeight = $wpwrap.height(); // Height of the entire page.
[921] Fix | Delete
adjustment = 60 + bottomOffset - pageHeight;
[922] Fix | Delete
theFold = $window.height() + wintop - 50; // The fold.
[923] Fix | Delete
[924] Fix | Delete
if ( theFold < ( bottomOffset - adjustment ) ) {
[925] Fix | Delete
adjustment = bottomOffset - theFold;
[926] Fix | Delete
}
[927] Fix | Delete
[928] Fix | Delete
if ( adjustment > maxtop ) {
[929] Fix | Delete
adjustment = maxtop;
[930] Fix | Delete
}
[931] Fix | Delete
[932] Fix | Delete
if ( adjustment > 1 ) {
[933] Fix | Delete
$submenu.css( 'margin-top', '-' + adjustment + 'px' );
[934] Fix | Delete
} else {
[935] Fix | Delete
$submenu.css( 'margin-top', '' );
[936] Fix | Delete
}
[937] Fix | Delete
}
[938] Fix | Delete
[939] Fix | Delete
if ( 'ontouchstart' in window || /IEMobile\/[1-9]/.test(navigator.userAgent) ) { // Touch screen device.
[940] Fix | Delete
// iOS Safari works with touchstart, the rest work with click.
[941] Fix | Delete
mobileEvent = isIOS ? 'touchstart' : 'click';
[942] Fix | Delete
[943] Fix | Delete
/**
[944] Fix | Delete
* Closes any open submenus when touch/click is not on the menu.
[945] Fix | Delete
*
[946] Fix | Delete
* @param {Event} e The event object.
[947] Fix | Delete
*
[948] Fix | Delete
* @return {void}
[949] Fix | Delete
*/
[950] Fix | Delete
$body.on( mobileEvent+'.wp-mobile-hover', function(e) {
[951] Fix | Delete
if ( $adminmenu.data('wp-responsive') ) {
[952] Fix | Delete
return;
[953] Fix | Delete
}
[954] Fix | Delete
[955] Fix | Delete
if ( ! $( e.target ).closest( '#adminmenu' ).length ) {
[956] Fix | Delete
$adminmenu.find( 'li.opensub' ).removeClass( 'opensub' );
[957] Fix | Delete
}
[958] Fix | Delete
});
[959] Fix | Delete
[960] Fix | Delete
/**
[961] Fix | Delete
* Handles the opening or closing the submenu based on the mobile click|touch event.
[962] Fix | Delete
*
[963] Fix | Delete
* @param {Event} event The event object.
[964] Fix | Delete
*
[965] Fix | Delete
* @return {void}
[966] Fix | Delete
*/
[967] Fix | Delete
$adminmenu.find( 'a.wp-has-submenu' ).on( mobileEvent + '.wp-mobile-hover', function( event ) {
[968] Fix | Delete
var $menuItem = $(this).parent();
[969] Fix | Delete
[970] Fix | Delete
if ( $adminmenu.data( 'wp-responsive' ) ) {
[971] Fix | Delete
return;
[972] Fix | Delete
}
[973] Fix | Delete
[974] Fix | Delete
/*
[975] Fix | Delete
* Show the sub instead of following the link if:
[976] Fix | Delete
* - the submenu is not open.
[977] Fix | Delete
* - the submenu is not shown inline or the menu is not folded.
[978] Fix | Delete
*/
[979] Fix | Delete
if ( ! $menuItem.hasClass( 'opensub' ) && ( ! $menuItem.hasClass( 'wp-menu-open' ) || $menuItem.width() < 40 ) ) {
[980] Fix | Delete
event.preventDefault();
[981] Fix | Delete
adjustSubmenu( $menuItem );
[982] Fix | Delete
$adminmenu.find( 'li.opensub' ).removeClass( 'opensub' );
[983] Fix | Delete
$menuItem.addClass('opensub');
[984] Fix | Delete
}
[985] Fix | Delete
});
[986] Fix | Delete
}
[987] Fix | Delete
[988] Fix | Delete
if ( ! isIOS && ! isAndroid ) {
[989] Fix | Delete
$adminmenu.find( 'li.wp-has-submenu' ).hoverIntent({
[990] Fix | Delete
[991] Fix | Delete
/**
[992] Fix | Delete
* Opens the submenu when hovered over the menu item for desktops.
[993] Fix | Delete
*
[994] Fix | Delete
* @return {void}
[995] Fix | Delete
*/
[996] Fix | Delete
over: function() {
[997] Fix | Delete
var $menuItem = $( this ),
[998] Fix | Delete
$submenu = $menuItem.find( '.wp-submenu' ),
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function