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