Uname: Linux premium294.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.1.32 [ PHP INFO ] PHP os: Linux
Server Ip: 104.21.32.1
Your Ip: 216.73.216.223
User: mjbynoyq (1574) | Group: mjbynoyq (1570)
Safe Mode: OFF
Disable Function:
NONE

name : avia_mega_menu.js
/**
 * This file holds the main javascript functions needed to improve the avia mega menu backend
 *
 * @author		Christian "Kriesi" Budschedl
 * @copyright	Copyright ( c ) Christian Budschedl
 * @link		http://kriesi.at
 * @link		http://aviathemes.com
 * @since		Version 1.0
 * @package 	AviaFramework
 */

(function($)
{
	var avia_mega_menu = {

		recalcTimeout: false,

		// bind the click event to all elements with the class avia_uploader
		bind_click: function()
		{
			var megmenuActivator = '.menu-item-avia-megamenu,#menu-to-edit';

				$(document).on('click', megmenuActivator, function()
				{
					var checkbox = $(this),
						container = checkbox.parents('.menu-item').eq( 0 );

					if(checkbox.is(':checked'))
					{
						container.addClass('avia_mega_active');
					}
					else
					{
						container.removeClass('avia_mega_active');
					}

					//check if anything in the dom needs to be changed to reflect the (de)activation of the mega menu
					avia_mega_menu.recalc();

				});
		},

		recalcInit: function()
		{
            $(document).on('mouseup', '.menu-item-bar', function(event, ui)
			{
				if(!$(event.target).is('a'))
				{
					clearTimeout(avia_mega_menu.recalcTimeout);
					avia_mega_menu.recalcTimeout = setTimeout(avia_mega_menu.recalc, 500);
				}
			});
		},


		recalc : function()
		{
			var menuItems = $('.menu-item','#menu-to-edit');

			menuItems.each(function(i)
			{
				var item = $(this),
					megaMenuCheckbox = $('.menu-item-avia-megamenu', this);

				if(!item.is('.menu-item-depth-0'))
				{
					var checkItem = menuItems.eq( i-1 );
					if(checkItem.is('.avia_mega_active'))
					{
						item.addClass('avia_mega_active');
						megaMenuCheckbox.attr('checked','checked');
					}
					else
					{
						item.removeClass('avia_mega_active');
						megaMenuCheckbox.attr('checked','');
					}
				}





			});

		},

		//clone of the jqery menu-item function that calls a different ajax admin action so we can insert our own walker
		addItemToMenu : function(menuItem, processMethod, callback) {
			var menu = $('#menu').val(),
				nonce = $('#menu-settings-column-nonce').val();

			processMethod = processMethod || function(){};
			callback = callback || function(){};

			params = {
				'action': 'avia_ajax_switch_menu_walker',
				'menu': menu,
				'menu-settings-column-nonce': nonce,
				'menu-item': menuItem
			};

			$.post( ajaxurl, params, function(menuMarkup) {
				var ins = $('#menu-instructions');
				processMethod(menuMarkup, params);
				if( ! ins.hasClass('menu-instructions-inactive') && ins.siblings().length )
					ins.addClass('menu-instructions-inactive');
				callback();
			});
		}

};



	$(function()
	{
		avia_mega_menu.bind_click();
		avia_mega_menu.recalcInit();
		avia_mega_menu.recalc();
		if(typeof wpNavMenu != 'undefined'){ wpNavMenu.addItemToMenu = avia_mega_menu.addItemToMenu; }
 	});


})(jQuery);
© 2025 XylotrechusZ