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// Handles portlet tools & actions 34 var handlePortletTools = function () { 35 jQuery('body').on('click', '.portlet > .portlet-title > .tools > a.remove', function (e) { 36 e.preventDefault(); 37 jQuery(this).closest(".portlet").remove(); 38 }); 39 40 jQuery('body').on('click', '.portlet > .portlet-title > .tools > a.reload', function (e) { 41 e.preventDefault(); 42 var el = jQuery(this).closest(".portlet").children(".portlet-body"); 43 var url = jQuery(this).attr("data-url"); 44 var error = $(this).attr("data-error-display"); 45 if (url) { 46 Metronic.blockUI({target: el, iconOnly: true}); 47 $.ajax({ 48 type: "GET", 49 cache: false, 50 url: url, 51 dataType: "html", 52 success: function(res) 53 { 54 Metronic.unblockUI(el); 55 el.html(res); 56 }, 57 error: function(xhr, ajaxOptions, thrownError) 58 { 59 Metronic.unblockUI(el); 60 var msg = 'Error on reloading the content. Please check your connection and try again.'; 61 if (error == "toastr" && toastr) { 62 toastr.error(msg); 63 } else if (error == "notific8" && $.notific8) { 64 $.notific8('zindex', 11500); 65 $.notific8(msg, {theme: 'ruby', life: 3000}); 66 } else { 67 alert(msg); 68 } 69 } 70 }); 71 } else { 72 // for demo purpose 73 Metronic.blockUI({target: el, iconOnly: true}); 74 window.setTimeout(function () { 75 Metronic.unblockUI(el); 76 }, 1000); 77 } 78 }); 79 80 // load ajax data on page init 81 $('.portlet .portlet-title a.reload[data-load="true"]').click(); 82 83 jQuery('body').on('click', '.portlet > .portlet-title > .tools > .collapse, .portlet .portlet-title > .tools > .expand', function (e) { 84 e.preventDefault(); 85 var el = jQuery(this).closest(".portlet").children(".portlet-body"); 86 if (jQuery(this).hasClass("collapse")) { 87 jQuery(this).removeClass("collapse").addClass("expand"); 88 el.slideUp(200); 89 } else { 90 jQuery(this).removeClass("expand").addClass("collapse"); 91 el.slideDown(200); 92 } 93 }); 94 } 95 96 // runs callback functions set by App.addResponsiveHandler(). 97 var runResponsiveHandlers = function () { 98 // reinitialize other subscribed elements 99 for (var i in responsiveHandlers) { 100 var each = responsiveHandlers[i]; 101 each.call(); 102 } 103 } 104 105 // handle the layout reinitialization on window resize 106 var handleResponsiveOnResize = function () { 107 var resize; 108 if (isIE8) { 109 var currheight; 110 $(window).resize(function () { 111 if (currheight == document.documentElement.clientHeight) { 112 return; //quite event since only body resized not window. 113 } 114 if (resize) { 115 clearTimeout(resize); 116 } 117 resize = setTimeout(function () { 118 runResponsiveHandlers(); 119 }, 50); // wait 50ms until window resize finishes. 120 currheight = document.documentElement.clientHeight; // store last body client height 121 }); 122 } else { 123 $(window).resize(function () { 124 if (resize) { 125 clearTimeout(resize); 126 } 127 resize = setTimeout(function () { 128 runResponsiveHandlers(); 129 }, 50); // wait 50ms until window resize finishes. 130 }); 131 } 132 } 133 134 var handleIEFixes = function() { 135 //fix html5 placeholder attribute for ie7 & ie8 136 if (isIE8 || isIE9) { // ie8 & ie9 137 // this is html5 placeholder fix for inputs, inputs with placeholder-no-fix class will be skipped(e.g: we need this for password fields) 138 jQuery('input[placeholder]:not(.placeholder-no-fix), textarea[placeholder]:not(.placeholder-no-fix)').each(function () { 139 140 var input = jQuery(this); 141 142 if (input.val() == '' && input.attr("placeholder") != '') { 143 input.addClass("placeholder").val(input.attr('placeholder')); 144 } 145 146 input.focus(function () { 147 if (input.val() == input.attr('placeholder')) { 148 input.val(''); 149 } 150 }); 151 152 input.blur(function () { 153 if (input.val() == '' || input.val() == input.attr('placeholder')) { 154 input.val(input.attr('placeholder')); 155 } 156 }); 157 }); 158 } 159 } 160 161 // Handles scrollable contents using jQuery SlimScroll plugin. 162 var handleScrollers = function () { 163 $('.scroller').each(function () { 164 var height; 165 if ($(this).attr("data-height")) { 166 height = $(this).attr("data-height"); 167 } else { 168 height = $(this).css('height'); 169 } 170 $(this).slimScroll({ 171 allowPageScroll: true, // allow page scroll when the element scroll is ended 172 size: '7px', 173 color: ($(this).attr("data-handle-color") ? $(this).attr("data-handle-color") : '#bbb'), 174 railColor: ($(this).attr("data-rail-color") ? $(this).attr("data-rail-color") : '#eaeaea'), 175 position: isRTL ? 'left' : 'right', 176 height: height, 177 alwaysVisible: ($(this).attr("data-always-visible") == "1" ? true : false), 178 railVisible: ($(this).attr("data-rail-visible") == "1" ? true : false), 179 disableFadeOut: true 180 }); 181 }); 182 } 183 184 var handleSearch = function() { 185 $('.search-btn').click(function () { 186 if($('.search-btn').hasClass('show-search-icon')){ 187 if ($(window).width()>767) { 188 $('.search-box').fadeOut(300); 189 } else { 190 $('.search-box').fadeOut(0); 191 } 192 $('.search-btn').removeClass('show-search-icon'); 193 } else { 194 if ($(window).width()>767) { 195 $('.search-box').fadeIn(300); 196 } else { 197 $('.search-box').fadeIn(0); 198 } 199 $('.search-btn').addClass('show-search-icon'); 200 } 201 }); 202 203 // close search box on body click 204 if($('.search-btn').length != 0) { 205 $('.search-box, .search-btn').on('click', function(e){ 206 e.stopPropagation(); 207 }); 208 209 $('body').on('click', function() { 210 if ($('.search-btn').hasClass('show-search-icon')) { 211 $('.search-btn').removeClass("show-search-icon"); 212 $('.search-box').fadeOut(300); 213 } 214 }); 215 } 216 } 217 218 var handleMenu = function() {
219 $(".header .navbar-toggle").click(function () { 220 if ($(".header .navbar-collapse").hasClass("open")) { 221 $(".header .navbar-collapse").slideDown(300) 222 .removeClass("open"); 223 } else { 224 $(".header .navbar-collapse").slideDown(300) 225 .addClass("open"); 226 } 227 }); 228 } 229 var handleSubMenuExt = function() { 230 $(".header-navigation .dropdown").on("hover", function() { 231 if ($(this).children(".header-navigation-content-ext").show()) { 232 if ($(".header-navigation-content-ext").height()>=$(".header-navigation-description").height()) { 233 $(".header-navigation-description").css("height", $(".header-navigation-content-ext").height()+22); 234 } 235 } 236 }); 237 } 238 239 var handleSidebarMenu = function () { 240 $(".sidebar .dropdown a i").click(function (event) { 241 event.preventDefault(); 242 if ($(this).parent("a").hasClass("collapsed") == false) { 243 $(this).parent("a").addClass("collapsed"); 244 $(this).parent("a").siblings(".dropdown-menu").slideDown(300); 245 } else { 246 $(this).parent("a").removeClass("collapsed"); 247 $(this).parent("a").siblings(".dropdown-menu").slideUp(300); 248 } 249 }); 250 } 251 252 function handleDifInits() { 253 $(".header .navbar-toggle span:nth-child(2)").addClass("short-icon-bar"); 254 $(".header .navbar-toggle span:nth-child(4)").addClass("short-icon-bar"); 255 } 256 257 function handleUniform() { 258 if (!jQuery().uniform) { 259 return; 260 } 261 var test = $("input[type=checkbox]:not(.toggle), input[type=radio]:not(.toggle, .star)"); 262 if (test.length > 0) { 263 test.each(function () { 264 if ($(this).parents(".checker").length == 0) { 265 $(this).show(); 266 $(this).uniform(); 267 } 268 }); 269 } 270 } 271 272 var handleFancybox = function () { 273 if (!jQuery.fancybox) { 274 return; 275 } 276 277 jQuery(".fancybox-fast-view").fancybox(); 278 279 if (jQuery(".fancybox-button").length > 0) { 280 jQuery(".fancybox-button").fancybox({ 281 groupAttr: 'data-rel', 282 prevEffect: 'none', 283 nextEffect: 'none', 284 closeBtn: true, 285 helpers: { 286 title: { 287 type: 'inside' 288 } 289 } 290 }); 291 292 $('.fancybox-video').fancybox({ 293 type: 'iframe' 294 }); 295 } 296 } 297 298 // Handles Bootstrap Accordions. 299 var handleAccordions = function () { 300 301 jQuery('body').on('shown.bs.collapse', '.accordion.scrollable', function (e) { 302 Layout.scrollTo($(e.target), -100); 303 }); 304 305 } 306 307 // Handles Bootstrap Tabs. 308 var handleTabs = function () { 309 // fix content height on tab click 310 $('body').on('shown.bs.tab', '.nav.nav-tabs', function () { 311 handleSidebarAndContentHeight(); 312 }); 313 314 //activate tab if tab id provided in the URL 315 if (location.hash) { 316 var tabid = location.hash.substr(1); 317 $('a[href="#' + tabid + '"]').click(); 318 } 319 } 320 321 var handleMobiToggler = function () { 322 $(".mobi-toggler").on("click", function(event) { 323 event.preventDefault();//the default action of the event will not be triggered 324 325 $(".header").toggleClass("menuOpened"); 326 $(".header").find(".header-navigation").toggle(300); 327 }); 328 } 329 330 var handleTheme = function () { 331 332 var panel = $('.color-panel'); 333 334 // handle theme colors 335 var setColor = function (color) { 336 $('#style-color').attr("href", "'+ ROOT_URL +'/assets/frontend/layout/css/themes/" + color + ".css"); 337 $('.corporate .site-logo img').attr("src", "'+ ROOT_URL +'/assets/frontend/layout/img/logos/logo-corp-" + color + ".png"); 338 $('.ecommerce .site-logo img').attr("src", "'+ ROOT_URL +'/assets/frontend/layout/img/logos/logo-shop-" + color + ".png"); 339 } 340 341 $('.icon-color', panel).click(function () { 342 $('.color-mode').show(); 343 $('.icon-color-close').show(); 344 }); 345 346 $('.icon-color-close', panel).click(function () { 347 $('.color-mode').hide(); 348 $('.icon-color-close').hide(); 349 }); 350 351 $('li', panel).click(function () { 352 var color = $(this).attr("data-style"); 353 setColor(color); 354 $('.inline li', panel).removeClass("current"); 355 $(this).addClass("current"); 356 }); 357 } 358 359 return { 360 init: function () { 361 // init core variables
362 handleTheme(); 363 handleInit(); 364 handleResponsiveOnResize(); 365 handleIEFixes(); 366 handleSearch(); 367 handleFancybox(); 368 handleDifInits(); 369 handleSidebarMenu(); 370 handleAccordions(); 371 handleMenu(); 372 handleScrollers(); 373 handleSubMenuExt(); 374 handleMobiToggler(); 375 handlePortletTools(); 376 }, 377 378 initUniform: function (els) { 379 if (els) { 380 jQuery(els).each(function () { 381 if ($(this).parents(".checker").length == 0) { 382 $(this).show(); 383 $(this).uniform(); 384 } 385 }); 386 } else { 387 handleUniform(); 388 } 389 }, 390 391 initTwitter: function () { 392 !function(d,s,id){ 393 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);} 394 }(document,"script","twitter-wjs"); 395 }, 396 397 initTouchspin: function () { 398 $(".product-quantity .form-control").TouchSpin({ 399 buttondown_class: "btn quantity-down", 400 buttonup_class: "btn quantity-up" 401 }); 402 $(".quantity-down").html("<i class='fa fa-angle-down'></i>"); 403 $(".quantity-up").html("<i class='fa fa-angle-up'></i>"); 404 }, 405 406 initFixHeaderWithPreHeader: function () { 407 jQuery(window).scroll(function() { 408 if (jQuery(window).scrollTop()>37){ 409 jQuery("body").addClass("page-header-fixed"); 410 } 411 else { 412 jQuery("body").removeClass("page-header-fixed"); 413 } 414 }); 415 }, 416 417 initNavScrolling: function () { 418 function NavScrolling () { 419 if (jQuery(window).scrollTop()>60){ 420 jQuery(".header").addClass("reduce-header"); 421 } 422 else { 423 jQuery(".header").removeClass("reduce-header"); 424 } 425 } 426 NavScrolling (); 427 jQuery(window).scroll(function() { 428 NavScrolling (); 429 }); 430 }, 431 432 /* 433 initOWL: function () { 434 $(".owl-carousel6-brands").owlCarousel({ 435 navigation: true, 436 items: 6, 437 addClassActive: true, 438 itemsCustom : [ 439 [0, 1], 440 [320, 1], 441 [480, 2], 442 [700, 3], 443 [975, 5], 444 [1200, 6], 445 [1400, 6], 446 [1600, 6] 447 ], 448 }); 449 450 $(".owl-carousel5").owlCarousel({ 451 pagination: false, 452 navigation: true, 453 items: 5, 454 addClassActive: true, 455 stopOnHover: true, 456 slideSpeed: 400, 457 rewindSpeed: 1000, 458 itemsCustom : [ 459 [0, 1], 460 [320, 1], 461 [480, 2], 462 [660, 3], 463 [700, 4], 464 [768, 4], 465 [980, 5], 466 [991, 5], 467 [1024, 5], 468 [1200, 5], 469 [1400, 5], 470 [1600, 5], 471 [1600, 5] 472 ], 473 }); 474 475 $(".owl-carousel4").owlCarousel({ 476 pagination: true, 477 paginationNumbers: false, 478 navigation: true, 479 items: 4, 480 addClassActive: true, 481 stopOnHover: true, 482 slideSpeed: 400, 483 rewindSpeed: 1000, 484 itemsCustom : [ 485 [0, 2], 486 [320, 2], 487 [480, 3], 488 [660, 4], 489 [700, 4], 490 [768, 4], 491 [980, 4], 492 [991, 4], 493 [1024, 4], 494 [1200, 4], 495 [1400, 4], 496 [1600, 4], 497 [1600, 4] 498 ], 499 }); 500 $(".owl-carousel3").owlCarousel({ 501 pagination: false, 502 navigation: true, 503 items: 3, 504 addClassActive: true, 505 stopOnHover: true, 506 slideSpeed: 400, 507 rewindSpeed: 1000, 508 itemsCustom : [ 509 [0, 1], 510 [320, 1], 511 [480, 1], 512 [660, 2], 513 [700, 3], 514 [768, 3], 515 [980, 3], 516 [991, 3], 517 [1024, 3], 518 [1200, 3], 519 [1400, 3], 520 [1600, 3], 521 [1600, 3] 522 ], 523 }); 524 525 $(".owl-carousel5").owlCarousel({ 526 pagination: false, 527 navigation: true, 528 items: 5, 529 addClassActive: true, 530 itemsCustom : [ 531 [0, 1], 532 [320, 1], 533 [480, 2], 534 [660, 2], 535 [700, 3], 536 [768, 3], 537 [992, 4], 538 [1024, 4], 539 [1200, 5], 540 [1400, 5], 541 [1600, 5] 542 ], 543 }); 544 545 $(".owl-carousel4").owlCarousel({ 546 pagination: false, 547 navigation: true, 548 items: 4, 549 addClassActive: true, 550 }); 551 552 $(".owl-carousel3").owlCarousel({ 553 pagination: false, 554 navigation: true, 555 items: 3, 556 addClassActive: true, 557 itemsCustom : [ 558 [0, 1], 559 [320, 1], 560 [480, 2], 561 [700, 3], 562 [768, 2], 563 [1024, 3], 564 [1200, 3], 565 [1400, 3], 566 [1600, 3] 567 ], 568 }); 569 570 $(".owl-carousel2").owlCarousel({ 571 pagination: false, 572 navigation: true, 573 items: 2, 574 addClassActive: true, 575 itemsCustom : [ 576 [0, 1], 577 [320, 1], 578 [480, 2], 579 [700, 3], 580 [975, 2], 581 [1200, 2], 582 [1400, 2], 583 [1600, 2] 584 ], 585 }); 586 }, 587 */ 588 589 initImageZoom: function () { 590 $('.product-main-image').zoom({url: $('.product-main-image img').attr('data-BigImgSrc')}); 591 }, 592 593 initSliderRange: function () { 594 $( "#slider-range" ).slider({ 595 range: true, 596 min: 0, 597 max: 500, 598 values: [ 50, 250 ], 599 slide: function( event, ui ) { 600 $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] ); 601 } 602 }); 603 $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) + 604 " - $" + $( "#slider-range" ).slider( "values", 1 ) ); 605 }, 606 607 // wrapper function to scroll(focus) to an element 608 scrollTo: function (el, offeset) { 609 var pos = (el && el.length > 0) ? el.offset().top : 0; 610 if (el) { 611 if ($('body').hasClass('page-header-fixed')) { 612 pos = pos - $('.header').height(); 613 } 614 pos = pos + (offeset ? offeset : -1 * el.height()); 615 } 616 617 jQuery('html,body').animate({ 618 scrollTop: pos 619 }, 'slow'); 620 }, 621 622 //public function to add callback a function which will be called on window resize 623 addResponsiveHandler: function (func) { 624 responsiveHandlers.push(func); 625 }, 626 627 scrollTop: function () { 628 App.scrollTo(); 629 }, 630 631 gridOption1: function () { 632 $(function(){ 633 $('.grid-v1').mixitup(); 634 }); 635 } 636 637 }; 638}();
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.