PageSourceSearch

https://waterfordcumc.org/wp-content/themes/jubilee/js/lib/jquery.meanmenu.modified.js?ver=1.8

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