1var Layout = function () { 2 3 // IE mode 4 var isRTL = false; 5 var isIE8 = false; 6 var isIE9 = false; 7 var isIE10 = false; 8 var isIE11 = false; 9 10 var responsive = true; 11 12 var responsiveHandlers = []; 13 14 var handleInit = function() { 15 16 if ($('body').css('direction') === 'rtl') { 17 isRTL = true; 18 } 19 20 isIE8 = !! navigator.userAgent.match(/MSIE 8.0/); 21 isIE9 = !! navigator.userAgent.match(/MSIE 9.0/); 22 isIE10 = !! navigator.userAgent.match(/MSIE 10.0/); 23 isIE11 = !! navigator.userAgent.match(/MSIE 11.0/); 24 25 if (isIE10) { 26 jQuery('html').addClass('ie10'); // detect IE10 version 27 } 28 if (isIE11) { 29 jQuery('html').addClass('ie11'); // detect IE11 version 30 } 31 } 32 33 // runs callback functions set by App.addResponsiveHandler(). 34 var runResponsiveHandlers = function () { 35 // reinitialize other subscribed elements 36 for (var i in responsiveHandlers) { 37 var each = responsiveHandlers[i]; 38 each.call(); 39 } 40 } 41 42 43 // handle the layout reinitialization on window resize 44 var handleResponsiveOnResize = function () { 45 var resize; 46 if (isIE8) { 47 var currheight; 48 $(window).resize(function () { 49 if (currheight == document.documentElement.clientHeight) { 50 return; //quite event since only body resized not window. 51 } 52 if (resize) { 53 clearTimeout(resize); 54 } 55 resize = setTimeout(function () { 56 runResponsiveHandlers(); 57 }, 50); // wait 50ms until window resize finishes. 58 currheight = document.documentElement.clientHeight; // store last body client height 59 }); 60 } else { 61 $(window).resize(function () { 62 if (resize) { 63 clearTimeout(resize); 64 } 65 resize = setTimeout(function () { 66 runResponsiveHandlers(); 67 }, 50); // wait 50ms until window resize finishes. 68 }); 69 } 70 } 71 72 var handleIEFixes = function() { 73 //fix html5 placeholder attribute for ie7 & ie8 74 if (isIE8 || isIE9) { // ie8 & ie9 75 // this is html5 placeholder fix for inputs, inputs with placeholder-no-fix class will be skipped(e.g: we need this for password fields) 76 jQuery('input[placeholder]:not(.placeholder-no-fix), textarea[placeholder]:not(.placeholder-no-fix)').each(function () { 77 78 var input = jQuery(this); 79 80 if (input.val() == '' && input.attr("placeholder") != '') { 81 input.addClass("placeholder").val(input.attr('placeholder')); 82 } 83 84 input.focus(function () { 85 if (input.val() == input.attr('placeholder')) { 86 input.val(''); 87 } 88 }); 89 90 input.blur(function () { 91 if (input.val() == '' || input.val() == input.attr('placeholder')) { 92 input.val(input.attr('placeholder')); 93 } 94 }); 95 }); 96 } 97 } 98 99 // Handles scrollable contents using jQuery SlimScroll plugin. 100 var handleScrollers = function () { 101 $('.scroller').each(function () { 102 var height; 103 if ($(this).attr("data-height")) { 104 height = $(this).attr("data-height"); 105 } else { 106 height = $(this).css('height'); 107 } 108 $(this).slimScroll({ 109 allowPageScroll: true, // allow page scroll when the element scroll is ended 110 size: '7px', 111 color: ($(this).attr("data-handle-color") ? $(this).attr("data-handle-color") : '#bbb'), 112 railColor: ($(this).attr("data-rail-color") ? $(this).attr("data-rail-color") : '#eaeaea'), 113 position: isRTL ? 'left' : 'right', 114 height: height, 115 alwaysVisible: ($(this).attr("data-always-visible") == "1" ? true : false), 116 railVisible: ($(this).attr("data-rail-visible") == "1" ? true : false), 117 disableFadeOut: true 118 }); 119 }); 120 } 121 122 var handleSearch = function() { 123 $('.search-btn').click(function () { 124 if($('.search-btn').hasClass('show-search-icon')){ 125 if ($(window).width()>767) { 126 $('.search-box').fadeOut(300);
127 } else { 128 $('.search-box').fadeOut(0); 129 } 130 $('.search-btn').removeClass('show-search-icon'); 131 } else { 132 if ($(window).width()>767) { 133 $('.search-box').fadeIn(300); 134 } else { 135 $('.search-box').fadeIn(0); 136 } 137 $('.search-btn').addClass('show-search-icon'); 138 } 139 }); 140 141 // close search box on body click 142 if($('.search-btn').length != 0) { 143 $('.search-box, .search-btn').on('click', function(e){ 144 e.stopPropagation(); 145 }); 146 147 $('body').on('click', function() { 148 if ($('.search-btn').hasClass('show-search-icon')) { 149 $('.search-btn').removeClass("show-search-icon"); 150 $('.search-box').fadeOut(300); 151 } 152 }); 153 } 154 } 155 156 var handleMenu = function() { 157 $(".header .navbar-toggle").click(function () { 158 if ($(".header .navbar-collapse").hasClass("open")) { 159 $(".header .navbar-collapse").slideDown(300) 160 .removeClass("open"); 161 } else { 162 $(".header .navbar-collapse").slideDown(300) 163 .addClass("open"); 164 } 165 }); 166 } 167 var handleSubMenuExt = function() { 168 $(".header-navigation .dropdown").on("hover", function() { 169 if ($(this).children(".header-navigation-content-ext").show()) { 170 if ($(".header-navigation-content-ext").height()>=$(".header-navigation-description").height()) { 171 $(".header-navigation-description").css("height", $(".header-navigation-content-ext").height()+22); 172 } 173 } 174 }); 175 } 176 177 var handleSidebarMenu = function () { 178 $(".sidebar .dropdown a i").click(function (event) { 179 event.preventDefault(); 180 if ($(this).parent("a").hasClass("collapsed") == false) { 181 $(this).parent("a").addClass("collapsed"); 182 $(this).parent("a").siblings(".dropdown-menu").slideDown(300); 183 } else { 184 $(this).parent("a").removeClass("collapsed"); 185 $(this).parent("a").siblings(".dropdown-menu").slideUp(300); 186 } 187 }); 188 } 189 190 function handleDifInits() { 191 $(".header .navbar-toggle span:nth-child(2)").addClass("short-icon-bar"); 192 $(".header .navbar-toggle span:nth-child(4)").addClass("short-icon-bar"); 193 } 194 195 function handleUniform() { 196 if (!jQuery().uniform) { 197 return; 198 } 199 var test = $("input[type=checkbox]:not(.toggle), input[type=radio]:not(.toggle, .star)"); 200 if (test.length > 0) { 201 test.each(function () { 202 if ($(this).parents(".checker").length == 0) { 203 $(this).show(); 204 $(this).uniform(); 205 } 206 }); 207 } 208 } 209 210 var handleFancybox = function () { 211 if (!jQuery.fancybox) { 212 return; 213 } 214 215 jQuery(".fancybox-fast-view").fancybox(); 216 217 if (jQuery(".fancybox-button").length > 0) { 218 jQuery(".fancybox-button").fancybox({ 219 groupAttr: 'data-rel', 220 prevEffect: 'none', 221 nextEffect: 'none', 222 closeBtn: true, 223 helpers: { 224 title: { 225 type: 'inside' 226 } 227 } 228 }); 229 230 $('.fancybox-video').fancybox({ 231 type: 'iframe' 232 }); 233 } 234 } 235 236 // Handles Bootstrap Accordions. 237 var handleAccordions = function () { 238 239 jQuery('body').on('shown.bs.collapse', '.accordion.scrollable', function (e) { 240 Layout.scrollTo($(e.target), -100); 241 }); 242 243 } 244 245 246 247 var handleMobiToggler = function () { 248 $(".mobi-toggler").on("click", function(event) { 249 event.preventDefault();//the default action of the event will not be triggered 250 251 $(".header").toggleClass("menuOpened"); 252 $(".header").find(".header-navigation").toggle(300); 253 }); 254 } 255 256 257 258 return { 259 init: function () { 260 // init core variables 261 handleInit(); 262 handleResponsiveOnResize(); 263 handleIEFixes(); 264 handleSearch(); 265 handleFancybox(); 266 handleDifInits();
267 handleSidebarMenu(); 268 handleAccordions(); 269 handleMenu(); 270 handleScrollers(); 271 handleSubMenuExt(); 272 handleMobiToggler(); 273 274 }, 275 276 initUniform: function (els) { 277 if (els) { 278 jQuery(els).each(function () { 279 if ($(this).parents(".checker").length == 0) { 280 $(this).show(); 281 $(this).uniform(); 282 } 283 }); 284 } else { 285 handleUniform(); 286 } 287 }, 288 289 initTwitter: function () { 290 !function(d,s,id){ 291 var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);} 292 }(document,"script","twitter-wjs"); 293 }, 294 295 initTouchspin: function () { 296 $(".product-quantity .form-control").TouchSpin({ 297 buttondown_class: "btn quantity-down", 298 buttonup_class: "btn quantity-up" 299 }); 300 $(".quantity-down").html("<i class='fa fa-angle-down'></i>"); 301 $(".quantity-up").html("<i class='fa fa-angle-up'></i>"); 302 }, 303 304 initFixHeaderWithPreHeader: function () { 305 jQuery(window).scroll(function() { 306 if (jQuery(window).scrollTop()>37){ 307 jQuery("body").addClass("page-header-fixed"); 308 } 309 else { 310 jQuery("body").removeClass("page-header-fixed"); 311 } 312 }); 313 }, 314 315 initNavScrolling: function () { 316 function NavScrolling () { 317 if (jQuery(window).scrollTop()>60){ 318 jQuery(".header").addClass("reduce-header"); 319 } 320 else { 321 jQuery(".header").removeClass("reduce-header"); 322 } 323 } 324 325 NavScrolling(); 326 327 jQuery(window).scroll(function() { 328 NavScrolling (); 329 }); 330 }, 331 332 333 // wrapper function to scroll(focus) to an element 334 scrollTo: function (el, offeset) { 335 var pos = (el && el.length > 0) ? el.offset().top : 0; 336 if (el) { 337 if ($('body').hasClass('page-header-fixed')) { 338 pos = pos - $('.header').height(); 339 } 340 pos = pos + (offeset ? offeset : -1 * el.height()); 341 } 342 343 jQuery('html,body').animate({ 344 scrollTop: pos 345 }, 'slow'); 346 }, 347 348 //public function to add callback a function which will be called on window resize 349 addResponsiveHandler: function (func) { 350 responsiveHandlers.push(func); 351 }, 352 353 scrollTop: function () { 354 App.scrollTo(); 355 }, 356 357 gridOption1: function () { 358 $(function(){ 359 $('.grid-v1').mixitup(); 360 }); 361 } 362 363 }; 364 365 366}(); 367 368 var scrolltotop={ 369 //startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control 370 //scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top). 371 setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]}, 372 controlHTML: '<img src="/frontend/media/up2.png" style="width:40px; height:40px" />', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol" 373 controlattrs: {offsetx:10, offsety:10}, //offset of control relative to right/ bottom of window corner 374 anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links 375 376 state: {isvisible:false, shouldvisible:false}, 377 378 scrollup:function(){ 379 if (!this.cssfixedsupport) //if control is positioned using JavaScript 380 this.$control.css({opacity:0}
380) //hide control immediately after clicking it 381 var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto) 382 if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists 383 dest=jQuery('#'+dest).offset().top 384 else 385 dest=0 386 this.$body.animate({scrollTop: dest}, this.setting.scrollduration); 387 }, 388 389 keepfixed:function(){ 390 var $window=jQuery(window) 391 var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx 392 var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety 393 this.$control.css({left:controlx+'px', top:controly+'px'}) 394 }, 395 396 togglecontrol:function(){ 397 var scrolltop=jQuery(window).scrollTop() 398 if (!this.cssfixedsupport) 399 this.keepfixed() 400 this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false 401 if (this.state.shouldvisible && !this.state.isvisible){ 402 this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0]) 403 this.state.isvisible=true 404 } 405 else if (this.state.shouldvisible==false && this.state.isvisible){ 406 this.$control.stop().animate({opacity:0}
406, this.setting.fadeduration[1]) 407 this.state.isvisible=false 408 } 409 }, 410 411 init:function(){ 412 jQuery(document).ready(function($){ 413 var mainobj=scrolltotop 414 var iebrws=document.all 415 mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode 416 mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body') 417 mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>') 418 .css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'}) 419 .attr({title:'Scroll Back to Top'}) 420 .click(function(){mainobj.scrollup(); return false}) 421 .appendTo('body') 422 if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text 423 mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text 424 mainobj.togglecontrol() 425 $('a[href="' + mainobj.anchorkeyword +'"]').click(function(){ 426 mainobj.scrollup() 427 return false 428 }) 429 $(window).bind('scroll resize', function(e){ 430 mainobj.togglecontrol() 431 }) 432 }) 433 } 434 435 436} 437 438scrolltotop.init() 439 440$(".dropdown-menu").click(function(e){ 441 e.stopPropagation(); 442})
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.