1/** ********************************************** ** 2 @Author Dorin Grigoras 3 @Website www.stepofweb.com 4 @Last Update Saturday, March 15, 2014 5 6 NOTE! Do not change anything here if you want to 7 be able to update in the future! Please use 8 your custom script (eg. custom.js). 9 10 11 TABLE CONTENTS 12 ------------------------------- 13 01. Top Nav 14 02. Animate 15 03. Superslides 16 04. OWL Carousel 17 05. Popover 18 06. Lightbox 19 07. ScrollTo 20 08. Parallax 21 09. Masonry Filter 22 10. Toggle 23 11. Background Image 24 12. Global Search 25 13. Quick Cart 26 14. Placeholder 27 15. Summernote HTML Editor 28 29 GOOGLE MAP 30 AFTER RESIZE 31 COUNT TO 32 FITVIDS 33 WAIT FOR IMAGES [used by masonry] 34*************************************************** **/ 35 36 /* Init */ 37 jQuery(window).ready(function () { 38 Atropos(); 39 }); 40 41 42/** Core 43 **************************************************************** **/ 44 function Atropos() { 45 _topNav(); 46 _animate(); 47 _superslide(); 48 _owl_carousel(); 49 _popover(); 50 _lightbox(); 51 _scrollTo(); 52 _parallax(); 53 _masonry(); 54 _toggle(); 55 _bgimage(); 56 _globalSearch(); 57 _quickCart(); 58 _placeholder(); 59 _htmlEditor(); 60 61 /** Bootstrap Tooltip **/ 62 jQuery("a[data-toggle=tooltip]").tooltip(); 63 64 /** Fitvids [Youtube|Vimeo] **/ 65 if(jQuery(".fullwidthbanner iframe").length < 1 && jQuery(".fullscreenbanner iframe").length < 1 && jQuery(".fullscreenvideo").length < 1) { // disable fitvids if revolution slider video is present! 66 jQuery("body").fitVids(); 67 } 68 69 /** 70 price slider 71 72 <script type="text/javascript" charset="utf-8"> 73 var slider_config = { from: 10, to: 500, heterogeneity: ['50/100', '75/250'], step: 10, dimension: ' $', skin: 'round_plastic' }; 74 </script> 75 **/ 76 if(jQuery().slider && jQuery(".price-slider").length > 0) { 77 jQuery("#Slider2").slider(slider_config); 78 } 79 80 /** mobile - hide on click! **/ 81 jQuery(document).bind("click", function() { 82 if(jQuery("div.navbar-collapse").hasClass('in')) { 83 jQuery("button.btn-mobile").trigger('click'); 84 } 85 }); 86 87 } 88 89 90/** 01. Top Nav 91 **************************************************************** **/ 92function _topNav() { 93 var addActiveClass = false; 94 95 jQuery("#topMain li.dropdown > a, #topMain li.dropdown-submenu > a").bind("click", function(e) { 96 if(jQuery(this).attr('href') == '#') { 97 e.preventDefault(); 98 } 99 100 e.stopPropagation(); 101 102 if(jQuery(window).width() > 979) { 103 return; 104 } 105 106 107 addActiveClass = jQuery(this).parent().hasClass("resp-active"); 108 jQuery("#topMain").find(".resp-active").removeClass("resp-active"); 109 110 if(!addActiveClass) { 111 jQuery(this).parents("li").addClass("resp-active"); 112 } 113 114 return; 115 116 }); 117 118 // Drop Downs - do not hide on click 119 jQuery("#topHead .dropdown-menu, #topNav .mega-menu .dropdown-menu").bind("click", function(e) { 120 e.stopPropagation(); 121 }); 122 123 jQuery(window).scroll(function() { 124 125 if(jQuery(window).width() > 1006) { 126 topMain(); // on scroll 127 } 128 129 }); 130 131 if(jQuery(window).width() > 1006) { 132 topMain(); // on load 133 } 134 135 136 137 // #topHead Fixes 138 window._headHeight = 81; 139 window._headHeightSmall = 30; 140 141 function _topNavCalibrate() { 142 143 if(jQuery("#topHead").length > 0) { 144 window._headHeight = jQuery("header#topHead").outerHeight() + jQuery("header#topNav").outerHeight() - 10; 145 window._headHeightSmall = 66; 146 147 jQuery('#wrapper').css({"padding-top":window._headHeight + "px"}); 148 jQuery('#topHead').removeClass('fixed').addClass('fixed'); 149 150 if(jQuery('#header_shadow').length > 0) { 151 jQuery('#header_shadow').css({"top":window._headHeight + "px"}); 152 } 153 154 } else { 155 156 if(jQuery(window).width() < 1006) { 157 jQuery('#wrapper').css({"margin-top":"-30px"}); 158 jQuery('#header_shadow').css({"top":"40px"}); 159 } else { 160 jQuery('#wrapper').css({"margin-top":"0px"}); 161 162 // From mobile back to desktop - do not leave the shadow behing 163 if(jQuery(window).scrollTop() > 3) { 164 jQuery('#header_shadow').css({"top":"60px"}); 165 } else { 166 jQuery('#header_shadow').css({"top":"80px"}); 167 } 168 } 169 170 } 171 172 } 173 174 // recalibrate menu (mobile = slim mode) on resize 175 jQuery(window).resize(function() { 176 _topNavCalibrate(); 177 }); _topNavCalibrate(); 178 179 180 // scoll is on top! 181 window.topNavSmall = false;
182 183 184 function topMain() { 185 var _scrollTop = jQuery(document).scrollTop(); 186 187 if(window.topNavSmall === false && _scrollTop > 0) { 188 189 jQuery('header#topNav div.nav-main-collapse').addClass('topFix'); 190 jQuery('#topNav').stop().animate({ 'height':'60px'},400); 191 jQuery('header#topNav div.nav-main-collapse').stop().animate({ 'margin-top':'6px'},400); 192 jQuery('header#topNav button').stop().animate({ 'margin-top':'0'},100); 193 jQuery('header#topNav a.logo').stop().animate({ 'margin-top':'-10px'},400); 194 195 if(jQuery('#header_shadow').length > 0) { 196 jQuery('#header_shadow').stop().animate({ 'top':window._headHeightSmall + 'px'},400);/* just a little visible */ 197 } 198 199 window.topNavSmall = true; 200 } 201 202 if(window.topNavSmall === true && _scrollTop < 3) { 203 jQuery('header#topNav div.nav-main-collapse').removeClass('topFix'); 204 jQuery('#topNav').stop().animate({ 'height':'81px'},400); 205 jQuery('header#topNav div.nav-main-collapse').stop().animate({ 'margin-top':'16px'},400); 206 jQuery('header#topNav button').stop().animate({ 'margin-top':'8px'},100); 207 jQuery('header#topNav a.logo').stop().animate({ 'line-height':'50px', 'margin-top':'0'},400); 208 209 if(jQuery('#header_shadow').length > 0) { 210 jQuery('#header_shadow').stop().animate({ 'top':window._headHeight + 'px'},400); 211 } 212 213 window.topNavSmall = false; 214 } 215 216 } 217} 218 219 220/** 02. Animate 221 **************************************************************** **/ 222function _animate() { 223 224 // Animation [appear] 225 jQuery("[data-animation]").each(function() { 226 var _t = jQuery(this); 227 228 if(jQuery(window).width() > 767) { 229 230 _t.appear(function() { 231 232 var delay = (_t.attr("data-animation-delay") ? _t.attr("data-animation-delay") : 1); 233 234 if(delay > 1) _t.css("animation-delay", delay + "ms"); 235 _t.addClass(_t.attr("data-animation")); 236 237 setTimeout(function() { 238 _t.addClass("animation-visible"); 239 }, delay); 240 241 }, {accX: 0, accY: -150}); 242 243 } else { 244 245 _t.addClass("animation-visible"); 246 247 } 248 249 }); 250 251 // Bootstrap Progress Bar 252 jQuery("[data-appear-progress-animation]").each(function() { 253 var $_t = jQuery(this); 254 255 if(jQuery(window).width() > 767) { 256 257 $_t.appear(function() { 258 _delay = 1; 259 260 if($_t.attr("data-appear-progress-animation-delay")) { 261 _delay = $_t.attr("data-appear-progress-animation-delay"); 262 } 263 264 if(_delay > 1) { 265 $_t.css("animation-delay", _delay + "ms"); 266 } 267 268 $_t.addClass($_t.attr("data-appear-progress-animation")); 269 270 setTimeout(function() { 271 272 $_t.addClass("animation-visible"); 273 274 }, _delay); 275 276 }, {accX: 0, accY: -150}); 277 278 } else { 279 280 $_t.addClass("animation-visible"); 281 282 } 283 284 }); 285 286 287 jQuery("[data-appear-progress-animation]").each(function() { 288 var $_t = jQuery(this); 289 290 $_t.appear(function() { 291 292 var _delay = ($_t.attr("data-appear-animation-delay") ? $_t.attr("data-appear-animation-delay"): 1); 293 294 if(_delay > 1) { 295 $_t.css("animation-delay", _delay + "ms"); 296 } 297 298 $_t.addClass($_t.attr("data-appear-animation")); 299 setTimeout(function() { 300 301 $_t.animate({"width": $_t.attr("data-appear-progress-animation")}, 1000, "easeOutQuad", function() { 302 $_t.find(".progress-bar-tooltip").animate({"opacity": 1}, 500, "easeOutQuad"); 303 }); 304 305 }, _delay); 306 307 }, {accX: 0, accY: -50}); 308 309 }); 310 311 312 // Count To 313 jQuery(".countTo [data-to]").each(function() { 314 var $_t = jQuery(this); 315 316 $_t.appear(function() { 317 318 $_t.countTo(); 319 320 }, {accX:0, accY:-150}); 321 322 }); 323 324 325 /* Knob Circular Bar */ 326 if(jQuery().knob) { 327 328 jQuery(".knob").knob(); 329 330 } 331 332 333 /* Animation */ 334 jQuery('.animate_from_top').each(function () { 335 jQuery(this).appear(function() { 336 jQuery(this).delay(150).animate({opacity:1,top:"0px"},1000); 337 }); 338 }); 339 340 jQuery('.animate_from_bottom').each(function () { 341 jQuery(this).appear(function() { 342 jQuery(this).delay(150).animate({opacity:1,bottom:"0px"},1000); 343 }); 344 }); 345 346 347 jQuery('.animate_from_left').each(function () { 348 jQuery(this).appear(function() { 349 jQuery(this).delay(150).animate({opacity:1,left:"0px"},1000); 350 }); 351 }); 352 353 354 jQuery('.animate_from_right').each(function () { 355 jQuery(this).appear(function() { 356 jQuery(this).delay(150).animate({opacity:1,right:"0px"},1000); 357 }); 358 }); 359 360 jQuery('.animate_fade_in').each(function () { 361 jQuery(this).appear(function() { 362 jQuery(this).delay(350).animate({opacity:1,right:"0px"},1000); 363 }); 364 }); 365} 366 367 368 369 370/** 03. Superslides 371 **************************************************************** **/ 372function _superslide() { 373
374 if(jQuery("#slider").length > 0) { 375 376 var data_autoplay = jQuery("#slider").attr('data-autoplay'), 377 data_mouseover_stop = jQuery("#slider").attr('data-mouseover-stop'); 378 379 if(data_autoplay) { 380 if(data_autoplay == '') { 381 var data_autoplay = false; 382 } else { 383 var data_autoplay = parseInt(data_autoplay); 384 } 385 } else { 386 var data_autoplay = false; 387 } 388 389 if(!data_autoplay) { 390 data_mouseover_stop = false; 391 } 392 393 jQuery("#slider").superslides({ 394 animation: "fade", // slide|fade 395 pagination: true, // true|false 396 play: data_autoplay, // false to disable autoplay -OR- miliseconds (eg.: 1000 = 1s) 397 animation_speed: 600, // animation transition 398 399 elements: { 400 preserve: '.preserve', 401 nav: '.slides-navigation', 402 container: '.slides-container', 403 pagination: '.slides-pagination' 404 } 405 }); 406 407 if(data_mouseover_stop == 'true') { 408 409 // Stop on mouse over ! 410 jQuery('#slider').on('mouseenter', function() { 411 jQuery(this).superslides('stop'); 412 // console.log('Stopped') 413 }); 414 jQuery('#slider').on('mouseleave', function() { 415 jQuery(this).superslides('start'); 416 // console.log('_start') 417 }); 418 419 } 420 421 jQuery(window).load(function () { 422 jQuery("#slider").css({"background":"none"}); 423 }); 424 425 } 426} 427 428 429 430 431/** 04. OWL Carousel 432 **************************************************************** **/ 433function _owl_carousel() { 434 435 var total = jQuery("div.owl-carousel").length, 436 count = 0; 437 438 jQuery("div.owl-carousel").each(function() { 439 440 var slider = jQuery(this); 441 var options = slider.attr('data-plugin-options'); 442 443 var defaults = { 444 items: 5, 445 itemsCustom: false, 446 itemsDesktop: [1199,4], 447 itemsDesktopSmall: [980,3], 448 itemsTablet: [768,2], 449 itemsTabletSmall: false, 450 itemsMobile: [479,1], 451 singleItem: true, 452 itemsScaleUp: false, 453 454 slideSpeed: 200, 455 paginationSpeed: 800, 456 rewindSpeed: 1000, 457 458 autoPlay: false, 459 stopOnHover: false, 460 461 navigation: false, 462 navigationText: [ 463 '<i class="fa fa-chevron-left"></i>', 464 '<i class="fa fa-chevron-right"></i>' 465 ], 466 rewindNav: true, 467 scrollPerPage: false, 468 469 pagination: true, 470 paginationNumbers: false, 471 472 responsive: true, 473 responsiveRefreshRate: 200, 474 responsiveBaseWidth: window, 475 476 baseClass: "owl-carousel", 477 theme: "owl-theme", 478 479 lazyLoad: false, 480 lazyFollow: true, 481 lazyEffect: "fade", 482 483 autoHeight: false, 484 485 jsonPath: false, 486 jsonSuccess: false, 487 488 dragBeforeAnimFinish: true, 489 mouseDrag: true, 490 touchDrag: true, 491 492 transitionStyle: false, 493 494 addClassActive: false, 495 496 beforeUpdate: false, 497 afterUpdate: false, 498 beforeInit: false, 499 afterInit: false, 500 beforeMove: false, 501 afterMove: false, 502 afterAction: false, 503 startDragging: false, 504 afterLazyLoad: false 505 } 506 507 var config = jQuery.extend({}, defaults, options, slider.data("plugin-options")); 508 slider.owlCarousel(config).addClass("owl-carousel-init"); 509 }); 510} 511 512 513 514 515/** 05. Popover 516 **************************************************************** **/ 517function _popover() { 518 519 jQuery("a[data-toggle=popover]").bind("click", function(e) { 520 jQuery('.popover-title .close').remove(); 521 e.preventDefault(); 522 }); 523 524 var isVisible = false, 525 clickedAway = false; 526 527 528 jQuery("a[data-toggle=popover], button[data-toggle=popover]").popover({ 529 530 html: true, 531 trigger: 'manual' 532 533 }).click(function(e) { 534 535 jQuery(this).popover('show'); 536 537 clickedAway = false; 538 isVisible = true; 539 e.preventDefault(); 540 541 }); 542 543 jQuery(document).click(function(e) { 544 if(isVisible & clickedAway) { 545 546 jQuery("a[data-toggle=popover], button[data-toggle=popover]").popover('hide'); 547 isVisible = clickedAway = false; 548 549 } else { 550 551 552 clickedAway = true; 553 554 } 555 556 }); 557 558 jQuery("a[data-toggle=popover], button[data-toggle=popover]").popover({ 559 560 html: true, 561 trigger: 'manual' 562 563 }).click(function(e) { 564 565 $(this).popover('show'); 566 $('.popover-title').append('<button type="button" class="close">×</button>'); 567 $('.close').click(function(e){ 568 569 jQuery("a[data-toggle=popover], button[data-toggle=popover]").popover('hide'); 570 571 }); 572 573 e.preventDefault(); 574 }); 575 576 577 // jQuery("a[data-toggle=popover], button[data-toggle=popover]").popover(); 578} 579 580 581 582 583/** 06. LightBox 584 **************************************************************** **/ 585function _lightbox() { 586
587 if(typeof(jQuery.magnificPopup) == "undefined") { 588 return false; 589 } 590 591 jQuery.extend(true, jQuery.magnificPopup.defaults, { 592 tClose: 'Close', 593 tLoading: 'Loading...', 594 595 gallery: { 596 tPrev: 'Previous', 597 tNext: 'Next', 598 tCounter: '%curr% / %total%' 599 }, 600 601 image: { 602 tError: 'Image not loaded!' 603 }, 604 605 ajax: { 606 tError: 'Content not loaded!' 607 } 608 }); 609 610 jQuery(".lightbox").each(function() { 611 612 var _t = jQuery(this), 613 options = _t.attr('data-plugin-options'), 614 config = {}, 615 defaults = { 616 type: 'image', 617 fixedContentPos: false, 618 fixedBgPos: false, 619 mainClass: 'mfp-no-margins mfp-with-zoom', 620 image: { 621 verticalFit: true 622 }, 623 624 zoom: { 625 enabled: false, 626 duration: 300 627 }, 628 629 gallery: { 630 enabled: false, 631 navigateByImgClick: true, 632 preload: [0,1], 633 arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>', 634 tPrev: 'Previou', 635 tNext: 'Next', 636 tCounter: '<span class="mfp-counter">%curr% / %total%</span>' 637 }, 638 }; 639 640 if(_t.data("plugin-options")) { 641 config = jQuery.extend({}, defaults, options, _t.data("plugin-options")); 642 } 643 644 jQuery(this).magnificPopup(config); 645 646 }); 647} 648 649 650 651 652/** 07. ScrollTo 653 **************************************************************** **/ 654function _scrollTo() { 655 656 jQuery("a.scrollTo").bind("click", function(e) { 657 e.preventDefault(); 658 659 var href = jQuery(this).attr('href'); 660 661 if(href != '#') { 662 jQuery('html,body').animate({scrollTop: jQuery(href).offset().top - 60}, 1000, 'easeInOutExpo'); 663 } 664 }); 665 666 jQuery("a.toTop").bind("click", function(e) { 667 e.preventDefault(); 668 jQuery('html,body').animate({scrollTop: 0}, 1000, 'easeInOutExpo'); 669 }); 670} 671 672 673 674 675/** 08. Parallax 676 **************************************************************** **/ 677function _parallax() { 678
679 if(typeof(jQuery.stellar) == "undefined") { 680 681 jQuery(".parallax").addClass("parallax-init"); 682 return false; 683 684 } 685 686 jQuery(window).load(function () { 687 688 if(jQuery(".parallax").length > 0) { 689 690 if(!Modernizr.touch) { 691 692 jQuery(window).stellar({ 693 694 responsive: true, 695 scrollProperty: 'scroll', 696 parallaxElements: false, 697 horizontalScrolling: false, 698 horizontalOffset: 0, 699 verticalOffset: 0 700 }); 701 702 } else { 703 704 jQuery(".parallax").addClass("disabled"); 705 706 } 707 } 708 709 jQuery(".parallax").addClass("parallax-init"); 710 711 // responsive 712 jQuery(window).afterResize(function() { 713 jQuery.stellar('refresh'); 714 }); 715 716 }); 717} 718 719 720 721 722/** 09. Masonry Filter 723 **************************************************************** **/ 724function _masonry() { 725 726 jQuery(window).load(function() { 727 728 jQuery("span.js_loader").remove(); 729 jQuery("li.masonry-item").addClass('fadeIn'); 730 731 jQuery(".masonry-list").each(function() { 732 733 var _c = jQuery(this); 734 735 _c.waitForImages(function() { // waitForImages Plugin - bottom of this file 736 737 _c.masonry({ 738 itemSelector: '.masonry-item' 739 }); 740 741 }); 742 743 }); 744 745 }); 746 747 jQuery("ul.isotope-filter").each(function() { 748 749 var _el = jQuery(this), 750 destination = jQuery("ul.sort-destination[data-sort-id=" + jQuery(this).attr("data-sort-id") + "]"); 751 752 if(destination.get(0)) { 753 754 jQuery(window).load(function() { 755 756 destination.isotope({ 757 itemSelector: "li", 758 layoutMode: 'sloppyMasonry' 759 }); 760 761 _el.find("a").click(function(e) { 762 763 e.preventDefault(); 764 765 var $_t = jQuery(this), 766 sortId = $_t.parents(".sort-source").attr("data-sort-id"), 767 filter = $_t.parent().attr("data-option-value"); 768 769 _el.find("li.active").removeClass("active"); 770 $_t.parent().addClass("active"); 771 772 destination.isotope({ 773 filter: filter 774 }); 775 776 jQuery(".sort-source-title[data-sort-id=" + sortId + "] strong").html($_t.html()); 777 return false; 778 779 }); 780 781 }); 782 783 } 784 785 }); 786 787 788 jQuery(window).load(function() { 789 790 jQuery("ul.isotope").addClass('fadeIn'); 791 792 }); 793} 794 795 796 797 798 799/** 10. Toggle 800 **************************************************************** **/ 801function _toggle() { 802 803 var $_t = this, 804 previewParClosedHeight = 25; 805 806 jQuery("div.toggle.active > p").addClass("preview-active"); 807 jQuery("div.toggle.active > div.toggle-content").slideDown(400); 808 jQuery("div.toggle > label").click(function(e) { 809 810 var parentSection = jQuery(this).parent(), 811 parentWrapper = jQuery(this).parents("div.toogle"), 812 previewPar = false, 813 isAccordion = parentWrapper.hasClass("toogle-accordion"); 814 815 if(isAccordion && typeof(e.originalEvent) != "undefined") { 816 parentWrapper.find("div.toggle.active > label").trigger("click"); 817 } 818 819 parentSection.toggleClass("active"); 820 821 if(parentSection.find("> p").get(0)) { 822 823 previewPar = parentSection.find("> p"); 824 var previewParCurrentHeight = previewPar.css("height"); 825 var previewParAnimateHeight = previewPar.css("height"); 826 previewPar.css("height", "auto"); 827 previewPar.css("height", previewParCurrentHeight); 828 829 } 830 831 var toggleContent = parentSection.find("> div.toggle-content"); 832 833 if(parentSection.hasClass("active")) { 834 835 jQuery(previewPar).animate({height: previewParAnimateHeight}, 350, function() {jQuery(this).addClass("preview-active");}); 836 toggleContent.slideDown(350); 837 838 } else { 839 840 jQuery(previewPar).animate({height: previewParClosedHeight}, 350, function() {jQuery(this).removeClass("preview-active");}); 841 toggleContent.slideUp(350); 842 843 } 844 845 }); 846} 847 848 849 850
851/** 11. Background Image 852 class="boxed" should be added to body. 853 Add to body - example: data-background="assets/images/boxed_background/1.jpg" 854 **************************************************************** **/ 855 function _bgimage() { 856 if(jQuery('body').hasClass('boxed')) { 857 backgroundImageSwitch(); 858 } 859 function backgroundImageSwitch() { 860 var data_background = jQuery('body').attr('data-background'); 861 if(data_background) { 862 jQuery.backstretch(data_background); 863 jQuery('body').addClass('transparent'); // remove backround color of boxed class 864 } 865 } 866 } 867 868 869 870 871/** 12. Global Search 872 **************************************************************** **/ 873 function _globalSearch() { 874 875 jQuery('li.search, li.search input').bind("click", function(e) { 876 e.stopPropagation(); 877 }); 878 879 jQuery('li.search input').bind("click", function() { 880 return false; 881 }); 882 883 jQuery('li.search').bind("click", function() { 884 885 if(jQuery(this).hasClass('open')) { 886 887 disable_overlay(); 888 enable_scroll(); 889 jQuery(this).removeClass('open'); 890 891 } else { 892 893 enable_overlay(); 894 disable_scroll(); 895 jQuery(this).addClass('open'); 896 jQuery('li.quick-cart').removeClass('open'); // close quick cart 897 898 } 899 900 }); 901 902 // 'esc' key 903 jQuery(document).keydown(function(e) { 904 var code = e.keyCode ? e.keyCode : e.which; 905 if(code == 27) { 906 jQuery('li.search, li.quick-cart').removeClass('open'); 907 disable_overlay(); 908 enable_scroll(); 909 } 910 }); 911 912 jQuery(document).bind("click", function() { 913 if(jQuery('li.search').hasClass('open')) { 914 jQuery('li.search, li.quick-cart').removeClass('open'); 915 disable_overlay(); 916 enable_scroll(); 917 } 918 }); 919 920 } 921 922 923 924/** 13. Quick Cart 925 **************************************************************** **/ 926 function _quickCart() { 927 928 jQuery('li.quick-cart').bind("click", function() { 929 930 jQuery('li.quick-cart .quick-cart-content').bind("click", function(e) { 931 e.stopPropagation(); 932 }); 933 934 if(jQuery(this).hasClass('open')) { 935 936 disable_overlay(); 937 enable_scroll(); 938 jQuery(this).removeClass('open'); 939 940 } else { 941 942 enable_overlay(); 943 disable_scroll(); 944 jQuery(this).addClass('open'); 945 jQuery('li.search').removeClass('open'); // close search 946 947 } 948 949 return false; 950 }); 951 952 // 'esc' key 953 jQuery(document).keydown(function(e) { 954 var code = e.keyCode ? e.keyCode : e.which; 955 if(code == 27) { 956 jQuery('li.search, li.quick-cart').removeClass('open'); 957 disable_overlay(); 958 enable_scroll(); 959 } 960 }); 961 962 jQuery(document).bind("click", function() { 963 if(jQuery('li.quick-cart').hasClass('open')) { 964 jQuery('li.search, li.quick-cart').removeClass('open'); 965 disable_overlay(); 966 enable_scroll(); 967 } 968 }); 969 970 } 971 972 973 974 975 976/** 14. Placeholder 977 **************************************************************** **/ 978 function _placeholder() { 979 980 //check for IE 981 if(navigator.appVersion.indexOf("MSIE")!=-1) { 982 983 jQuery('[placeholder]').focus(function() { 984 985 var input = jQuery(this); 986 if (input.val() == input.attr('placeholder')) { 987 input.val(''); 988 input.removeClass('placeholder'); 989 } 990 991 }).blur(function() { 992 993 var input = jQuery(this); 994 if (input.val() == '' || input.val() == input.attr('placeholder')) { 995 input.addClass('placeholder'); 996 input.val(input.attr('placeholder')); 997 } 998 999 }).blur(); 1000 1001 } 1002 1003 } 1004 1005 1006 1007/** 15. Summernote HTML Editor 1008 **************************************************************** **/ 1009 function _htmlEditor() { 1010 /** 1011 SUMMERNOTE - textarea html editor 1012 1013 <script type="text/javascript" src="assets/plugins/html_summernote/summernote.min.js"></script> 1014 **/ 1015 if(jQuery('textarea.summernote').length > 0 && jQuery().summernote) { 1016 jQuery('textarea.summernote').each(function() { 1017 jQuery(this).summernote({ 1018 height: jQuery(this).attr('data-height') || 200, 1019 toolbar: [ 1020 /* [groupname, [button list]] */ 1021 ['fontsize', ['fontsize']], 1022 ['style', ['bold', 'italic', 'underline','strikethrough', 'clear']], 1023 ['para', ['ul', 'ol', 'paragraph']], 1024 ['table', ['table']], 1025 ['media', ['link', 'picture', 'video']], 1026 ['misc', ['codeview']] 1027 ] 1028 }); 1029 }); 1030 } 1031 } 1032 1033/** **************************************************************************************************************** **/ 1034/** **************************************************************************************************************** **/ 1035/** **************************************************************************************************************** **/ 1036/** **************************************************************************************************************** **/ 1037 1038 1039 1040 // scroll 1041 function wheel(e) { 1042 e.preventDefault(); 1043 } 1044 1045 function disable_scroll() { 1046 if (window.addEventListener) { 1047 window.addEventListener('DOMMouseScroll', wheel, false); 1048 } 1049 window.onmousewheel = document.onmousewheel = wheel; 1050 } 1051 1052 function enable_scroll() { 1053 if (window.removeEventListener) { 1054 window.removeEventListener('DOMMouseScroll', wheel, false); 1055 } 1056 window.onmousewheel = document.onmousewheel = document.onkeydown = null; 1057 } 1058 1059 // overlay 1060 function enable_overlay() { 1061 jQuery("span.global-overlay").remove(); // remove first! 1062 jQuery('body').append('<span class="global-overlay"></span>'); 1063 } 1064 function disable_overlay() { 1065 jQuery("span.global-overlay").remove(); 1066 } 1067 1068 1069 1070/** MEDIA ELEMENTS 1071*************************************************** **/ 1072 if(jQuery().mediaelementplayer && jQuery('video').length > 0 && jQuery(".fullscreenbanner video").length < 1 && jQuery(".fullwidthbanner video").length < 1) { // exclude revolution slider videos 1073 jQuery('video').mediaelementplayer({ 1074 // if the <video width> is not specified, this is the default 1075 defaultVideoWidth: 480, 1076 // if the <video height> is not specified, this is the default 1077 defaultVideoHeight: 270, 1078 // if set, overrides <video width> 1079 videoWidth: '100%', // -1 1080 // if set, overrides <video height> 1081 videoHeight: '100%', // -1 1082 // width of audio player 1083 audioWidth: 400,
1084 // height of audio player 1085 audioHeight: 30, 1086 // initial volume when the player starts 1087 startVolume: 0.8, 1088 // useful for <audio> player loops 1089 loop: true, 1090 // enables Flash and Silverlight to resize to content size 1091 enableAutosize: true, 1092 // the order of controls you want on the control bar (and other plugins below) 1093 features: ['playpause','progress','current','duration','tracks','volume','fullscreen'], 1094 // Hide controls when playing and mouse is not over the video 1095 alwaysShowControls: false, 1096 // force iPad's native controls 1097 iPadUseNativeControls: false, 1098 // force iPhone's native controls 1099 iPhoneUseNativeControls: false, 1100 // force Android's native controls 1101 AndroidUseNativeControls: false, 1102 // forces the hour marker (##:00:00) 1103 alwaysShowHours: false, 1104 // show framecount in timecode (##:00:00:00) 1105 showTimecodeFrameCount: false, 1106 // used when showTimecodeFrameCount is set to true 1107 framesPerSecond: 25, 1108 // turns keyboard support on and off for this instance 1109 enableKeyboard: true, 1110 // when this player starts, it will pause other players 1111 pauseOtherPlayers: true, 1112 // array of keyboard commands 1113 keyActions: [] 1114 1115 }); 1116 1117 setTimeout('eventClickTrigger()', 1000); 1118 function eventClickTrigger() { 1119 jQuery('video').trigger('click'); 1120 // resizeToCover(); 1121 } 1122 1123 // VOVER STYLE 1124 var min_w = 300; // minimum video width allowed 1125 var vid_w_orig; // original video dimensions 1126 var vid_h_orig; 1127 1128 jQuery(function() { // runs after DOM has loaded 1129 vid_w_orig = parseInt(jQuery('video, source').attr('width')); 1130 vid_h_orig = parseInt(jQuery('video, source').attr('height')); 1131 jQuery(window).resize(function () { resizeToCover(); }); 1132 }); 1133 1134 function resizeToCover() { 1135 1136 // set the video viewport to the window size 1137 jQuery('.video-wrap').width(jQuery(window).width()); 1138 jQuery('.video-wrap').height(jQuery(window).height()); 1139 1140 // use largest scale factor of horizontal/vertical 1141 var scale_h = jQuery(window).width() / vid_w_orig; 1142 var scale_v = jQuery(window).height() / vid_h_orig; 1143 var scale = scale_h > scale_v ? scale_h: scale_v; 1144 1145 // don't allow scaled width < minimum video width 1146 if (scale * vid_w_orig < min_w) {scale = min_w / vid_w_orig;}; 1147 1148 // now scale the video 1149 jQuery('video, source').width(scale * vid_w_orig); 1150 jQuery('video, source').height(scale * vid_h_orig); 1151 1152 // and center it by scrolling the video viewport 1153 jQuery('.video-wrap').scrollLeft((jQuery('video').width() - jQuery(window).width()) / 2); 1154 jQuery('.video-wrap').scrollTop((jQuery('video').height() - jQuery(window).height()) / 2); 1155 } 1156 1157 } 1158 1159 1160 1161/** GOOGLE MAP 1162*************************************************** **/ 1163 function contactMap() { 1164 1165 var latLang = new google.maps.LatLng($googlemap_latitude,$googlemap_longitude); 1166 1167 var mapOptions = { 1168 zoom:$googlemap_zoom, 1169 center: latLang, 1170 disableDefaultUI: false, 1171 navigationControl: false, 1172 mapTypeControl: false, 1173 scrollwheel: false, 1174 // styles: styles, 1175 mapTypeId: google.maps.MapTypeId.ROADMAP 1176 }; 1177 1178 var map = new google.maps.Map(document.getElementById('gmap'), mapOptions); 1179 google.maps.event.trigger(map, 'resize'); 1180 map.setZoom( map.getZoom() ); 1181 1182 var marker = new google.maps.Marker({ 1183 icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAArCAYAAAD7YZFOAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXg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vnDtGwbftDpVS1G7CDg4OHhUJhR6BOymHSBe7KNfMX4LbYRrUTWCc4VSqVnN3d3SvdwBUKhXuBlalJkeeBG3Kg/QvYlo3f6+v2pZTygNrKyspsrVbLR01SKpX2y+WyJ75ZE4u4BfwE/CyQ5bDCj6McUqxl27ZnPM87bDfg8PCwadv2gTz4jqTwR+B74FcB3dd1vdELWEc4Ua/qOM5vjuN83W7M2tranuu6O8CavIBcAK6JVdwFDnVd9+LYUqqbUzZwL5/Pf5nJZN7IZDIv+x2bm5uVcrmcl3q
11836LarZUm9uXKhu0+qrdwDYq6url+r1elVWZ21jY+Ma8B1wVdTKATtAvV+wbpXzr2+71Wr190Kh8MX4+Ph7uVxuAfhBfGtLjuCuruuKAcV/AwDnrxMM7gFGVQAAAABJRU5ErkJggg==', 1184 position: latLang, 1185 map: map, 1186 title: "" 1187 }); 1188 1189 marker.setMap(map); 1190 google.maps.event.addListener(marker, "click", function() { 1191 // Add optionally an action for when the marker is clicked 1192 }); 1193 1194 // kepp googlemap responsive - center on resize 1195 google.maps.event.addDomListener(window, 'resize', function() { 1196 map.setCenter(latLang); 1197 }); 1198 1199 } 1200 1201 1202 function showMap(initWhat) { 1203 var script = document.createElement('script'); 1204 script.type = 'text/javascript'; 1205 script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true&callback='+initWhat; 1206 document.body.appendChild(script); 1207 } 1208 1209 1210 // INIT CONTACT, NLY IF #contactMap EXISRS 1211 if(jQuery("#gmap").length > 0) { 1212 showMap('contactMap'); 1213 } 1214 1215 1216 1217/** @Facebook 1218*************************************************** **/ 1219 /* 1220 https://developers.facebook.com/docs/plugins/like-button/ 1221 1222 ADD TO YOUR CODE (just change data-href, that's all): 1223 1224 <div class="fb-like" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div> 1225 */ 1226 if(jQuery("div.fb-like").length > 0) { 1227 1228 jQuery('body').append('<div id="fb-root"></div>'); 1229 1230 (function(d, s, id) { 1231 var js, fjs = d.getElementsByTagName(s)[0]; 1232 if (d.getElementById(id)) return; 1233 js = d.createElement(s); js.id = id; 1234 js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; 1235 fjs.parentNode.insertBefore(js, fjs); 1236 }(document, 'script', 'facebook-jssdk')); 1237 1238 } 1239 1240/** @Google Plus 1241*************************************************** **/ 1242 /* 1243 https://developers.google.com/+/web/+1button/ 1244 1245 <!-- Place this tag where you want the +1 button to render. --> 1246 <div class="g-plusone" data-size="medium" data-annotation="inline" data-width="300"></div> 1247 */ 1248 if(jQuery("div.g-plusone").length > 0) { 1249 1250 (function() { 1251 var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; 1252 po.src = 'https://apis.google.com/js/platform.js'; 1253 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); 1254 })(); 1255 1256 } 1257 1258/** @Twitter 1259*************************************************** **/ 1260 /* 1261 https://dev.twitter.com/docs/tweet-button 1262 1263 <!-- Place this tag where you want the twitter button to render. --> 1264 <a href="https://twitter.com/share" class="twitter-share-button" data-lang="en">Tweet</a> 1265 */ 1266 if(jQuery("a.twitter-share-button").length > 0) { 1267 1268 !function(d,s,id){ 1269 var js,fjs=d.getElementsByTagName(s)[0]; 1270 if(!d.getElementById(id)){js=d.createElement(s); 1271 js.id=id;js.src="https://platform.twitter.com/widgets.js"; 1272 fjs.parentNode.insertBefore(js,fjs);} 1273 }(document,"script","twitter-wjs"); 1274 1275 } 1276 1277 1278 1279 1280 1281/** AFTER RESIZE 1282 http://www.mcshaman.com/afterresize-js-jquery-plugin/ 1283 **************************************************************** **/ 1284 1285( function( $ ) { 1286 "use strict"; 1287 1288 // Define default settings 1289 var defaults = { 1290 action: function() {}, 1291 runOnLoad: false, 1292 duration: 500 1293 }; 1294 1295 // Define global variables 1296 var settings = defaults, 1297 running = false, 1298 start; 1299 1300 var methods = {}; 1301 1302 // Initial plugin configuration 1303 methods.init = function() { 1304 1305 // Allocate passed arguments to settings based on type 1306 for( var i = 0; i <= arguments.length; i++ ) { 1307 var arg = arguments[i]; 1308 switch ( typeof arg ) { 1309 case "function": 1310 settings.action = arg; 1311 break; 1312 case "boolean": 1313 settings.runOnLoad = arg; 1314 break; 1315 case "number": 1316 settings.duration = arg; 1317 break; 1318 } 1319 } 1320 1321 // Process each matching jQuery object 1322 return this.each(function() { 1323 1324 if( settings.runOnLoad ) { settings.action(); } 1325 1326 jQuery(this).resize( function() { 1327 1328 methods.timedAction.call( this ); 1329 1330 } ); 1331 1332 } ); 1333 }; 1334 1335 methods.timedAction = function( code, millisec ) { 1336 1337 var doAction = function() { 1338 var remaining = settings.duration; 1339 1340 if( running ) { 1341 var elapse = new Date() - start; 1342 remaining = settings.duration - elapse; 1343 if( remaining <= 0 ) { 1344 // Clear timeout and reset running variable 1345 clearTimeout(running); 1346 running = false;
1347 // Perform user defined function 1348 settings.action(); 1349 1350 return; 1351 } 1352 } 1353 wait( remaining ); 1354 }; 1355 1356 var wait = function( time ) { 1357 running = setTimeout( doAction, time ); 1358 }; 1359 1360 // Define new action starting time 1361 start = new Date(); 1362 1363 // Define runtime settings if function is run directly 1364 if( typeof millisec === 'number' ) { settings.duration = millisec; } 1365 if( typeof code === 'function' ) { settings.action = code; } 1366 1367 // Only run timed loop if not already running 1368 if( !running ) { doAction(); } 1369 1370 }; 1371 1372 1373 $.fn.afterResize = function( method ) { 1374 1375 if( methods[method] ) { 1376 return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ) ); 1377 } else { 1378 return methods.init.apply( this, arguments ); 1379 } 1380 1381 }; 1382 1383})(jQuery); 1384 1385 1386 1387 1388/** COUNT TO 1389 https://github.com/mhuggins/jquery-countTo 1390 **************************************************************** **/ 1391 (function ($) { 1392 $.fn.countTo = function (options) { 1393 options = options || {}; 1394 1395 return jQuery(this).each(function () { 1396 // set options for current element 1397 var settings = jQuery.extend({}, $.fn.countTo.defaults, { 1398 from: jQuery(this).data('from'), 1399 to: jQuery(this).data('to'), 1400 speed: jQuery(this).data('speed'), 1401 refreshInterval: jQuery(this).data('refresh-interval'), 1402 decimals: jQuery(this).data('decimals') 1403 }, options); 1404 1405 // how many times to update the value, and how much to increment the value on each update 1406 var loops = Math.ceil(settings.speed / settings.refreshInterval), 1407 increment = (settings.to - settings.from) / loops; 1408 1409 // references & variables that will change with each update 1410 var self = this, 1411 $self = jQuery(this), 1412 loopCount = 0, 1413 value = settings.from, 1414 data = $self.data('countTo') || {}; 1415 1416 $self.data('countTo', data); 1417 1418 // if an existing interval can be found, clear it first 1419 if (data.interval) { 1420 clearInterval(data.interval); 1421 } 1422 data.interval = setInterval(updateTimer, settings.refreshInterval); 1423 1424 // __construct the element with the starting value 1425 render(value); 1426 1427 function updateTimer() { 1428 value += increment; 1429 loopCount++; 1430 1431 render(value); 1432
1433 if (typeof(settings.onUpdate) == 'function') { 1434 settings.onUpdate.call(self, value); 1435 } 1436 1437 if (loopCount >= loops) { 1438 // remove the interval 1439 $self.removeData('countTo'); 1440 clearInterval(data.interval); 1441 value = settings.to; 1442 1443 if (typeof(settings.onComplete) == 'function') { 1444 settings.onComplete.call(self, value); 1445 } 1446 } 1447 } 1448 1449 function render(value) { 1450 var formattedValue = settings.formatter.call(self, value, settings); 1451 $self.html(formattedValue); 1452 } 1453 }); 1454 }; 1455 1456 $.fn.countTo.defaults = { 1457 from: 0, // the number the element should start at 1458 to: 0, // the number the element should end at 1459 speed: 1000, // how long it should take to count between the target numbers 1460 refreshInterval: 100, // how often the element should be updated 1461 decimals: 0, // the number of decimal places to show 1462 formatter: formatter, // handler for formatting the value before rendering 1463 onUpdate: null, // callback method for every time the element is updated 1464 onComplete: null // callback method for when the element finishes updating 1465 }; 1466 1467 function formatter(value, settings) { 1468 return value.toFixed(settings.decimals); 1469 } 1470}(jQuery)); 1471 1472 1473 1474 1475 1476/** FITVIDS 1477 http://fitvidsjs.com/ 1478 **************************************************************** **/ 1479(function( $ ){ 1480 1481 "use strict"; 1482 1483 $.fn.fitVids = function( options ) { 1484 var settings = { 1485 customSelector: null 1486 }; 1487 1488 if(!document.getElementById('fit-vids-style')) { 1489 1490 var div = document.createElement('div'), 1491 ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0]; 1492 1493 div.className = 'fit-vids-style'; 1494 div.id = 'fit-vids-style'; 1495 div.style.display = 'none'; 1496 div.innerHTML = '­<style> \ 1497 .fluid-width-video-wrapper { \ 1498 width: 100%; \ 1499 position: relative; \ 1500 padding: 0; \ 1501 } \ 1502 \ 1503 .fluid-width-video-wrapper iframe, \ 1504 .fluid-width-video-wrapper object, \ 1505 .fluid-width-video-wrapper embed { \ 1506 position: absolute; \ 1507 top: 0; \ 1508 left: 0; \ 1509 width: 100%; \ 1510 height: 100%; \ 1511 } \ 1512 </style>'; 1513 1514 ref.parentNode.insertBefore(div,ref); 1515 1516 } 1517 1518 if ( options ) { 1519 jQuery.extend( settings, options ); 1520 } 1521 1522 return this.each(function(){ 1523 var selectors = [ 1524 "iframe[src*='player.vimeo.com']", 1525 "iframe[src*='youtube.com']", 1526 "iframe[src*='youtube-nocookie.com']", 1527 "iframe[src*='kickstarter.com'][src*='video.html']", 1528 "object", 1529 "embed" 1530 ]; 1531 1532 if (settings.customSelector) { 1533 selectors.push(settings.customSelector); 1534 } 1535 1536 var $allVideos = jQuery(this).find(selectors.join(',')); 1537 $allVideos = $allVideos.not("object object"); // SwfObj conflict patch 1538 1539 $allVideos.each(function(){ 1540 var $_t = jQuery(this); 1541 if (this.tagName.toLowerCase() === 'embed' && $_t.parent('object').length || $_t.parent('.fluid-width-video-wrapper').length) { return; } 1542 var height = ( this.tagName.toLowerCase() === 'object' || ($_t.attr('height') && !isNaN(parseInt($_t.attr('height'), 10))) ) ? parseInt($_t.attr('height'), 10): $_t.height(), 1543 width = !isNaN(parseInt($_t.attr('width'), 10)) ? parseInt($_t.attr('width'), 10): $_t.width(), 1544 aspectRatio = height / width; 1545 if(!$_t.attr('id')){ 1546 var videoID = 'fitvid' + Math.floor(Math.random()*999999); 1547 $_t.attr('id', videoID); 1548 } 1549 $_t.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%"); 1550 $_t.removeAttr('height').removeAttr('width'); 1551 }); 1552 }); 1553 }; 1554})(jQuery); 1555 1556// remove fitvids for a specific element: jQuery("#myDiv").unFitVids(); 1557jQuery.fn.unFitVids = function () { 1558 var id = jQuery(this).attr("id"); 1559 var $children = jQuery("#" + id + " .fluid-width-video-wrapper").children().clone(); 1560 jQuery("#" + id + " .fluid-width-video-wrapper").remove(); //removes the element 1561 jQuery("#" + id).append($children); //adds it to the parent 1562}; 1563 1564 1565 1566 1567 1568/** WAIT FOR IMAGES [used by masonry] 1569 https://github.com/alexanderdickson/waitForImages 1570 **************************************************************** **/ 1571;(function ($) { 1572 // Namespace all events. 1573 var eventNamespace = 'waitForImages'; 1574 1575 // CSS properties which contain references to images. 1576 $.waitForImages = { 1577 hasImageProperties: ['backgroundImage', 'listStyleImage', 'borderImage', 'borderCornerImage', 'cursor'] 1578 }; 1579 1580 // Custom selector to find `img` elements that have a valid `src` attribute and have not already loaded. 1581 $.expr[':'].uncached = function (obj) { 1582 // Ensure we are dealing with an `img` element with a valid `src` attribute. 1583 if (!$(obj).is('img[src!=""]')) { 1584 return false;
1585 } 1586 1587 // Firefox's `complete` property will always be `true` even if the image has not been downloaded. 1588 // Doing it this way works in Firefox. 1589 var img = new Image(); 1590 img.src = obj.src; 1591 return !img.complete; 1592 }; 1593 1594 $.fn.waitForImages = function (finishedCallback, eachCallback, waitForAll) { 1595 1596 var allImgsLength = 0; 1597 var allImgsLoaded = 0; 1598 1599 // Handle options object. 1600 if ($.isPlainObject(arguments[0])) { 1601 waitForAll = arguments[0].waitForAll; 1602 eachCallback = arguments[0].each; 1603 // This must be last as arguments[0] 1604 // is aliased with finishedCallback. 1605 finishedCallback = arguments[0].finished; 1606 } 1607 1608 // Handle missing callbacks. 1609 finishedCallback = finishedCallback || $.noop; 1610 eachCallback = eachCallback || $.noop; 1611 1612 // Convert waitForAll to Boolean 1613 waitForAll = !! waitForAll; 1614 1615 // Ensure callbacks are functions. 1616 if (!$.isFunction(finishedCallback) || !$.isFunction(eachCallback)) { 1617 throw new TypeError('An invalid callback was supplied.'); 1618 } 1619 1620 return this.each(function () { 1621 // Build a list of all imgs, dependent on what images will be considered. 1622 var obj = $(this); 1623 var allImgs = []; 1624 // CSS properties which may contain an image. 1625 var hasImgProperties = $.waitForImages.hasImageProperties || []; 1626 // To match `url()` references. 1627 // Spec: http://www.w3.org/TR/CSS2/syndata.html#value-def-uri 1628 var matchUrl = /url\(\s*(['"]?)(.*?)\1\s*\)/g; 1629 1630 if (waitForAll) { 1631 1632 // Get all elements (including the original), as any one of them could have a background image. 1633 obj.find('*').addBack().each(function () { 1634 var element = $(this); 1635 1636 // If an `img` element, add it. But keep iterating in case it has a background image too. 1637 if (element.is('img:uncached')) { 1638 allImgs.push({ 1639 src: element.attr('src'), 1640 element: element[0] 1641 }); 1642 } 1643 1644 $.each(hasImgProperties, function (i, property) { 1645 var propertyValue = element.css(property); 1646 var match; 1647 1648 // If it doesn't contain this property, skip. 1649 if (!propertyValue) { 1650 return true; 1651 } 1652 1653 // Get all url() of this element. 1654 while (match = matchUrl.exec(propertyValue)) { 1655 allImgs.push({ 1656 src: match[2], 1657 element: element[0] 1658 }); 1659 } 1660 }); 1661 }); 1662 } else { 1663 // For images only, the task is simpler. 1664 obj.find('img:uncached') 1665 .each(function () { 1666 allImgs.push({ 1667 src: this.src, 1668 element: this 1669 }); 1670 }); 1671 } 1672 1673 allImgsLength = allImgs.length; 1674 allImgsLoaded = 0; 1675 1676 // If no images found, don't bother. 1677 if (allImgsLength === 0) { 1678 finishedCallback.call(obj[0]); 1679 } 1680 1681 $.each(allImgs, function (i, img) { 1682 1683 var image = new Image(); 1684 1685 // Handle the image loading and error with the same callback. 1686 $(image).on('load.' + eventNamespace + ' error.' + eventNamespace, function (event) { 1687 allImgsLoaded++; 1688 1689 // If an error occurred with loading the image, set the third argument accordingly. 1690 eachCallback.call(img.element, allImgsLoaded, allImgsLength, event.type == 'load'); 1691 1692 if (allImgsLoaded == allImgsLength) { 1693 finishedCallback.call(obj[0]); 1694 return false;
1695 } 1696 1697 }); 1698 1699 image.src = img.src; 1700 }); 1701 }); 1702 }; 1703}(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.