PageSourceSearch

https://www.iskconbangalore.org/wp-content/themes/benevolence-wpl/js/jquery.meanmenu.js?ver=7.1.2

js iskconbangalore.org collected 2026-09-24 09:53:27 UTC 13,296 bytes, 275 lines download raw bytes

1/*!
2 * jQuery meanMenu v2.0.6
3 * @Copyright (C) 2012-2013 Chris Wharton (https://github.com/weare2ndfloor/meanMenu)
4 *
5 */
6/*
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 * 
12 * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
13 * HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
14 * INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR
15 * FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE
16 * OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,
17 * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.COPYRIGHT HOLDERS WILL NOT
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL
19 * DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
20 * 
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://gnu.org/licenses/>.
23 *
24 * Find more information at http://www.meanthemes.com/plugins/meanmenu/
25 *
26 */
27(function ($) {
28	"use strict";
29    $.fn.meanmenu = function (options) {
30        var defaults = {
31            meanMenuTarget: jQuery(this), // Target the current HTML markup you wish to replace
32            meanMenuContainer: '.menu .responsive', // Choose where meanmenu will be placed within the HTML
33            meanMenuClose: "X", // single character you want to represent the close menu button
34            meanMenuCloseSize: "18px", // set font size of close button
35            meanMenuOpen: "<span /><span /><span />", // text/markup you want when menu is closed
36            meanRevealPosition: "left", // left right or center positions
37            meanRevealPositionDistance: "0", // Tweak the position of the menu
38            meanRevealColour: "", // override CSS colours for the reveal background
39            meanRevealHoverColour: "", // override CSS colours for the reveal hover
40            meanScreenWidth: "960", // set the screen width you want meanmenu to kick in at
41            meanNavPush: "", // set a height here in px, em or % if you want to budge your layout now the navigation is missing.
42            meanShowChildren: true, // true to show children in the menu, false to hide them
43            meanExpandableChildren: true, // true to allow expand/collapse children
44            meanExpand: "+", // single character you want to represent the expand for ULs
45            meanContract: "-", // single character you want to represent the contract for ULs
46            meanRemoveAttrs: true, // true to remove classes and IDs, false to keep them
47            onePage: false, // set to true for one page sites
48            removeElements: "" // set to hide page elements
49        };
50        var options = $.extend(defaults, options);
51        
52        // get browser width
53        var currentWidth = window.innerWidth || document.documentElement.clientWidth;
54
55        return this.each(function () {
56            var meanMenu = options.meanMenuTarget;
57            var meanContainer = options.meanMenuContainer;
58            var meanReveal = options.meanReveal;
59            var meanMenuClose = options.meanMenuClose;
60            var meanMenuCloseSize = options.meanMenuCloseSize;
61            var meanMenuOpen = options.meanMenuOpen;
62            var meanRevealPosition = options.meanRevealPosition;
63            var meanRevealPositionDistance = options.meanRevealPositionDistance;
64            var meanRevealColour = options.meanRevealColour;
65            var meanRevealHoverColour = options.meanRevealHoverColour;
66            var meanScreenWidth = options.meanScreenWidth;
67            var meanNavPush = options.meanNavPush;
68            var meanRevealClass = ".meanmenu-reveal";
69            var meanShowChildren = options.meanShowChildren;
70            var meanExpandableChildren = options.meanExpandableChildren;
71            var meanExpand = options.meanExpand;
72            var meanContract = options.meanContract;
73            var meanRemoveAttrs = options.meanRemoveAttrs;
74            var onePage = options.onePage;
75            var removeElements = options.removeElements;
76                        
77            //detect known mobile/tablet usage
78            if ( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/Android/i)) || (navigator.userAgent.match(/Blackberry/i)) || (navigator.userAgent.match(/Windows Phone/i)) ) {
79                var isMobile = true;
80            }
81            
82            if ( (navigator.userAgent.match(/MSIE 8/i)) || (navigator.userAgent.match(/MSIE 7/i)) ) {
83            	// add scrollbar for IE7 & 8 to stop breaking resize function on small content sites
84                jQuery('html').css("overflow-y" , "scroll");
85            }
86                        
87            function meanCentered() {
88            	if (meanRevealPosition == "center") {
89	            	var newWidth = window.innerWidth || document.documentElement.clientWidth;
90	            	var meanCenter = ( (newWidth/2)-22 )+"px";
91	            	meanRevealPos = "left:" + meanCenter + ";right:auto;";
92	            	
93	            	if (!isMobile) {	            	
94	            		jQuery('.meanmenu-reveal').css("left",meanCenter); 
95	            	} else {
96		            	jQuery('.meanmenu-reveal').animate({
97		            	    left: meanCenter
98		            	});
99	            	}
100            	}
101            }
102            
103            var menuOn = false;
104            var meanMenuExist = false;
105            
106            if (meanRevealPosition == "right") {
107                meanRevealPos = "right:" + meanRevealPositionDistance + ";left:auto;";
108            }
109            if (meanRevealPosition == "left") {
110                var meanRevealPos = "left:" + meanRevealPositionDistance + ";right:auto;";
111            } 
112            // run center function	
113            meanCentered();
114            
115            // set all styles for mean-reveal
116            var meanStyles = "background:"+meanRevealColour+";color:"+meanRevealColour+";"+meanRevealPos;
117			var $navreveal = "";
118			
119            function meanInner() {
120                // get last class name
121                if (jQuery($navreveal).is(".meanmenu-reveal.meanclose")) {
122                    $navreveal.html(meanMenuClose);
123                } else {
124                    $navreveal.html(meanMenuOpen);
125                }
126            }
127            
128            //re-instate original nav (and call this on window.width functions)
129            function meanOriginal() {
130            	jQuery('.mean-bar,.mean-push').remove();
131            	jQuery(meanContainer).removeClass("mean-container");
132            	jQuery(meanMenu).show();
133            	menuOn = false;
134            	meanMenuExist = false;
135            	jQuery(removeElements).removeClass('mean-remove');
136            }
137            
138            //navigation reveal 
139            function showMeanMenu() {
140                if (currentWidth <= meanScreenWidth) {
141		            jQuery(removeElements).addClass('mean-remove');        
142                	meanMenuExist = true;
143                	// add class to body so we don't need to worry about media queries here, all CSS is wrapped in '.mean-container'
144                	jQuery(meanContainer).addClass("mean-container");
145                	jQuery('.mean-container').prepend('<div class="mean-bar"><a href="#nav" class="meanmenu-reveal" style="'+meanStyles+'">Show Navigation</a><nav class="mean-nav"></nav></div>');
146                    
147                    //push meanMenu navigation into .mean-nav
148                    var meanMenuContents = jQuery(meanMenu).html();
149                    jQuery('.mean-nav').html(meanMenuContents);
150            		
151            		// remove all classes from EVERYTHING inside meanmenu nav
152            		if(meanRemoveAttrs) {
153            			jQuery('nav.mean-nav ul, nav.mean-nav ul *').each(function() {
154            				jQuery(this).removeAttr("class");
155            				jQuery(this).removeAttr("id");
156            			});
157            		}
158                    
159                    // push in a holder div (this can be used if removal of nav is causing layout issues)
160                    jQuery(meanMenu).before('<div class="mean-push" />');
161                    jQuery('.mean-push').css("margin-top",meanNavPush);
162                    
163                    // hide current navigation and reveal mean nav link
164                    jQuery(meanMenu).hide();
165                    jQuery(".meanmenu-reveal").show();
166                    
167                    // turn 'X' on or off 
168                    jQuery(meanRevealClass).html(meanMenuOpen);
169                    $navreveal = jQuery(meanRevealClass);
170                    
171                    //hide mean-nav ul
172                    jQuery('.mean-nav ul').hide();
173                    
174                    // hide sub nav
175	                   if(meanShowChildren) {
176	                   		// allow expandable sub nav(s)
177	                       if(meanExpandableChildren){
178		                       jQuery('.mean-nav ul ul').each(function() {
179		                           if(jQuery(this).children().length){
180		                               jQuery(this,'li:first').parent().append('<a class="mean-expand" href="#" style="font-size: '+ meanMenuCloseSize +'">'+ meanExpand +'</a>');                               
181		                           }
182		                       });
183		                       jQuery('.mean-expand').on("click",function(e){
184		                       		e.preventDefault();
185		                       	   if (jQuery(this).hasClass("mean-clicked")) {
186		                       	   		jQuery(this).text(meanExpand);
187		                               jQuery(this).prev('ul').slideUp(300, function(){});
188		                           } else {
189		                           		jQuery(this).text(meanContract);
190		                           		jQuery(this).prev('ul').slideDown(300, function(){});
191		                           }   
192		                           jQuery(this).toggleClass("mean-clicked"); 
193		                       });     
194	                       } else {
195	                           jQuery('.mean-nav ul ul').show();   
196	                       }
197	                   } else {
198	                       jQuery('.mean-nav ul ul').hide();
199	                   }
200	                   
201                    // add last class to tidy up borders
202                    jQuery('.mean-nav ul li').last().addClass('mean-last');
203                
204                    $navreveal.removeClass("meanclose");
205                    jQuery($navreveal).click(function(e){
206                    	e.preventDefault();
207	            		if( menuOn == false ) {
208	                        $navreveal.css("text-align", "center");
209	                        $navreveal.css("text-indent", "0");
210	                        $navreveal.css("font-size", meanMenuCloseSize);
211	                        jQuery('.mean-nav ul:first').slideDown(); 
212	                        menuOn = true;
213	                    } else {
214	                    	jQuery('.mean-nav ul:first').slideUp();
215	                    	menuOn = false;
216	                    }    
217                        $navreveal.toggleClass("meanclose");
218                        meanInner();
219                        jQuery(removeElements).addClass('mean-remove');
220                    });
221                    
222                    // for one page websites, reset all variables...
223                    if ( onePage ) {
224                    
225						jQuery('.mean-nav ul > li > a:first-child').on( "click" , function () {
226							jQuery('.mean-nav ul:first').slideUp();
227							menuOn = false;
228							jQuery($navreveal).toggleClass("meanclose").html(meanMenuOpen);
229						
230						});
231                    
232                    }
233                    
234                } else {
235                	meanOriginal();
236                }	
237            } 
238            
239            if (!isMobile) {
240                //reset menu on resize above meanScreenWidth
241                jQuery(window).resize(function () {
242                    currentWidth = window.innerWidth || document.documentElement.clientWidth;
243                    if (currentWidth > meanScreenWidth) {
244                        meanOriginal();
245                    } else {
246                    	meanOriginal();
247                    }	
248                    if (currentWidth <= meanScreenWidth) {
249                        showMeanMenu();
250                        meanCentered();
251                    } else {
252                    	meanOriginal();
253                    }	
254                });
255            }
256
257       		// adjust menu positioning on centered navigation     
258            window.onorientationchange = function() {
259            	meanCentered();
260            	// get browser width
261            	currentWidth = window.innerWidth || document.documentElement.clientWidth;
262            	if (currentWidth >= meanScreenWidth) {
263            		meanOriginal();
264            	}
265            	if (currentWidth <= meanScreenWidth) {
266            		if (meanMenuExist == false) {
267            			showMeanMenu();
268            		}
269            	}
270            }
271           // run main menuMenu function on load
272           showMeanMenu(); 
273        });
274    };
275})(jQuery);

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.