HEX
Server: nginx/1.18.0
System: Linux iZuf6ar3jbed2aosvzu1ofZ 4.18.0-240.22.1.el8_3.x86_64 #1 SMP Thu Apr 8 19:01:30 UTC 2021 x86_64
User: root (0)
PHP: 7.3.28
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/wood-lk.cn/wp-content/plugins/admin-menu-editor/js/admin-helpers.js
/*global wsAmeCurrentMenuItem*/

(function($) {
	var currentItem = (typeof wsAmeCurrentMenuItem !== 'undefined') ? wsAmeCurrentMenuItem : {};

	//The page heading is typically hardcoded and/or not configurable, so we need to use JS to change it.
	var customPageHeading = currentItem.hasOwnProperty('customPageHeading') ? currentItem['customPageHeading'] : null;
	var pageHeadingSelector = currentItem.hasOwnProperty('pageHeadingSelector') ? currentItem['pageHeadingSelector'] : '.wrap > h2:first';
	var ameHideHeading = null;
	if ( customPageHeading ) {
		//Temporarily hide the heading to prevent the original text from showing up briefly
		//before being replaced when the DOM is ready (see below).
		ameHideHeading = $('<style type="text/css">.wrap > h2:first-child,.wrap > h1:first-child { visibility: hidden; }</style>')
			.appendTo('head');
	}

	jQuery(function($) {
		var adminMenu = $('#adminmenu');

		//Menu separators shouldn't be clickable and should have a custom class.
		adminMenu
				.find('.ws-submenu-separator')
				.closest('a').on('click', function() {
					return false;
				})
				.closest('li').addClass('ws-submenu-separator-wrap');

		//Menus with the target "< None >" also shouldn't be clickable.
		adminMenu
			.find(
				'a.menu-top.ame-unclickable-menu-item, ul.wp-submenu > li > a[href^="#ame-unclickable-menu-item"]'
			)
			.on('click', function() {
				//Exception: At small viewport sizes, WordPress changes how top level menus work: clicking a menu
				//now expands its submenu. We must not ignore that click or it will be impossible to expand the menu.
				var viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
				if ((viewportWidth <= 782) && $(this).closest('li').hasClass('wp-has-submenu')) {
					return;
				}

				//Ignore the click.
				return false;
			});

		//Open submenus that have the "always open" flag.
		adminMenu
			.find('li.ws-ame-has-always-open-submenu.wp-has-submenu')
			.addClass('wp-has-current-submenu')
			.removeClass('wp-not-current-submenu');

		//Replace the original page heading with the custom heading.
		if ( customPageHeading ) {
			function replaceAdminPageHeading(newText) {
				var headingText = $(pageHeadingSelector)
					.contents()
					.filter(function() {
						//Find text nodes.
						if ((this.nodeType != 3) || (!this.nodeValue)) {
							return false;
						}
						//Skip whitespace.
						return /\S/.test(this.nodeValue);
					}).get(0);

				if (headingText && headingText.nodeValue) {
					headingText.nodeValue = newText;
				}
			}

			//Normal headings have at least one tab's worth of trailing whitespace. We need to replicate that
			//to keep the page layout roughly the same.
			replaceAdminPageHeading(customPageHeading + '\t');
			ameHideHeading.remove(); //Make the heading visible.
		}
	});

})(jQuery);