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 // handle the layout reinitialization on window resize 43 var handleResponsiveOnResize = function () { 44 var resize; 45 if (isIE8) { 46 var currheight; 47 $(window).resize(function () { 48 if (currheight == document.documentElement.clientHeight) { 49 return; //quite event since only body resized not window. 50 } 51 if (resize) { 52 clearTimeout(resize); 53 } 54 resize = setTimeout(function () { 55 runResponsiveHandlers(); 56 }, 50); // wait 50ms until window resize finishes. 57 currheight = document.documentElement.clientHeight; // store last body client height 58 }); 59 } else { 60 $(window).resize(function () { 61 if (resize) { 62 clearTimeout(resize); 63 } 64 resize = setTimeout(function () { 65 runResponsiveHandlers(); 66 }, 50); // wait 50ms until window resize finishes. 67 }); 68 } 69 } 70 71 var handleIEFixes = function() { 72 //fix html5 placeholder attribute for ie7 & ie8 73 if (isIE8 || isIE9) { // ie8 & ie9 74 // this is html5 placeholder fix for inputs, inputs with placeholder-no-fix class will be skipped(e.g: we need this for password fields) 75 jQuery('input[placeholder]:not(.placeholder-no-fix), textarea[placeholder]:not(.placeholder-no-fix)').each(function () { 76 77 var input = jQuery(this); 78 79 if (input.val() == '' && input.attr("placeholder") != '') { 80 input.addClass("placeholder").val(input.attr('placeholder')); 81 } 82 83 input.focus(function () { 84 if (input.val() == input.attr('placeholder')) { 85 input.val(''); 86 } 87 }); 88 89 input.blur(function () { 90 if (input.val() == '' || input.val() == input.attr('placeholder')) { 91 input.val(input.attr('placeholder')); 92 } 93 }); 94 }); 95 } 96 } 97 98 // Handles scrollable contents using jQuery SlimScroll plugin. 99 var handleScrollers = function () { 100 $('.scroller').each(function () { 101 var height; 102 if ($(this).attr("data-height")) { 103 height = $(this).attr("data-height"); 104 } else { 105 height = $(this).css('height'); 106 } 107 $(this).slimScroll({ 108 allowPageScroll: true, // allow page scroll when the element scroll is ended 109 size: '7px', 110 color: ($(this).attr("data-handle-color") ? $(this).attr("data-handle-color") : '#bbb'), 111 railColor: ($(this).attr("data-rail-color") ? $(this).attr("data-rail-color") : '#eaeaea'), 112 position: isRTL ? 'left' : 'right', 113 height: height, 114 alwaysVisible: ($(this).attr("data-always-visible") == "1" ? true : false), 115 railVisible: ($(this).attr("data-rail-visible") == "1" ? true : false), 116 disableFadeOut: true 117 }); 118 }); 119 } 120 121 var handleSearch = function() { 122 $('.search-btn').click(function () { 123 if($('.search-btn').hasClass('show-search-icon')){ 124 if ($(window).width()>767) { 125 $('.search-box').fadeOut(300);
126 } else { 127 $('.search-box').fadeOut(0); 128 } 129 $('.search-btn').removeClass('show-search-icon'); 130 } else { 131 if ($(window).width()>767) { 132 $('.search-box').fadeIn(300); 133 } else { 134 $('.search-box').fadeIn(0); 135 } 136 $('.search-btn').addClass('show-search-icon'); 137 } 138 }); 139 140 // close search box on body click 141 if($('.search-btn').size() != 0) { 142 $('.search-box, .search-btn').on('click', function(e){ 143 e.stopPropagation(); 144 }); 145 146 $('body').on('click', function() { 147 if ($('.search-btn').hasClass('show-search-icon')) { 148 $('.search-btn').removeClass("show-search-icon"); 149 $('.search-box').fadeOut(300); 150 } 151 }); 152 } 153 } 154 155 var handleMenu = function() { 156 $(".header .navbar-toggle").click(function () { 157 if ($(".header .navbar-collapse").hasClass("open")) { 158 $(".header .navbar-collapse").slideDown(300) 159 .removeClass("open"); 160 } else { 161 $(".header .navbar-collapse").slideDown(300) 162 .addClass("open"); 163 } 164 }); 165 } 166 var handleSubMenuExt = function() { 167 $(".header-navigation .dropdown").on("hover", function() { 168 if ($(this).children(".header-navigation-content-ext").show()) { 169 if ($(".header-navigation-content-ext").height()>=$(".header-navigation-description").height()) { 170 $(".header-navigation-description").css("height", $(".header-navigation-content-ext").height()+22); 171 } 172 } 173 }); 174 } 175 176 var handleSidebarMenu = function () { 177 $(".sidebar .dropdown > a").click(function (event) { 178 if ($(this).next().hasClass('dropdown-menu')) { 179 event.preventDefault(); 180 if ($(this).hasClass("collapsed") == false) { 181 $(this).addClass("collapsed"); 182 $(this).siblings(".dropdown-menu").slideDown(300); 183 } else { 184 $(this).removeClass("collapsed"); 185 $(this).siblings(".dropdown-menu").slideUp(300); 186 } 187 } 188 }); 189 } 190 191 function handleDifInits() { 192 $(".header .navbar-toggle span:nth-child(2)").addClass("short-icon-bar"); 193 $(".header .navbar-toggle span:nth-child(4)").addClass("short-icon-bar"); 194 } 195 196 function handleUniform() { 197 if (!jQuery().uniform) { 198 return; 199 } 200 var test = $("input[type=checkbox]:not(.toggle), input[type=radio]:not(.toggle, .star)"); 201 if (test.size() > 0) { 202 test.each(function () { 203 if ($(this).parents(".checker").size() == 0) { 204 $(this).show(); 205 $(this).uniform(); 206 } 207 }); 208 } 209 } 210 211 var handleFancybox = function () { 212 if (!jQuery.fancybox) { 213 return; 214 } 215 216 jQuery(".fancybox-fast-view").fancybox(); 217 218 if (jQuery(".fancybox-button").size() > 0) { 219 jQuery(".fancybox-button").fancybox({ 220 groupAttr: 'data-rel', 221 prevEffect: 'none', 222 nextEffect: 'none', 223 closeBtn: true, 224 helpers: { 225 title: { 226 type: 'inside' 227 } 228 } 229 }); 230 231 $('.fancybox-video').fancybox({ 232 type: 'iframe' 233 }); 234 } 235 } 236 237 // Handles Bootstrap Accordions. 238 var handleAccordions = function () { 239 240 jQuery('body').on('shown.bs.collapse', '.accordion.scrollable', function (e) { 241 Layout.scrollTo($(e.target), -100); 242 }); 243 244 } 245 246 // Handles Bootstrap Tabs. 247 var handleTabs = function () { 248 // fix content height on tab click 249 $('body').on('shown.bs.tab', '.nav.nav-tabs', function () { 250 handleSidebarAndContentHeight(); 251 }); 252 253 //activate tab if tab id provided in the URL 254 if (location.hash) { 255 var tabid = location.hash.substr(1); 256 $('a[href="#' + tabid + '"]').click(); 257 } 258 } 259 260 var handleMobiToggler = function () { 261 $(".mobi-toggler").on("click", function(event) { 262 event.preventDefault();//the default action of the event will not be triggered 263 264 $(".header").toggleClass("menuOpened"); 265 $(".header").find(".header-navigation").toggle(300); 266 }); 267 } 268 269 270 return { 271 init: function () { 272 // init core variables 273 274 handleInit(); 275 handleResponsiveOnResize(); 276 handleIEFixes(); 277 handleSearch(); 278 handleFancybox(); 279 handleDifInits();
280 handleSidebarMenu(); 281 handleAccordions(); 282 handleMenu(); 283 handleScrollers(); 284 handleSubMenuExt(); 285 handleMobiToggler(); 286 }, 287 288 initUniform: function (els) { 289 if (els) { 290 jQuery(els).each(function () { 291 if ($(this).parents(".checker").size() == 0) { 292 $(this).show(); 293 $(this).uniform(); 294 } 295 }); 296 } else { 297 handleUniform(); 298 } 299 }, 300 301 302 303 initTouchspin: function () { 304 $(".product-quantity .form-control").TouchSpin({ 305 buttondown_class: "btn quantity-down", 306 buttonup_class: "btn quantity-up" 307 }); 308 $(".quantity-down").html("<i class='fa fa-angle-down'></i>"); 309 $(".quantity-up").html("<i class='fa fa-angle-up'></i>"); 310 }, 311 312 initFixHeaderWithPreHeader: function () { 313 jQuery(window).scroll(function() { 314 if (jQuery(window).scrollTop()>37){ 315 jQuery("body").addClass("page-header-fixed"); 316 } 317 else { 318 jQuery("body").removeClass("page-header-fixed"); 319 } 320 }); 321 }, 322 323 initNavScrolling: function () { 324 function NavScrolling () { 325 if (jQuery(window).scrollTop()>60){ 326 jQuery(".header").addClass("reduce-header"); 327 } 328 else { 329 jQuery(".header").removeClass("reduce-header"); 330 } 331 } 332 333 NavScrolling(); 334 335 jQuery(window).scroll(function() { 336 NavScrolling (); 337 }); 338 }, 339 340 initOWL: function () { 341 $(".owl-carousel6-brands").owlCarousel({ 342 pagination: false, 343 navigation: true, 344 items: 6, 345 addClassActive: true, 346 itemsCustom : [ 347 [0, 1], 348 [320, 1], 349 [480, 2], 350 [700, 3], 351 [975, 5], 352 [1200, 6], 353 [1400, 6], 354 [1600, 6] 355 ], 356 }); 357 358 $(".owl-carousel5").owlCarousel({ 359 pagination: false, 360 navigation: true, 361 items: 5, 362 addClassActive: true, 363 itemsCustom : [ 364 [0, 1], 365 [320, 1], 366 [480, 2], 367 [660, 2], 368 [700, 3], 369 [768, 3], 370 [992, 4], 371 [1024, 4], 372 [1200, 5], 373 [1400, 5], 374 [1600, 5] 375 ], 376 }); 377 378 $(".owl-carousel4").owlCarousel({ 379 pagination: false, 380 navigation: true, 381 items: 4, 382 addClassActive: true, 383 }); 384 385 $(".owl-carousel3").owlCarousel({ 386 autoplay: true, 387 autoplayTimeout: 3000, 388 nav:true, 389 pagination: false, 390 navigation: true, 391 autoplayHoverPause: true, // Stops autoplay 392responsiveRefreshRate : 10, 393 loop:false, 394 items: 4, 395 addClassActive: true, 396 responsive: { 397 0: { 398 items: 1 399 }, 400 320: { 401 items: 1 402 }, 403 480: { 404 items: 2 405 }, 406 700: { 407 items: 2 408 }, 409 768: { 410 items: 2 411 }, 412 1024: { 413 items: 4 414 }, 415 1400: { 416 items: 4 417 } 418 }, 419 itemsCustom : [ 420 [0, 1], 421 [320, 1], 422 [480, 2], 423 [700, 2], 424 [768, 2], 425 [1024, 4], 426 [1200, 4], 427 [1400, 4], 428 [1600, 4] 429 ], 430 }); 431 432 $(".owl-carousel2").owlCarousel({ 433 pagination: false, 434 navigation: true, 435 items: 2, 436 addClassActive: true, 437 itemsCustom : [ 438 [0, 1], 439 [320, 1], 440 [480, 2], 441 [700, 3], 442 [975, 2], 443 [1200, 2], 444 [1400, 2], 445 [1600, 2] 446 ], 447 }); 448 }, 449 450 initImageZoom: function () { 451 $('.product-main-image').zoom({url: $('.product-main-image img').attr('data-BigImgSrc')}); 452 }, 453 454 initSliderRange: function () { 455 $( "#slider-range" ).slider({ 456 range: true, 457 min: 0, 458 max: 500, 459 values: [ 50, 250 ], 460 slide: function( event, ui ) { 461 $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] ); 462 } 463 }); 464 $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) + 465 " - $" + $( "#slider-range" ).slider( "values", 1 ) ); 466 }, 467 468 // wrapper function to scroll(focus) to an element 469 scrollTo: function (el, offeset) { 470 var pos = (el && el.size() > 0) ? el.offset().top : 0; 471 if (el) { 472 if ($('body').hasClass('page-header-fixed')) { 473 pos = pos - $('.header').height(); 474 } 475 pos = pos + (offeset ? offeset : -1 * el.height()); 476 } 477 478 jQuery('html,body').animate({ 479 scrollTop: pos 480 }, 'slow'); 481 }, 482 483 //public function to add callback a function which will be called on window resize 484 addResponsiveHandler: function (func) { 485 responsiveHandlers.push(func); 486 }, 487 488 scrollTop: function () { 489 App.scrollTo(); 490 }, 491 492 gridOption1: function () { 493 $(function(){ 494 $('.grid-v1').mixitup(); 495 }); 496 } 497 498 }; 499}();
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.