1/** 2 * Custom Javascript for Edition 3 * 4 * @package WordPress 5 * @subpackage Edition 6 * @since Edition 1.0 7 */ 8 9// Set jQuery to NoConflict Mode 10jQuery.noConflict(); 11 12(function($) { 13 "use strict"; 14 15 /** 16 * Converts html image to full fixed background 17 * @since v1.0 18 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 19 */ 20 $.fn.parallaxImg = function() { 21 $(this).each(function() { 22 var $this = jQuery(this), 23 parallaxsrc = $this.attr("src"), 24 captionDiv = $this.closest(".wp-caption"); 25 26 // If there's a caption set 27 if (captionDiv.length) { 28 captionDiv 29 .removeClass("wp-caption") 30 .addClass("post-break has-caption") 31 .css("width", "auto"); 32 $this.before( 33 '<span class="full-bg-image" style="background-image: url(' + 34 parallaxsrc + 35 ');"></span>' 36 ); 37 } else { 38 $this.before( 39 '<span class="post-break"><span class="full-bg-image" style="background-image: url(' + 40 parallaxsrc + 41 ');"></span></span>' 42 ); 43 } 44 $this.remove(); 45 }); 46 }; 47 48 /** 49 * Uses javascript to submit search terms to prevent empty searches 50 * @since v1.0 51 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 52 */ 53 $.fn.searchSubmit = function() { 54 $(this).each(function() { 55 var $this = $(this), 56 searchbox = $this.find("input"), 57 searchForm = $this.find("form"), 58 submitBtn = $this.find(".searchbutton"); 59 60 function validate() { 61 if (searchbox.val().length > 0) { 62 searchForm.submit(); 63 } 64 } 65 66 $this.on("click", function() { 67 searchbox.focus(); 68 }); 69 70 submitBtn.click(function() { 71 validate(); 72 }); 73 }); 74 }; 75 76 /** 77 * Calls lightbox links 78 * @since v1.0 79 */ 80 $.fn.themewichLightbox = function() { 81 var attachments = jQuery("a.themewich-lightbox, a[rel*='attachment']"); 82 83 attachments.magnificPopup({ 84 type: "image", 85 closeBtnInside: true, 86 tLoading: '<div class="loading"></div>', 87 mainClass: "mfp-zoom-in", 88 removalDelay: 500, //delay removal by X to allow out-animation 89 image: { 90 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', 91 titleSrc: function(item) { 92 return item.el.find("img").attr("title"); 93 }, 94 markup: 95 '<div class="mfp-figure">' + 96 '<div class="mfp-close"></div>' + 97 '<div class="mfp-img"></div>' + 98 '<div class="mfp-bottom-bar">' + 99 '<div class="mfp-title-wrapper"><div class="mfp-title"></div></div>' + 100 '<div class="mfp-counter"></div>' + 101 "</div>" + 102 "</div>" // Popup HTML markup. `.mfp-img` div will be replaced with img tag, `.mfp-close` by close button 103 }, 104 callbacks: { 105 imageLoadComplete: function() { 106 var self = this; 107 setTimeout(function() { 108 self.wrap.addClass("mfp-image-loaded"); 109 }, 16); 110 }, 111 close: function() { 112 this.wrap.removeClass("mfp-image-loaded"); 113 } 114 }, 115 closeOnContentClick: true, 116 midClick: true 117 }); 118 119 $(".open-popup-link").magnificPopup({ 120 type: "inline", 121 removalDelay: 500, //delay removal by X to allow out-animation 122 fixedContentPos: false, 123 fixedBgPos: true, 124 tLoading: '<div class="loading"></div>', 125 126 overflowY: "auto", 127 128 closeBtnInside: true, 129 preloader: false, 130 callbacks: { 131 imageLoadComplete: function() { 132 var self = this; 133 setTimeout(function() { 134 self.wrap.addClass("mfp-image-loaded"); 135 }, 16); 136 }, 137 close: function() { 138 this.wrap.removeClass("mfp-image-loaded"); 139 } 140 }, 141 142 midClick: true, 143 mainClass: "mfp-zoom-in" 144 }); 145 146 $(".popup-with-move-anim").magnificPopup({ 147 type: "inline", 148 149 fixedContentPos: false, 150 fixedBgPos: true, 151 152 overflowY: "auto", 153 154 closeBtnInside: true, 155 preloader: false, 156 157 midClick: true, 158 removalDelay: 300, 159 mainClass: "my-mfp-slide-bottom" 160 }); 161 162 jQuery(".gallery").each(function() { 163 jQuery(this).magnificPopup({ 164 delegate: "a.lightbox-gallery:not(.bx-clone a.lightbox-gallery)", 165 type: "image", 166 closeBtnInside: true, 167 tLoading: '<div class="loading"></div>', 168 mainClass: "mfp-zoom-in", 169 removalDelay: 500, //delay removal by X to allow out-animation 170 gallery: { 171 enabled: true, 172 navigateByImgClick: true, 173 preload: [0, 1] // Will preload 0 - before current, and 1 after the current image 174 }, 175 image: { 176 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', 177 titleSrc: function(item) { 178 return item.el.find("img").attr("title"); 179 }, 180 markup: 181 '<div class="mfp-figure">' + 182 '<div class="mfp-close"></div>' + 183 '<div class="mfp-img"></div>' + 184 '<div class="mfp-bottom-bar">' + 185 '<div class="mfp-title-wrapper"><div class="mfp-title"></div></div>' + 186 '<div class="mfp-counter"></div>' + 187 "</div>" + 188 "</div>" // Popup HTML markup. `.mfp-img` div will be replaced with img tag, `.mfp-close` by close button 189 }, 190 callbacks: { 191 imageLoadComplete: function() { 192 var self = this; 193 setTimeout(function() { 194 self.wrap.addClass("mfp-image-loaded"); 195 }, 16); 196 }, 197 close: function() { 198 this.wrap.removeClass("mfp-image-loaded"); 199 } 200 }, 201 closeOnContentClick: true, 202 midClick: true 203 }); 204 }); 205 }; 206 207 $.fn.ajaxLoadPosts = function() { 208 var $selector = $(this); 209 210 $selector.click(function() { 211 var $this = $(this), 212 $othertabs = $this.closest(".tabswrap").find("a"), 213 $query = $this.attr("data-query"), 214 $content = $this.closest(".tabswrap").find(".tabs-content"), 215 $numposts = $content.attr("data-posts"), 216 $contentheight = $content.height(), 217 $loading = $content.closest(".tabswrap").find(".loading"); 218 219 $othertabs.removeClass("active"); 220 $this.addClass("active"); 221 222 jQuery.ajax({ 223 type: "POST", 224 url: agAjax.ajaxurl, 225 data: { 226 action: "themewich_load_widget_posts", 227 query: $query, 228 posts: $numposts, 229 cache: false 230 }, 231 beforeSend: function() { 232 $loading.fadeIn(500); 233 234 $content.stop().animate({ opacity: "0" }, 250, function() { 235 $content.css("height", $contentheight); 236 }); 237 }, 238 success: function(data, textStatus, XMLHttpRequest) { 239 var $newItems = ""; 240 241 for (var entry in data) { 242 if (typeof data[entry] == "object") { 243 var title = data[entry].title; 244 var link = data[entry].link; 245 var date = data[entry].date; 246 247 $newItems += '<div class="tabpost">'; 248 249 if (data[entry].img) { 250 $newItems += 251 '<div class="featuredimagewidget thumbnailarea">' + 252 '<a class="thumblink" href="' + 253 data[entry].link + 254 '">' + 255 '<img src="' + 256 data[entry].img + 257 '" />' + 258 "</a>" + 259 "</div>"; 260 } else { 261 $newItems += 262 '<div class="featurednoimagewidget">' + 263 '<i class="fa fa-align-left"></i>' + 264 "</div>"; 265 } 266 267 $newItems += 268 '<p class="tab-title"><a href="' + 269 data[entry].link + 270 '" title="' + 271 data[entry].title + 272 '">' + 273 data[entry].title + 274 "</a></p>" + 275 '<p class="views"><i class="fa fa-eye"></i> ' + 276 data[entry].views + 277 "</p>" + 278 '<div class="clear"></div>' + 279 "</div>"; 280 } 281 } 282 283 $loading.fadeOut(100, function() { 284 $content.html($newItems); 285 $content.css("height", "auto"); 286 $content.stop().animate({ opacity: "1" }, 250); 287 }); 288 }, 289 error: function(MLHttpRequest, textStatus, errorThrown) { 290 console.log(errorThrown); 291 console.log(MLHttpRequest); 292 }, 293 complete: function(XMLHttpRequest, textStatus) { 294 console.log(textStatus); 295 }, 296 dataType: "json" 297 }); 298 }); 299 }; 300 301 /** 302 * Adds javascript hover effects 303 * @since v1.0 304 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 305 */ 306 $.fn.themewichHovers = function() { 307 function hover_overlay_slides() { 308 jQuery(".featured-image a").each(function() { 309 var $this = jQuery(this) 310 .parent() 311 .find("img"); 312 jQuery(this).hover( 313 function() { 314 $this.stop().animate({ opacity: 0.5 }, 250, "easeOutCubic"); 315 }, 316 function() { 317 $this.stop().animate({ opacity: 1 }, 250, "easeOutCubic"); 318 } 319 ); 320 }); 321 } 322 323 function hover_overlay_isotope() { 324 jQuery(".no-opacity a.postlink").each(function() { 325 // Hover Function 326 jQuery(this).hover( 327 function() { 328 jQuery(this) 329 .find(".overlay") 330 .stop() 331 .animate({ opacity: 0.75 }, 500, "easeOutCubic"); 332 }, 333 function() { 334 jQuery(this) 335 .find(".overlay") 336 .stop() 337 .animate({ opacity: 0 }, 500, "easeOutCubic"); 338 } 339 ); 340 }); 341 } 342 343 hover_overlay_isotope(); 344 345 function hover_overlay_portfolio() { 346 jQuery("a.thumblink").each(function() { 347 jQuery(this) 348 .closest(".featured-image") 349 .addClass("highlight") 350 .addClass("loaded") 351 .css({ "min-height": "0" }); 352 }); 353 } 354 355 function hide_loading() { 356 jQuery(".featured-image") 357 .not(".isobrick .featured-image") 358 .css({ background: "none", "min-height": "0" }); 359 } 360 361 (function($) { 362 $(window).load(function() { 363 hover_overlay_portfolio(); 364 hover_overlay_images(); 365 hide_loading(); 366 }); 367 })(jQuery); 368 369 function hover_overlay_images() { 370 jQuery("a img") 371 .not( 372 ".single-slideshow a img, .featured-image img, .ag_recentprojects_widget a img, .featuredimagewidget a img, .gallery a img, a img.fullimg, a img.fixedimg" 373 ) 374 .each(function() { 375 jQuery(this).hover( 376 function() { 377 var $this = jQuery(this) 378 .parent() 379 .children("img"); 380 jQuery($this) 381 .stop() 382 .animate({ opacity: 0.5 }, 250, "easeOutCubic"); 383 }, 384 function() { 385 var $this = jQuery(this) 386 .parent() 387 .children("img"); 388 jQuery($this) 389 .stop() 390 .animate({ opacity: 1 }, 250, "easeOutCubic"); 391 } 392 ); 393 }); 394 } 395 }; 396 397 /** 398 * Responsive slider object 399 * @type {class} 400 */ 401 var themewichSlider = { 402 createSlider: function(selector, callback) { 403 jQuery(selector).each(function(index) { 404 // Get Options from HTML 405 var $this = jQuery(this), 406 $info = $this.closest(".info"), 407 $touch = $info.hasClass("postphoto") ? false : true, 408 $window = jQuery(window), 409 autoPlay = $info.hasClass("autoplay") ? true : false, 410 pauseDelay = 5000, 411 custompager = $info.attr("data-pager") 412 ? $info.attr("data-pager") 413 : false, 414 pauseDelay = $info.attr("data-pause") 415 ? parseInt($info.attr("data-pause"), 10) 416 : pauseDelay, 417 pauseDelay = $info.hasClass("random") 418 ? Math.floor(Math.random() * 10001) + 3000 419 : pauseDelay, 420 speedDelay = $info.attr("data-speed") 421 ? parseInt($info.attr("data-speed"), 10) 422 : 500,
423 pagerOption = $info.attr("data-pager") == "false" ? false : true, 424 pagerOption = 425 $info.find(".bxslider li").length > 1 ? pagerOption : false, 426 controls = $info.hasClass("nocontrols") ? false : true, 427 customNext = $info.attr("data-next") ? $info.attr("data-next") : null, 428 customPrev = $info.attr("data-prev") ? $info.attr("data-prev") : null, 429 carousel = $info.hasClass("carousel") ? true : false, 430 moveSlides = $info.attr("data-moveslides") 431 ? $info.attr("data-moveslides") 432 : 0, 433 autoHover = $info.hasClass("hovergo") ? false : true, 434 homeslideshow = $info.hasClass("homeslideshow") ? true : false, 435 slideWidth = $info.attr("data-width") 436 ? $info.attr("data-width") 437 : 320, 438 slideMode = "fade", 439 infiniteLoop = $info.attr("data-loop") 440 ? $info.attr("data-loop") 441 : false, 442 slideMode = $info.hasClass("horizontal") ? "horizontal" : slideMode, 443 carouselMargin = $info.attr("data-space") 444 ? $info.attr("data-space") 445 : 0, 446 slideMode = $info.hasClass("vertical") ? "vertical" : slideMode, 447 adaptive = $info.hasClass("noadapt") ? false : true; 448 449 /** 450 * Carousel Slider 451 * @since v1.0 452 */ 453 function carouselSlider() { 454 var slideMargin = 4, 455 totalSlideWidth = slideWidth + slideMargin, 456 noWide = $("body").hasClass("full-width"); 457 458 $this.bxSlider({ 459 //Options 460 adaptiveHeight: adaptive, 461 minSlides: 1, 462 maxSlides: 9, 463 moveSlides: moveSlides, 464 auto: autoPlay, 465 speed: speedDelay, 466 pause: pauseDelay, 467 autoHover: autoHover, 468 infiniteLoop: infiniteLoop, 469 nextSelector: customNext, 470 prevSelector: customPrev, 471 nextText: '<i class="fa fa-angle-right"></i>', 472 prevText: '<i class="fa fa-angle-left"></i>', 473 slideWidth: slideWidth, 474 slideMargin: slideMargin, 475 pager: pagerOption, 476 controls: controls, 477 autoControls: false, 478 useCSS: false, //Chrome gets buggy with this enabled 479 touchEnabled: false, 480 captions: false, 481 preloadImages: "visible", 482 483 //After Slider Load 484 onSliderLoad: function() { 485 // Closest info container 486 $info = $this.closest(".info"); 487 488 // Fade in and add overlay effect 489 $this.animate({ opacity: 1 }, 500, "easeOutCubic"); 490 491 // Fade In Controls 492 $info.find(".bx-controls").animate({ opacity: 1 }, 500); 493 494 // Remove min-height and loading image 495 $this.animate({ opacity: 1 }, 500, function() { 496 $this.closest("div.info").css({ 497 "min-height": "100px", 498 background: "none" 499 }); 500 }); 501 502 // Fix popup issue with cloned slides 503 var $clones = $this.find(".gallery-icon.bx-clone"), 504 $noclones = $this 505 .find(".gallery-icon") 506 .not(".gallery-icon.bx-clone"); 507 508 $clones.click(function(e) { 509 var $clickedHref = $(this) 510 .find("a") 511 .attr("href"); 512 513 $noclones.each(function() { 514 var $link = $(this).find("a"); 515 if ($link.attr("href") == $clickedHref) { 516 $link.click(); 517 } 518 }); 519 e.preventDefault(); 520 }); 521 522 // Callback Function 523 if (callback && typeof callback === "function") { 524 callback(); 525 } 526 } 527 }); 528 } 529 530 /** 531 * Regular Slider 532 * @since v1.0 533 */ 534 function regularSlider() { 535 function titleHeight() { 536 var pager = $(".pagercontainer"), 537 carouselHeight = pager.outerHeight(), 538 slidetitle = pager 539 .closest(".pagetitleloading") 540 .find(".slidecaption, .slidereview"); 541 542 slidetitle.css({ 543 "padding-bottom": carouselHeight 544 }); 545 } 546 547 function burnsImage($slideElement, $oldIndex) { 548 var el = $slideElement.find("img.kanimate"); 549 550 if (el) { 551 var randx = 0 + Math.floor(Math.random() * 2), 552 randy = 0 + Math.floor(Math.random() * 2), 553 effect = "kenburns"; //initial effect
554 555 // Zoom in/out every other index 556 if ($oldIndex % 2 === 0) { 557 effect = "kenburns"; 558 } else { 559 effect = "kenburnsreverse"; 560 } 561 562 // Random zoom coordinates 563 randx = randx != 0 ? "100" : randx + ""; 564 565 el.removeClass("kanimate kenburnsreverse kenburns") // remove previous classes 566 .css({ 567 // set transform origins 568 "-webkit-transform-origin": randx + "% " + "100%", 569 "transform-origin": randx + "% " + "100%" 570 }); 571 572 el.offsetWidth = el.offsetWidth; // needed to reset the animation 573 574 // animate the element 575 setTimeout( 576 function() { 577 el.addClass(effect).addClass("kanimate"); 578 }.bind(this), 579 10 580 ); 581 } 582 } 583 584 function customPager(pagerCarousel, newIndex) { 585 var viewportWidth = $( 586 ".homeslideshow.carousel .bx-viewport" 587 ).width(), 588 thumbWidth = $(".homeslideshow.carousel li").outerWidth(), 589 visibleThumbs = Math.floor(viewportWidth / thumbWidth), 590 factor = newIndex / (visibleThumbs * (page + 1)); 591 // factor2 = oldIndex / (visibleThumbs-1*(page+1)); 592 593 if (factor % 1 == 0) { 594 if (newIndex == 0) { 595 page = 0; // Reset page 596 } else { 597 page++; 598 } 599 } 600 601 $(window).resize( 602 _.debounce(function() { 603 var viewportWidth = $( 604 ".homeslideshow.carousel .bx-viewport" 605 ).width(), 606 thumbWidth = $(".homeslideshow.carousel li").outerWidth(), 607 visibleThumbs = Math.floor(viewportWidth / thumbWidth); 608 }, 250) 609 ); 610 611 if (newIndex < visibleThumbs) { 612 pagerCarousel.goToSlide(0); 613 } 614 615 if (newIndex >= visibleThumbs && newIndex < visibleThumbs * 2) { 616 pagerCarousel.goToSlide(1); 617 } 618 619 if (newIndex >= visibleThumbs * 2 && newIndex < visibleThumbs * 3) { 620 pagerCarousel.goToSlide(2); 621 } 622 623 if (newIndex >= visibleThumbs * 3 && newIndex < visibleThumbs * 4) { 624 pagerCarousel.goToSlide(3); 625 } 626 627 if (newIndex >= visibleThumbs * 4 && newIndex < visibleThumbs * 5) { 628 pagerCarousel.goToSlide(3); 629 } 630 631 if (newIndex >= visibleThumbs * 5 && newIndex < visibleThumbs * 6) { 632 pagerCarousel.goToSlide(4); 633 } 634 } 635 636 var page = 0, 637 $pager = $this 638 .closest(".pagetitleloading") 639 .find(".bx-slider-pager"), 640 $pagerID = $pager.attr("id"), 641 pagerCarousel = $pager.bxSlider({ 642 minSlides: 2, 643 maxSlides: 4, 644 slideWidth: 270, 645 slideMargin: 10, 646 touchEnabled: false, 647 infiniteLoop: false, 648 hideControlOnEnd: true, 649 useCSS: false, //Chrome gets buggy with this enabled 650 pager: false, 651 //After Slider Load 652 onSliderLoad: function() { 653 titleHeight(); 654 } 655 }); 656 657 $this.bxSlider({ 658 // Options 659 adaptiveHeight: adaptive, 660 mode: slideMode, 661 auto: autoPlay, 662 speed: speedDelay, 663 pause: pauseDelay, 664 pager: pagerOption, 665 pagerCustom: custompager, 666 touchEnabled: false, 667 autoHover: autoHover, 668 controls: controls, 669 captions: false, 670 responsive: true, 671 preloadImages: "visible", 672 onSlideBefore: function($slideElement, oldIndex, newIndex) { 673 titleHeight(); // Set the title height 674 burnsImage($slideElement, oldIndex); // Set the kenburns animation effect 675 676 if (homeslideshow) { 677 customPager(pagerCarousel, newIndex); // Set custom pager 678 } 679 }, 680 onSliderLoad: function(currentIndex) { 681 titleHeight(); 682 683 $(window).focus(function() { 684 customPager(pagerCarousel, currentIndex); // Set custom pager 685 }); 686 687 var doit1; 688 window.onresize = function() { 689 titleHeight(); 690 }; 691 692 // Closest info container 693 $info = $this.closest(".info"); 694 695 //$this.closest('.pagetitleloading').css('min-height', 0); 696 697 // Fade In Controls 698 $info.find(".bx-controls").animate({ opacity: 1 }, 500); 699 700 // Remove min-height and loading image 701 $this.animate({ opacity: 1 }, 500, function() { 702 $this.closest("div.info").css({ 703 "min-height": "100px", 704 background: "none" 705 }); 706 }); 707 708 if (callback && typeof callback === "function") { 709 callback(); 710 } 711 } 712 }); 713 } 714 715 /** 716 * Centers the slide text vertically 717 * @param {selector} $info Selector for the slide options 718 * @return {void} 719 */ 720 function centerTextSlide($info) { 721 if ($info.hasClass("titlerotator") && $info.hasClass("noadapt")) { 722 var $maxheight = $this.closest(".pagetitle").height(); 723 $this.children("li").each(function() { 724 var $originalHeight = $(this).height(); 725 $(this).css("padding-top", ($maxheight - $originalHeight) / 2); 726 }); 727 } 728 } 729 730 /** 731 * Slider initialization 732 */ 733 if (carousel) { 734 carouselSlider(); 735 } else { 736 regularSlider(); 737 } 738 }); 739 } 740 }; 741 742 /** 743 * jQuery Isotope Class 744 * @since v1.0 745 */ 746 if (jQuery().isotope) { 747 var themewichIsotope = { 748 /** 749 * Regular fixed-column isotope 750 * @param {string} selector Container selector 751 * @param {Function} callback Callback function 752 * @since v1.0 753 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 754 */ 755 loadIsotope: function(selector, callback) { 756 jQuery(selector).each(function() { 757 var $this = $(this), 758 columnNumber = $this.attr("data-value"), 759 isoBrick = $(".isobrick"), 760 $body = $("body"), 761 $colnum2; 762 763 // Remove margins 764 isoBrick.css({ 765 "margin-left": 0, 766 "margin-right": 0 767 }); 768 769 /** 770 * Get column number 771 */ 772 function findColNum() { 773 // Get column number 774 if ($this.width() < 700) { 775 $colnum2 = 2; 776 } else { 777 $colnum2 = columnNumber; 778 } 779 } 780 781 /** 782 * Sets dynamic size of isotope brick 783 * @var brick selector 784 */ 785 function setBrickSize($isobrick) { 786 var columnWidth = $this.width() / $colnum2; 787 788 // Set width of each brick 789 $isobrick.not(".isobrick.noimages").each(function() { 790 var $brick = $(this), 791 $brickphoto = $brick.find(".postphoto"); 792 793 if ($brick.hasClass("big")) { 794 $brickphoto.css({ 795 "min-height": (columnWidth * 2 - 4) * 0.7566 + "px" 796 }); 797 } else if ($brick.hasClass("slim")) { 798 $brickphoto.css({ 799 "min-height": (columnWidth - 4) * 0.5 + "px" 800 }); 801 } else { 802 $brickphoto.css({ 803 "min-height": (columnWidth - 4) * 1.01063 + "px" 804 }); 805 } 806 }); 807 } 808 809 /** 810 * Run isotope plugin 811 */ 812 function callIsotope() { 813 // Call isotope with selected columns 814 if (columnNumber != "1") { 815 $this.isotope( 816 { 817 masonry: { 818 columnWidth: $this.width() / $colnum2 819 }, 820 itemSelector: ".isobrick", 821 layoutMode: "masonry" 822 }, 823 function() {} 824 ); 825 } 826 } 827 828 /** 829 * Call isotope functions in correct order 830 */ 831 function runIsotope() { 832 // Call Functions 833 findColNum(); 834 setBrickSize($this.find(".isobrick")); 835 callIsotope(); 836 837 // In case it fires too soon due to css3 animations 838 $this.bind( 839 "transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", 840 function() { 841 if ($this.hasClass("isotope")) { 842 $this.isotope("reLayout"); 843 } 844 } 845 ); 846 } 847 848 /** 849 * Run Isotope on load 850 */ 851 runIsotope(); 852 853 /** 854 * Run Isotope on Resize Event 855 */ 856 $(window).resize( 857 _.debounce(function() { 858 runIsotope(); 859 }, 250) 860 ); 861 862 /** 863 * Run isotope after images load 864 */ 865 $(window).load(function() { 866 runIsotope(); 867 }); 868 869 /** 870 * Filter link when clicked 871 * @return false 872 */ 873 $("#filters a, a.filtersort").click(function() { 874 $("#filters a").removeClass("active"); 875 876 var $selector = $(this).attr("data-filter"); 877 878 $("#filters a").each(function() { 879 var $filterselect = $(this).attr("data-filter"); 880 if ($filterselect == $selector) { 881 $(this).addClass("active"); 882 } 883 }); 884 885 $this.isotope({ filter: $selector }); 886 return false;
887 }); 888 889 // Callback 890 if (callback && typeof callback === "function") { 891 callback(); 892 } 893 }); // End Each 894 } 895 }; 896 } 897 898 /** 899 * Scroll to top function 900 * @param {string} selector Top selector 901 * @since v1.0 902 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 903 */ 904 $.fn.scrollToTop = function() { 905 var selector = this, 906 scroll_pos_test = 50; 907 908 $(window).scroll(function() { 909 var y_scroll_pos = window.pageYOffset, 910 windowWidth = $(window).width(); 911 912 if (y_scroll_pos > scroll_pos_test && windowWidth >= 1130) { 913 $(selector).fadeIn(500); 914 $(".iphone") 915 .children(selector) 916 .css("display", "none !important"); 917 } else { 918 $(selector).fadeOut(500); 919 } 920 }); 921 922 $(selector).click(function(e) { 923 $("html, body").animate({ scrollTop: 0 }, 500, "easeOutCubic"); 924 e.preventDefault(); 925 return false; 926 }); 927 }; 928 929 /** 930 * Hover Helper 931 * @param {string} selector Top selector 932 * @since v1.0 933 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 934 */ 935 $.fn.themewichHoverHelper = function() { 936 var $this = $(this), 937 $hoverHelper = $("p.hoverhelper") 938 .css("opacity", 0) 939 .empty(); 940 941 $this.each(function() { 942 $(this).hover( 943 function() { 944 var $hovertext = $(this).text(); 945 $hoverHelper 946 .stop() 947 .animate({ opacity: 0 }, 500, "easeOutCubic", function() { 948 $hoverHelper 949 .empty() 950 .text($hovertext) 951 .stop() 952 .animate({ opacity: 1 }, 500, "easeOutCubic"); 953 }); 954 }, 955 function() { 956 $hoverHelper.stop().animate({ opacity: 0 }, 500, "easeOutCubic"); 957 } 958 ); 959 }); 960 }; 961 962 /** 963 * Video Wrap Helper 964 * @since v1.0 965 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 966 */ 967 $.fn.addVideoWrap = function() { 968 $(".fluid-width-video-wrapper").wrap('<div class="fixed">'); 969 }; 970 971 /** 972 * Height Helper 973 * @param {string} selector element selector 974 * @since v1.0 975 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 976 */ 977 $.fn.heightHelper = function() { 978 var h = ""; 979 $(this).each(function() { 980 var $this = $(this), 981 w = $(this).width(); 982 if ($this.closest(".isobrick").hasClass("big")) { 983 h = w * 0.7566; 984 } else if ($this.hasClass("slim")) { 985 h = w * 0.5; 986 } else { 987 h = w * 1.01063; 988 } 989 $this.css({ "min-height": h + "px" }).attr("data-height", h); 990 }); 991 }; 992 993 /** 994 * Love It Button 995 * @since v1.0 996 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 997 */ 998 $.fn.themewichLove = function() { 999 var postlike = $(this); 1000 1001 // Prevent default 1002 postlike.click(function(e) { 1003 e.preventDefault(); 1004 }); 1005 1006 // Only run once per page load 1007 postlike.one("click", function(e) { 1008 e.preventDefault(); 1009 1010 var heart = $(this), 1011 post_id = heart.data("post_id"), 1012 counter = heart.find(".count"), 1013 title = heart.find(".sharetitle"), 1014 clicked = title.attr("data-clicked"); 1015 1016 // Add bouncing animation 1017 counter.addClass("bounceinfinite"); 1018 1019 jQuery.ajax({ 1020 type: "post", 1021 url: agAjax.ajaxurl, 1022 data: 1023 "action=post-like&nonce=" + 1024 agAjax.nonce + 1025 "&post_like=&post_id=" + 1026 post_id, 1027 success: function(count) { 1028 if (count != "already") { 1029 counter.removeClass("bounceinfinite"); 1030 title.html(clicked); 1031 heart.addClass("voted"); 1032 counter.text(count); 1033 } 1034 } 1035 }); 1036 1037 return false; 1038 }); 1039 }; 1040 1041 /** 1042 * Shares Counter 1043 * @since v1.0 1044 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 1045 */ 1046 $.fn.themewichShareCount = function() { 1047 var shareLink = $(this), 1048 shareButton = $(".sharing a.share"); 1049 1050 // Only run once per page load 1051 shareLink.on("click", function(e) { 1052 var post_id = shareButton.data("post_id"), 1053 shareCounter = shareButton.find(".count"), 1054 title = shareButton.find(".sharetitle"), 1055 clicked = title.attr("data-clicked"); 1056 1057 // Add bouncing animation 1058 shareCounter.addClass("bounceinfinite"); 1059 1060 jQuery.ajax({ 1061 type: "post", 1062 url: agAjax.ajaxurl, 1063 data: 1064 "action=post-share&nonce=" + 1065 agAjax.nonce + 1066 "&post_share=&post_id=" + 1067 post_id, 1068 success: function(count) { 1069 shareCounter.removeClass("bounceinfinite"); 1070 title.html(clicked); 1071 shareButton.addClass("shared"); 1072 shareCounter.text(count); 1073 } 1074 }); 1075 }); 1076 }; 1077 1078 /** 1079 * Make images fade in when into view 1080 * @since v1.0 1081 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 1082 */ 1083 $.fn.scollIntoView = function() { 1084 $(this).addClass("disappear"); 1085 1086 $(this).one("inview", function() { 1087 $(this).addClass("appear"); 1088 }); 1089
1090 function getViewportHeight() { 1091 var height = window.innerHeight; // Safari, Opera 1092 var mode = document.compatMode; 1093 1094 if (mode || !$.support.boxModel) { 1095 // IE, Gecko 1096 height = 1097 mode == "CSS1Compat" 1098 ? document.documentElement.clientHeight // Standards 1099 : document.body.clientHeight; // Quirks 1100 } 1101 1102 return height; 1103 } 1104 1105 $(window).scroll(function() { 1106 var vpH = getViewportHeight(), 1107 scrolltop = document.documentElement.scrollTop 1108 ? document.documentElement.scrollTop 1109 : document.body.scrollTop, 1110 elems = []; 1111 1112 // naughty, but this is how it knows which elements to check for 1113 $.each($.cache, function() { 1114 if (this.events && this.events.inview) { 1115 elems.push(this.handle.elem); 1116 } 1117 }); 1118 1119 if (elems.length) { 1120 $(elems).each(function() { 1121 var $el = $(this), 1122 top = $el.offset().top, 1123 height = $el.height(), 1124 inview = $el.data("inview") || false; 1125 1126 if (scrolltop > top + height || scrolltop + vpH < top) { 1127 if (inview) { 1128 $el.data("inview", false); 1129 $el.trigger("inview", [false]); 1130 } 1131 } else if (scrolltop < top + height) { 1132 if (!inview) { 1133 $el.data("inview", true); 1134 $el.trigger("inview", [true]); 1135 } 1136 } 1137 }); 1138 } 1139 }); 1140 1141 // kick the event to pick up any elements already in view. 1142 // note however, this only works if the plugin is included after the elements are bound to 'inview' 1143 1144 $(window).scroll(); 1145 }; 1146 1147 $.fn.parallaxScroll = function() { 1148 var windowVar = $(window); 1149 1150 $(this).each(function() { 1151 var $bgobj = $(this); // assigning the object 1152 1153 windowVar.scroll(function() { 1154 var yPos = windowVar.scrollTop() / 4; 1155 1156 // Put together our final background position 1157 var coords = yPos + "px"; 1158 1159 // Move the background 1160 $bgobj.css({ "margin-top": coords }); 1161 }); 1162 }); 1163 }; 1164 1165 $.fn.smoothScroll = function() { 1166 // SmoothScroll v0.9.9 1167 // Licensed under the terms of the MIT license. 1168 1169 // People involved 1170 // - Balazs Galambosi: maintainer (CHANGELOG.txt) 1171 // - Patrick Brunner ([email protected]) 1172 // - Michael Herf: ssc_pulse Algorithm 1173 function k() { 1174 if (document.body) { 1175 var a = document.body, 1176 b = document.documentElement, 1177 c = window.innerHeight, 1178 d = a.scrollHeight; 1179 m = 0 <= document.compatMode.indexOf("CSS") ? b : a; 1180 p = a; 1181 r = !0; 1182 top != self 1183 ? (s = !0) 1184 : d > c && 1185 (a.offsetHeight <= c || b.offsetHeight <= c) && 1186 ((m.style.height = "auto"), 1187 m.offsetHeight <= c && 1188 ((c = document.createElement("div")), 1189 (c.style.clear = "both"), 1190 a.appendChild(c))); 1191 t || 1192 ((a.style.backgroundAttachment = "scroll"), 1193 (b.style.backgroundAttachment = "scroll")); 1194 v && window.addEventListener("keydown", w, !1); 1195 } 1196 } 1197 function x(a, b, c) { 1198 var d; 1199 d || (d = 1e3); 1200 y(b, c); 1201 z.push({ 1202 x: b, 1203 y: c, 1204 a: 0 > b ? 0.99 : -0.99, 1205 b: 0 > c ? 0.99 : -0.99, 1206 start: +new Date() 1207 }); 1208 if (!A) { 1209 var e = function() { 1210 for (var u = +new Date(), l = 0, q = 0, n = 0; n < z.length; n++) { 1211 var f = z[n], 1212 g = u - f.start, 1213 C = g >= B, 1214 h = C ? 1 : g / B; 1215 D && 1216 ((g = h), 1217 1 <= g 1218 ? (h = 1) 1219 : 0 >= g 1220 ? (h = 0) 1221 : (1 == E && (E /= F(1)), (h = F(g)))); 1222 g = (f.x * h - f.a) >> 0; 1223 h = (f.y * h - f.b) >> 0; 1224 l += g; 1225 q += h; 1226 f.a += g; 1227 f.b += h; 1228 C && (z.splice(n, 1), n--); 1229 } 1230 b && 1231 ((u = a.scrollLeft), 1232 (a.scrollLeft += l), 1233 l && a.scrollLeft === u && (b = 0)); 1234 c && 1235 ((l = a.scrollTop), 1236 (a.scrollTop += q), 1237 q && a.scrollTop === l && (c = 0)); 1238 b || c || (z = []); 1239 z.length ? setTimeout(e, d / G + 1) : (A = !1); 1240 }; 1241 setTimeout(e, 0); 1242 A = !0; 1243 } 1244 } 1245 function H(a) { 1246 r || k(); 1247 var b = a.target, 1248 c = I(b); 1249 if ( 1250 !c || 1251 a.defaultPrevented || 1252 "embed" === p.nodeName.toLowerCase() || 1253 ("embed" === b.nodeName.toLowerCase() && /\.pdf/i.test(b.src)) 1254 ) 1255 return !0; 1256 var b = a.wheelDeltaX || 0, 1257 d = a.wheelDeltaY || 0; 1258 b || d || (d = a.wheelDelta || 0); 1259 1.2 < Math.abs(b) && (b *= J / 120); 1260 1.2 < Math.abs(d) && (d *= J / 120); 1261 x(c, -b, -d); 1262 a.preventDefault(); 1263 } 1264 function w(a) { 1265 var b = a.target, 1266 c = a.ctrlKey || a.altKey || a.metaKey; 1267 if ( 1268 /input|textarea|embed/i.test(b.nodeName) || 1269 b.isContentEditable || 1270 a.defaultPrevented || 1271 c || 1272 ("button" === b.nodeName.toLowerCase() && a.keyCode === K) 1273 ) 1274 return !0; 1275 var d; 1276 d = b = 0; 1277 var c = I(p), 1278 e = c.clientHeight; 1279 c == document.body && (e = window.innerHeight); 1280 switch (a.keyCode) { 1281 case L: 1282 d = -M; 1283 break; 1284 case N: 1285 d = M; 1286 break; 1287 case K: 1288 d = a.shiftKey ? 1 : -1; 1289 d = -d * e * 0.9; 1290 break; 1291 case O: 1292 d = 0.9 * -e; 1293 break; 1294 case P: 1295 d = 0.9 * e; 1296 break; 1297 case Q: 1298 d = -c.scrollTop; 1299 break; 1300 case R: 1301 e = c.scrollHeight - c.scrollTop - e; 1302 d = 0 < e ? e + 10 : 0; 1303 break; 1304 case S: 1305 b = -M; 1306 break; 1307 case T: 1308 b = M; 1309 break; 1310 default: 1311 return !0; 1312 } 1313 x(c, b, d); 1314 a.preventDefault(); 1315 } 1316 function U(a) { 1317 p = a.target; 1318 } 1319 function V(a, b) { 1320 for (var c = a.length; c--; ) W[X(a[c])] = b; 1321 return b; 1322 } 1323 function I(a) { 1324 var b = [], 1325 c = m.scrollHeight, 1326 overflow = "auto"; 1327 do { 1328 var d = W[X(a)]; 1329 if (d) return V(b, d); 1330 b.push(a); 1331 if (c === a.scrollHeight) { 1332 if (!s || m.clientHeight + 10 < c) return V(b, document.body); 1333 } else if ( 1334 a.clientHeight + 10 < a.scrollHeight && 1335 ((overflow = getComputedStyle(a, "").getPropertyValue("overflow")), 1336 "scroll" === overflow || "auto" === overflow) 1337 ) 1338 return V(b, a); 1339 } while ((a = a.parentNode)); 1340 } 1341 function y(a, b) { 1342 a = 0 < a ? 1 : -1; 1343 b = 0 < b ? 1 : -1; 1344 if (Y !== a || Z !== b) (Y = a), (Z = b), (z = []); 1345 } 1346 function F(a) { 1347 var b; 1348 a *= $; 1349 1 > a 1350 ? (b = a - (1 - Math.exp(-a))) 1351 : ((b = Math.exp(-1)), 1352 (a = 1 - Math.exp(-(a - 1))), 1353 (b += a * (1 - b))); 1354 return b * E; 1355 } 1356 var G = 150, 1357 B = 500, 1358 J = 150, 1359 D = !0, 1360 $ = 6, 1361 E = 1, 1362 v = !0, 1363 M = 50, 1364 s = !1, 1365 Y = 0, 1366 Z = 0, 1367 r = !1, 1368 t = !0, 1369 m = document.documentElement, 1370 p, 1371 S = 37, 1372 L = 38, 1373 T = 39, 1374 N = 40, 1375 K = 32, 1376 O = 33, 1377 P = 34, 1378 R = 35, 1379 Q = 36, 1380 z = [], 1381 A = !1, 1382 W = {}; 1383 setInterval(function() { 1384 W = {}; 1385 }, 1e4); 1386 var X = (function() { 1387 var a = 0; 1388 return function(b) { 1389 return b.c || (b.c = a++); 1390 }; 1391 })(); 1392 /chrome/.test(navigator.userAgent.toLowerCase()) && 1393 (window.addEventListener("mousedown", U, !1), 1394 window.addEventListener("mousewheel", H, !1), 1395 window.addEventListener("load", k, !1)); 1396 }; 1397 1398 /** 1399 * Home Ajax 1400 * @since v1.0 1401 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 1402 */ 1403 $.fn.themewichPaginationAjax = function() { 1404 function progressiveAnimate(items, reverse) { 1405 var i = 0; 1406 1407 if (reverse) { 1408 items = $(items.get().reverse()); 1409 } 1410 1411 items.each(function() { 1412 var $this = $(this); 1413 1414 if (reverse) { 1415 $this 1416 .stop() 1417 .delay(i + "") 1418 .fadeTo(150, 0); 1419 } else { 1420 $this 1421 .stop() 1422 .delay(i + "") 1423 .fadeTo(150, 1); 1424 } 1425 1426 i = i + 100; 1427 }); 1428 } 1429 1430 $(this).on("click", ".pagination a", function(e) { 1431 e.preventDefault(); // prevent default linking 1432 1433 var $this = $(this), // store this 1434 link = $this.attr("href"), // link url 1435 $viewport = $("html, body"), // to scroll viewport 1436 $pcontainer = $this.closest(".grid-wrapper, .regularwrapper"), // container to load 1437 postcontainer = $pcontainer.attr("id"), // specific container id 1438 $grid = $this.closest(".imagegrid, .regulargrid"), // grid wrapper
1439 $bricks = $pcontainer.find(".isobrick"), // individual bricks to fade 1440 $loader = $grid.find(".loading"), // loading animation 1441 $controls = $grid.find(".pagination"); // controls 1442 1443 ////////////////////////// 1444 // Animate the viewport // 1445 ////////////////////////// 1446 $viewport 1447 .animate({ scrollTop: $grid.offset().top - 40 }, 1700, "easeOutQuint") 1448 .bind("scroll mousedown DOMMouseScroll mousewheel keyup", function(e) { 1449 if ( 1450 e.which > 0 || 1451 e.type === "mousedown" || 1452 e.type === "mousewheel" 1453 ) { 1454 $viewport 1455 .stop() 1456 // This identifies the scroll as a user action, stops the animation, then unbinds the event straight after 1457 .unbind("scroll mousedown DOMMouseScroll mousewheel keyup"); 1458 } 1459 }); 1460 1461 // Swap Controls for Loading Animation 1462 $loader 1463 .stop() 1464 .delay(500) 1465 .fadeIn(500); 1466 $controls.fadeOut(500); 1467 1468 // Fade out the bricks 1469 progressiveAnimate($bricks, true); 1470 1471 /////////////////////// 1472 // Load new content // 1473 /////////////////////// 1474 $pcontainer.load(link + " #" + postcontainer + " .homeposts", function( 1475 responseTxt, 1476 statusTxt, 1477 xhr 1478 ) { 1479 if (statusTxt == "success") { 1480 var $this = $(this), 1481 $controls = $this.find(".pageflip, .pagination"), 1482 $bricks = $this.find(".isobrick"); 1483 1484 // Hide controls and bricks at start 1485 $controls.hide(); 1486 1487 $bricks.css("opacity", 0); 1488 1489 // animate bricks 1490 $this.imagesLoaded(function() { 1491 // Run isotope 1492 themewichIsotope.loadIsotope(".isotopecontainer"); 1493 1494 progressiveAnimate($bricks, false); 1495 1496 // Change top controls to pager 1497 $loader.stop().fadeOut(100, function() { 1498 $controls.stop().fadeIn(500); 1499 $pcontainer.find(".homeposts").themewichPaginationAjax(); // add ajax event only to loaded content 1500 }); 1501 }); 1502 } 1503 1504 // Error loggins 1505 if (statusTxt == "error") { 1506 console.log("Error: " + xhr.status + ": " + xhr.statusText); 1507 } 1508 }); 1509 }); 1510 }; 1511 1512 /** 1513 * Backstretch Functionality 1514 * @since v1.0 1515 * (c) Copyright 2013 Andre Gagnon - http://themewich.com 1516 */ 1517 $.fn.themewichBackStretch = function(container) { 1518 if ($.fn.backstretch) { 1519 $(this).each(function() { 1520 var $this = $(this), 1521 $url = $this.attr("src"), // Image 1522 $container = $this.closest(container); // Container 1523 1524 $this.remove(); 1525 if ($url.length) { 1526 $container.backstretch($url, { fade: 500 }); 1527 } 1528 }); 1529 } 1530 }; 1531 1532 $.fn.themewichSticky = function() { 1533 /** 1534 * Run sticky nav script if enabled 1535 */ 1536 if ($("body").hasClass("sticky-nav-enabled")) { 1537 var sticky_nav = $(".regular-nav .top-nav"), // regular nav selector 1538 alt_sticky_nav = $(".altnav .top-nav.altnav"), // alt nav selector 1539 mobilelink = $(".mobile-link"), 1540 useSticky = $("body").hasClass("safari") ? false : true; // mobile link 1541 1542 // Regular sticky nav 1543 sticky_nav.fixTo("body", { 1544 className: "mm-fixed-top is_stuck", 1545 mind: "#wpadminbar", // mind the top nav 1546 useNativeSticky: false, // turn off due to safari, firefox issues 1547 zIndex: 199 1548 }); 1549 1550 /** 1551 * Regular sticky navigation 1552 */ 1553 if (!sticky_nav.hasClass("stickyloaded") && sticky_nav.length) { 1554 // Add loaded indicator 1555 sticky_nav.addClass("stickyloaded"); 1556 $(window).resize(function() { 1557 sticky_nav.css({ 1558 height: "auto" 1559 }); 1560 sticky_nav.fixTo("refresh"); 1561 }); 1562 } 1563 1564 /** 1565 * Alternate sticky navigation 1566 */ 1567 if (!alt_sticky_nav.hasClass("stickyloaded") && alt_sticky_nav.length) { 1568 var $altcontainer = $(".altcontainer"); 1569 $altcontainer.addClass("stickyloaded"); 1570 $altcontainer.fixTo("body", { 1571 className: "mm-fixed-top is_stuck", 1572 mind: "#wpadminbar", // mind the admin bar
1573 useNativeSticky: false, // turn off due to safari, firefox issues 1574 zIndex: 199 1575 }); 1576 } 1577 } 1578 }; 1579 1580 $.fn.themewichStickySocial = function() { 1581 // Change mind if mobile 1582 function mindmobile() { 1583 if (mobilelink.is(":visible")) { 1584 social.fixTo("setOptions", { 1585 mind: "#wpadminbar" 1586 }); 1587 } else { 1588 social.fixTo("setOptions", { 1589 mind: 1590 ".top-nav.regular-nav.stickyloaded, .altcontainer.stickyloaded, #wpadminbar" // mind the top nav 1591 }); 1592 } 1593 } 1594 1595 var social = $(this), // sticky icons 1596 mobilelink = $(".mobile-link"), 1597 useSticky = $("body").hasClass("safari") ? false : true; // mobile link; // if it's a mobile layout 1598 1599 social.fixTo(".rightside", { 1600 className: "is_stuck", 1601 useNativeSticky: false, // turn off due to safari, firefox issues 1602 top: 5 1603 }); 1604 1605 mindmobile(); // set mind parameters 1606 $(window).resize( 1607 _.debounce(function() { 1608 mindmobile(); // reset on resize 1609 }, 250) 1610 ); 1611 }; 1612 1613 $.fn.menuAddition = function(searchform) { 1614 var mobileSearch = $(this), 1615 mobileSearchWrap = mobileSearch.closest(".mm-search"), 1616 desktopSearch = $(searchform), 1617 searchAction = desktopSearch.find("form").attr("action"), 1618 searchButton = desktopSearch.find("i").clone(); 1619 1620 // wrap search functionality 1621 mobileSearch 1622 .wrap( 1623 '<form method="get" action="' + 1624 searchAction + 1625 '" class="mobilesearch"></form>' 1626 ) 1627 .attr("name", "s"); 1628 1629 // add search button 1630 mobileSearchWrap.append(searchButton[0]); 1631 1632 // run 1633 mobileSearchWrap.searchSubmit(); 1634 }; 1635 1636 /** 1637 * Initialize all scripts here 1638 * 1639 * Comment out script lines to remove functionality 1640 */ 1641 $.fn.themewichScripts = function() { 1642 // Run theme plugins 1643 if ($.fn.magnificPopup) { 1644 $("body").themewichLightbox(); 1645 } 1646 if ($.fn.fitVids) { 1647 $("body").fitVids(); 1648 } 1649 1650 $("#mobilemenu").mmenu( 1651 { 1652 extensions: ["theme-dark"], 1653 classes: "mm-slide", 1654 offCanvas: { 1655 position: "right" 1656 }, 1657 clone: true, 1658 searchfield: { 1659 add: true, 1660 search: false 1661 } 1662 }, 1663 { 1664 pageSelector: ".mm-page" // use a custom static html div 1665 } 1666 ); 1667 1668 // create site search functionality 1669 $(".mm-search input").menuAddition(".search-form"); 1670 1671 if ($.fn.superfish) { 1672 $("ul.sf-menu") 1673 .not("ul.sf-menu#jPanelMenu-menu") 1674 .superfish({ cssArrows: true }); 1675 } 1676 if ($.fn.validate) { 1677 $("#contactform").validate(); 1678 $("#quickform").validate(); 1679 $("#commentsubmit").validate(); 1680 } 1681 if ($.fn.bxSlider && $("ul.bxslider").length) { 1682 $(window).load(function() { 1683 themewichSlider.createSlider("ul.bxslider"); 1684 }); 1685 } 1686 if ($.fn.isotope) { 1687 if ($(".isotopecontainer").length) { 1688 themewichIsotope.loadIsotope(".isotopecontainer"); 1689 } 1690 } 1691 1692 // Run the theme-specific functions 1693 $(".backgroundsize img.parallaximg").parallaxImg(); 1694 $("body").themewichSticky(); 1695 $(".sharingwrap.desktop-share").themewichStickySocial(); 1696 1697 $(".imagecover img").themewichBackStretch(".imagewrapper"); 1698 1699 // if ( ! $('body').hasClass('osx') ) { // disable for mac 1700 // $('body').smoothScroll(); 1701 // } 1702 1703 //$('.imagecover .full-bg-image').parallaxBGScroll(); 1704 $(".full-image .backstretch img").parallaxScroll(); 1705 $(".ajax-tabs a").ajaxLoadPosts(); 1706 $(".search-form").searchSubmit(); 1707 $("a.post-like").themewichLove(); 1708 $("#share-box a").themewichShareCount(); 1709 $("body").addVideoWrap(); 1710 $(".top").scrollToTop(); 1711 $("body").themewichHovers(); 1712 $(".controls a").themewichHoverHelper(); 1713 $(".homeposts").themewichPaginationAjax(); 1714 }; 1715 1716 $(document).ready(function() { 1717 $("body").themewichScripts(); 1718
1719 if (navigator.userAgent.search("Firefox") >= 0) { 1720 var ff_version = navigator.userAgent.match(/Firefox\/([\d]+\.[\d])+/); 1721 ff_version = parseFloat(ff_version[1]); 1722 if (ff_version == 0 || ff_version >= 59) { 1723 $("body").on("mousedown", ".bx-viewport a", function() { 1724 var ff_link = $(this); 1725 var ff_href = ff_link.attr("href"); 1726 if (ff_href) { 1727 location.href = ff_href; 1728 return false; 1729 } 1730 }); 1731 } 1732 } 1733 }); 1734})(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.