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