1(function($, window, document) { 2 "use strict"; 3 4 function morphDropdown(element) { 5 this.element = element; 6 this.mainNavigation = this.element.find(".main-nav"); 7 this.mainNavigationItems = this.mainNavigation.find(".has-dropdown"); 8 this.dropdownList = this.element.find(".dropdown-list"); 9 this.dropdownWrappers = this.dropdownList.find(".dropdown"); 10 this.dropdownItems = this.dropdownList.find(".content"); 11 this.dropdownBg = this.dropdownList.find(".bg-layer"); 12 this.mediaQuery = this.checkMediaQuery(); 13 this.triangle = $("<i class='dropdown-triangle'></i>"); 14 this.dropdownList.append(this.triangle); 15 this.bindEvents(); 16 } 17 18 morphDropdown.prototype = { 19 checkMediaQuery: function() { 20 var self = this; 21 return window 22 .getComputedStyle(self.element.get(0), "::before") 23 .getPropertyValue("content") 24 .replace(/'/g, "") 25 .replace(/"/g, "") 26 .split(", "); 27 }, 28 29 bindEvents: function() { 30 var self = this; 31 this.mainNavigationItems 32 .mouseenter(function(event) { 33 self.showDropdown($(this)); 34 }) 35 .mouseleave(function() { 36 setTimeout(function() { 37 if ( 38 self.mainNavigation.find(".has-dropdown:hover").length == 0 && 39 self.element.find(".dropdown-list:hover").length == 0 40 ) 41 self.hideDropdown(); 42 }, 50); 43 }); 44 45 this.dropdownList.mouseleave(function() { 46 setTimeout(function() { 47 self.mainNavigation.find(".has-dropdown:hover").length == 0 && 48 self.element.find(".dropdown-list:hover").length == 0 && 49 self.hideDropdown(); 50 }, 50); 51 }); 52 53 this.mainNavigationItems.on("touchstart", function(event) { 54 var selectedDropdown = self.dropdownList.find( 55 "#" + $(this).data("content") 56 ); 57 if ( 58 !self.element.hasClass("is-dropdown-visible") || 59 !selectedDropdown.hasClass("active") 60 ) { 61 event.preventDefault(); 62 self.showDropdown($(this)); 63 } 64 }); 65 66 $(".nav-trigger").on("click", function(event) { 67 event.preventDefault(); 68 self.element.toggleClass("nav-open"); 69 }); 70 71 if (this.mediaQuery != "mobile") { 72 return; 73 } 74 75 this.dropdownList.on("click", ">ul>li>a.label", function() { 76 $(this) 77 .parent(".dropdown") 78 .has(".content") 79 .toggleClass("is-active"); 80 }); 81 82 this.dropdownList.on("click", ">ul>li>.content .menu-title-block", function() { 83 $(this) 84 .parent(".menu-wrap") 85 .has(".menu") 86 .toggleClass("is-active"); 87 }); 88 89 this.dropdownList.on("click", ">ul>li>.content .menu-logo", function() { 90 $(this) 91 .parent(".menu") 92 .has(".menu-list") 93 .toggleClass("is-active"); 94 }); 95 96 this.dropdownList.on("click", ">ul>li>.content .menu-label", function() { 97 $(this) 98 .parent(".menu") 99 .has(".menu-list") 100 .toggleClass("is-active"); 101 }); 102 this.dropdownList 103 .find(".dropdown") 104 .has(".content") 105 .addClass("has-submenu"); 106 this.dropdownList 107 .find(".dropdown .content .menu") 108 .has(".menu-list") 109 .addClass("has-submenu"); 110 }, 111 112 showDropdown: function(item) { 113 if (this.mediaQuery == "desktop") { 114 var self = this; 115 var selectedDropdown = this.dropdownList.find( 116 "#" + item.data("content") 117 ); 118 var selectedDropdownHeight = selectedDropdown.innerHeight(); 119 var isFullWidth = selectedDropdown.hasClass("dropdown-fullwidth"); 120 121 var selectedDropdownWidth = $(window).width(); 122 var selectedDropdownLeft = 0; 123 if (isFullWidth) { 124 this.triangle.css( 125 "left", 126 parseInt(item.offset().left + item.innerWidth() / 2) 127 ); 128 } else { 129 this.triangle.css("left", "50%"); 130 selectedDropdownWidth = selectedDropdown 131 .children(".content") 132 .innerWidth(); 133 selectedDropdownLeft = 134 item.offset().left + 135 item.innerWidth() / 2 - 136 selectedDropdownWidth / 2; 137 } 138 139 self.updateDropdown( 140 selectedDropdown, 141 parseInt(selectedDropdownHeight),
142 selectedDropdownWidth, 143 parseInt(selectedDropdownLeft) 144 ); 145 146 this.element.find(".active").removeClass("active"); 147 148 selectedDropdown 149 .addClass("active") 150 .removeClass("move-left move-right") 151 .prevAll() 152 .addClass("move-left") 153 .end() 154 .nextAll() 155 .addClass("move-right"); 156 157 item.addClass("active"); 158 if (!this.element.hasClass("is-dropdown-visible")) { 159 setTimeout(function() { 160 self.element.addClass("is-dropdown-visible"); 161 }, 10); 162 } 163 } 164 }, 165 166 detectZoom: function() { 167 var ratio = 0, 168 screen = window.screen, 169 ua = navigator.userAgent.toLowerCase(); 170 if (window.devicePixelRatio !== undefined) { 171 ratio = window.devicePixelRatio; 172 } else if (~ua.indexOf('msie')) { 173 if (screen.deviceXDPI && screen.logicalXDPI) { 174 ratio = screen.deviceXDPI / screen.logicalXDPI; 175 } 176 } else if (window.outerWidth !== undefined && window.innerWidth !== undefined) { 177 ratio = window.outerWidth / window.innerWidth; 178 } 179 if (ratio) { 180 ratio = Math.round(ratio * 100); 181 } 182 return ratio; 183 }, 184 185 updateDropdown: function(dropdownItem, height, width, left) { 186 this.dropdownList.css({ 187 "-moz-transform": "translateX(" + left + "px)", 188 "-webkit-transform": "translateX(" + left + "px)", 189 "-ms-transform": "translateX(" + left + "px)", 190 "-o-transform": "translateX(" + left + "px)", 191 transform: "translateX(" + left + "px)", 192 width: width + "px", 193 height: height + "px" 194 }); 195 196 if (this.detectZoom() === 100) { 197 this.dropdownBg.css({ 198 "height": "1px", 199 "width": "1px", 200 "-moz-transform": "scaleX(" + width + ") scaleY(" + height + ")", 201 "-webkit-transform": "scaleX(" + width + ") scaleY(" + height + ")", 202 "-ms-transform": "scaleX(" + width + ") scaleY(" + height + ")", 203 "-o-transform": "scaleX(" + width + ") scaleY(" + height + ")", 204 transform: "scaleX(" + width + ") scaleY(" + height + ")" 205 }); 206 } else { 207 this.dropdownBg.css({ 208 "height": height, 209 "width": width, 210 "-moz-transform": "none", 211 "-webkit-transform": "none", 212 "-ms-transform": "none", 213 "-o-transform": "none", 214 transform: "none" 215 }); 216 } 217 }, 218 219 hideDropdown: function() { 220 if (this.mediaQuery == "desktop") { 221 this.element 222 .removeClass("is-dropdown-visible") 223 .find(".active") 224 .removeClass("active") 225 .end() 226 .find(".move-left") 227 .removeClass("move-left") 228 .end() 229 .find(".move-right") 230 .removeClass("move-right"); 231 } 232 }, 233 234 resetDropdown: function(update) { 235 if (update) { 236 this.mediaQuery = this.checkMediaQuery(); 237 } 238 if (this.mediaQuery == "mobile") { 239 this.dropdownList.removeAttr("style"); 240 } 241 } 242 }; 243 244 $(function() { 245 var morphDropdowns = []; 246 $.fn.navMenu = function(options) { 247 this.each(function() { 248 morphDropdowns.push(new morphDropdown($(this))); 249 }); 250 var resizing = false; 251 updateDropdownPosition(); 252 $(window).on("resize", function() { 253 if (!resizing) { 254 resizing = true; 255 !window.requestAnimationFrame ? 256 setTimeout(updateDropdownPosition, 300) : 257 window.requestAnimationFrame(updateDropdownPosition); 258 } 259 }); 260 261 function updateDropdownPosition() { 262 morphDropdowns.forEach(function(element) { 263 element.resetDropdown(true); 264 }); 265 resizing = false;
266 } 267 } 268 }); 269})(jQuery, window, document); 270 271(function(window, undefined) { 272 "$:nomunge"; 273 var $ = window.jQuery || window.Cowboy || (window.Cowboy = {}), 274 jq_throttle; 275 $.throttle = jq_throttle = function( 276 delay, 277 no_trailing, 278 callback, 279 debounce_mode 280 ) { 281 var timeout_id, 282 last_exec = 0; 283 if (typeof no_trailing !== "boolean") { 284 debounce_mode = callback; 285 callback = no_trailing; 286 no_trailing = undefined; 287 } 288 289 function wrapper() { 290 var that = this, 291 elapsed = +new Date() - last_exec, 292 args = arguments; 293 294 function exec() { 295 last_exec = +new Date(); 296 callback.apply(that, args); 297 } 298 299 function clear() { 300 timeout_id = undefined; 301 } 302 if (debounce_mode && !timeout_id) { 303 exec(); 304 } 305 timeout_id && clearTimeout(timeout_id); 306 if (debounce_mode === undefined && elapsed > delay) { 307 exec(); 308 } else if (no_trailing !== true) { 309 timeout_id = setTimeout( 310 debounce_mode ? clear : exec, 311 debounce_mode === undefined ? delay - elapsed : delay 312 ); 313 } 314 } 315 if ($.guid) { 316 wrapper.guid = callback.guid = callback.guid || $.guid++; 317 } 318 return wrapper; 319 }; 320 $.debounce = function(delay, at_begin, callback) { 321 return callback === undefined ? 322 jq_throttle(delay, at_begin, false) : 323 jq_throttle(delay, callback, at_begin !== false); 324 }; 325})(this);
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.