PageSourceSearch

https://spshol.cz/plugins/system/jsntplframework/assets/joomlashine/js/megamenu/megamenu-frontend.js

js spshol.cz collected 2026-10-06 18:24:45 UTC 2,921 bytes, 112 lines download raw bytes

1/**
2 * @version     $Id$
3 * @package     JSNExtension
4 * @subpackage  JSNTPLFramework
5 * @author      JoomlaShine Team <[email protected]>
6 * @copyright   Copyright (C) 2012 JoomlaShine.com. All Rights Reserved.
7 * @license     GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
8 *
9 * Websites: http://www.joomlashine.com
10 * Technical Support:  Feedback - http://www.joomlashine.com/contact-us/get-support.html
11 */
12
13var JSNMegamenu = {
14		init: function()
15		{		
16			
17		},
18		
19		setMegamenuSubmenuPosition: function(enableRTL)
20		{
21
22			if (document.getElementById('jsn-tpl-megamenu') == null) return false;
23			
24			// Get all parents
25			parents = document.getElements('ul.jsn-tpl-megamenu > li.megamenu-fixed-width');
26			
27			if (!parents.length) return;
28						
29			var placeMegamenuSubmenu = function(parent) {
30				var maxSize = window.getSize();
31				var submenu = parent.getChildren('ul');
32				var farLeft = parent.getPosition().x;
33				if (submenu.length)
34				{	
35					submenu.each(function(ul) {
36						var width = ul.getStyle('width').toInt();
37						if (farLeft + width > maxSize.x)
38						{						
39							if (width < farLeft)
40							{
41								parent.addClass('jsn-submenu-flipback');
42							}
43						}
44					});
45				}
46				
47			};
48						
49			resizeMegamenuSubmenuHandler = function() {
50				parents.each(function(parent) {
51					
52					parent.removeClass('jsn-submenu-flipback');
53					placeMegamenuSubmenu(parent);
54				});
55			};
56			
57			// Handle window resize event
58			window.addEvent('resize', function() {
59				
60				placeMegamenuSubmenu.timer && clearTimeout(placeMegamenuSubmenu.timer);
61				placeMegamenuSubmenu.timer = setTimeout(resizeMegamenuSubmenuHandler, 500);
62			});
63
64			// Place all submenus
65			resizeMegamenuSubmenuHandler();
66		},
67		
68		setMegamenuSubmenuStyle: function()
69		{
70			if (document.getElementById('jsn-tpl-megamenu') == null) return false;
71			
72			var modMenuElements = document.getElementsByClassName('jsn_tpl_mm_menu_element');
73			var modMenuElementLength = modMenuElements.length;
74			
75			if (!modMenuElementLength) return false;
76			
77			var directionRTL = document.body.hasClass('jsn-direction-rtl');
78			for (var i = 0; i < modMenuElementLength; i++) 
79			{
80				
81			    var element = modMenuElements[i];
82			    var ulChilden = element.getChildren('ul');
83			   
84			    var size = element.measure(function(){    	
85			        return this.getSize();
86			    });
87			    
88			    var width = size.x;
89			   
90			    if (ulChilden.length)
91			    {
92			    	ulChilden.each(function(ul) {
93			    		var liChilden = ul.getChildren('li.parent');
94			    		if(liChilden.length)
95			    		{
96			    			liChilden.each(function(li) {
97			    				//if (directionRTL)
98			    				//{
99			    					li.getChildren('ul').setStyle('right', width);
100			    				//}
101			    				//else
102			    				//{	
103			    					li.getChildren('ul').setStyle('left', width);
104			    				//}
105			    			});
106			    		}
107					});
108			    }
109			   
110			}
111		}
112};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.