PageSourceSearch

https://www.enviroindia.in/blog/wp-content/themes/bloggers-lite/js/jquery.meanmenu.js?ver=5.6

js enviroindia.in collected 2026-09-24 10:59:04 UTC 14,193 bytes, 287 lines download raw bytes

1/*!
2 * jQuery meanMenu v2.0.8
3 * @Copyright (C) 2012-2014 Chris Wharton @ MeanThemes (https://github.com/meanthemes/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: 'body', // 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: "right", // left right or center positions
37            meanRevealPositionDistance: "0", // Tweak the position of the menu
38            meanRevealColour: "", // override CSS colours for the reveal background
39            meanScreenWidth: "991", // set the screen width you want meanmenu to kick in at
40            meanNavPush: "", // set a height here in px, em or % if you want to budge your layout now the navigation is missing.
41            meanShowChildren: true, // true to show children in the menu, false to hide them
42            meanExpandableChildren: true, // true to allow expand/collapse children
43            meanExpand: "+", // single character you want to represent the expand for ULs
44            meanContract: "-", // single character you want to represent the contract for ULs
45            meanRemoveAttrs: false, // true to remove classes and IDs, false to keep them
46            onePage: false, // set to true for one page sites
47            meanDisplay: "block", // override display method for table cell based layouts e.g. table-cell
48            removeElements: "" // set to hide page elements
49        };
50        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 meanMenuClose = options.meanMenuClose;
59            var meanMenuCloseSize = options.meanMenuCloseSize;
60            var meanMenuOpen = options.meanMenuOpen;
61            var meanRevealPosition = options.meanRevealPosition;
62            var meanRevealPositionDistance = options.meanRevealPositionDistance;
63            var meanRevealColour = options.meanRevealColour;
64            var meanScreenWidth = options.meanScreenWidth;
65            var meanNavPush = options.meanNavPush;
66            var meanRevealClass = ".meanmenu-reveal";
67            var meanShowChildren = options.meanShowChildren;
68            var meanExpandableChildren = options.meanExpandableChildren;
69            var meanExpand = options.meanExpand;
70            var meanContract = options.meanContract;
71            var meanRemoveAttrs = options.meanRemoveAttrs;
72            var onePage = options.onePage;
73            var meanDisplay = options.meanDisplay;
74            var removeElements = options.removeElements;
75
76            //detect known mobile/tablet usage
77            var isMobile = false;
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                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            var meanRevealPos = "";
88            var meanCentered = function () {
89                if (meanRevealPosition === "center") {
90                    var newWidth = window.innerWidth || document.documentElement.clientWidth;
91                    var meanCenter = ((newWidth / 2) - 22) + "px";
92                    meanRevealPos = "left:" + meanCenter + ";right:auto;";
93
94                    if (!isMobile) {
95                        jQuery('.meanmenu-reveal').css("left", meanCenter);
96                    } else {
97                        jQuery('.meanmenu-reveal').animate({
98                            left: meanCenter
99                        });
100                    }
101                }
102            };
103
104            var menuOn = false;
105            var meanMenuExist = false;
106
107
108            if (meanRevealPosition === "right") {
109                meanRevealPos = "right:" + meanRevealPositionDistance + ";left:auto;";
110            }
111            if (meanRevealPosition === "left") {
112                meanRevealPos = "left:" + meanRevealPositionDistance + ";right:auto;";
113            }
114            // run center function
115            meanCentered();
116
117            // set all styles for mean-reveal
118            var $navreveal = "";
119
120            var meanInner = function () {
121                // get last class name
122                if (jQuery($navreveal).is(".meanmenu-reveal.meanclose")) {
123                    $navreveal.html(meanMenuClose);
124                } else {
125                    $navreveal.html(meanMenuOpen);
126                }
127            };
128
129            // re-instate original nav (and call this on window.width functions)
130            var meanOriginal = function () {
131                jQuery('.mean-bar,.mean-push').remove();
132                jQuery(meanContainer).removeClass("mean-container");
133                jQuery(meanMenu).css('display', meanDisplay);
134                menuOn = false;
135                meanMenuExist = false;
136                jQuery(removeElements).removeClass('mean-remove');
137            };
138
139            // navigation reveal
140            var showMeanMenu = function () {
141                var meanStyles = "background:" + meanRevealColour + ";color:" + meanRevealColour + ";" + meanRevealPos;
142                if (currentWidth <= meanScreenWidth) {
143                    jQuery(removeElements).addClass('mean-remove');
144                    meanMenuExist = true;
145                    // add class to body so we don't need to worry about media queries here, all CSS is wrapped in '.mean-container'
146                    jQuery(meanContainer).addClass("mean-container");
147                    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>');
148
149                    //push meanMenu navigation into .mean-nav
150                    var meanMenuContents = jQuery(meanMenu).html();
151                    jQuery('.mean-nav').html(meanMenuContents);
152
153                    // remove all classes from EVERYTHING inside meanmenu nav
154                    if (meanRemoveAttrs) {
155                        jQuery('nav.mean-nav ul, nav.mean-nav ul *').each(function () {
156                            // First check if this has mean-remove class
157                            if (jQuery(this).is('.mean-remove')) {
158                                jQuery(this).attr('class', 'mean-remove');
159                            } else {
160                                jQuery(this).removeAttr("class");
161                            }
162                            jQuery(this).removeAttr("id");
163                        });
164                    }
165
166                    // push in a holder div (this can be used if removal of nav is causing layout issues)
167                    jQuery(meanMenu).before('<div class="mean-push" />');
168                    jQuery('.mean-push').css("margin-top", meanNavPush);
169
170                    // hide current navigation and reveal mean nav link
171                    jQuery(meanMenu).hide();
172                    jQuery(".meanmenu-reveal").show();
173
174                    // turn 'X' on or off
175                    jQuery(meanRevealClass).html(meanMenuOpen);
176                    $navreveal = jQuery(meanRevealClass);
177
178                    //hide mean-nav ul
179                    jQuery('.mean-nav ul').hide();
180
181                    // hide sub nav
182                    if (meanShowChildren) {
183                        // allow expandable sub nav(s)
184                        if (meanExpandableChildren) {
185                            jQuery('.mean-nav ul ul').each(function () {
186                                if (jQuery(this).children().length) {
187                                    jQuery(this, 'li:first').parent().append('<a class="mean-expand" href="#" style="font-size: ' + meanMenuCloseSize + '">' + meanExpand + '</a>');
188                                }
189                            });
190                            jQuery('.mean-expand').on("click", function (e) {
191                                e.preventDefault();
192                                if (jQuery(this).hasClass("mean-clicked")) {
193                                    jQuery(this).text(meanExpand);
194                                    jQuery(this).prev('ul').slideUp(300, function () {
195                                    });
196                                } else {
197                                    jQuery(this).text(meanContract);
198                                    jQuery(this).prev('ul').slideDown(300, function () {
199                                    });
200                                }
201                                jQuery(this).toggleClass("mean-clicked");
202                            });
203                        } else {
204                            jQuery('.mean-nav ul ul').show();
205                        }
206                    } else {
207                        jQuery('.mean-nav ul ul').hide();
208                    }
209
210                    // add last class to tidy up borders
211                    jQuery('.mean-nav ul li').last().addClass('mean-last');
212                    $navreveal.removeClass("meanclose");
213                    jQuery($navreveal).click(function (e) {
214                        e.preventDefault();
215                        if (menuOn === false) {
216                            $navreveal.css("text-align", "center");
217                            $navreveal.css("text-indent", "0");
218                            $navreveal.css("font-size", meanMenuCloseSize);
219                            jQuery('.mean-nav ul:first').slideDown();
220                            menuOn = true;
221                        } else {
222                            jQuery('.mean-nav ul:first').slideUp();
223                            menuOn = false;
224                        }
225                        $navreveal.toggleClass("meanclose");
226                        meanInner();
227                        jQuery(removeElements).addClass('mean-remove');
228                    });
229
230                    // for one page websites, reset all variables...
231                    if (onePage) {
232                        jQuery('.mean-nav ul > li > a:first-child').on("click", function () {
233                            jQuery('.mean-nav ul:first').slideUp();
234                            menuOn = false;
235                            jQuery($navreveal).toggleClass("meanclose").html(meanMenuOpen);
236                        });
237                    }
238                } else {
239                    meanOriginal();
240                }
241            };
242
243            if (!isMobile) {
244                // reset menu on resize above meanScreenWidth
245                jQuery(window).resize(function () {
246                    currentWidth = window.innerWidth || document.documentElement.clientWidth;
247                    if (currentWidth > meanScreenWidth) {
248                        meanOriginal();
249                    } else {
250                        meanOriginal();
251                    }
252                    if (currentWidth <= meanScreenWidth) {
253                        showMeanMenu();
254                        meanCentered();
255                    } else {
256                        meanOriginal();
257                    }
258                });
259            }
260
261            jQuery(window).resize(function () {
262                // get browser width
263                currentWidth = window.innerWidth || document.documentElement.clientWidth;
264
265                if (!isMobile) {
266                    meanOriginal();
267                    if (currentWidth <= meanScreenWidth) {
268                        showMeanMenu();
269                        meanCentered();
270                    }
271                } else {
272                    meanCentered();
273                    if (currentWidth <= meanScreenWidth) {
274                        if (meanMenuExist === false) {
275                            showMeanMenu();
276                        }
277                    } else {
278                        meanOriginal();
279                    }
280                }
281            });
282
283            // run main menuMenu function on load
284            showMeanMenu();
285        });
286    };
287})(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.