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