1 2var Bunyad_Theme = (function($) { 3 "use strict"; 4 5 var hasTouch = false, 6 responsive_menu = false; 7 8 // module 9 return { 10 11 init: function() 12 { 13 // posts grid 14 var grid = $('.posts-grid').data('grid-count'); 15 if (parseInt(grid) > 0) { 16 $('.posts-grid .column:nth-child(' + grid + 'n)').addClass('last'); 17 } 18 19 // fit videos to container 20 $('.featured-vid, .post-content').fitVids(); 21 22 // ratings 23 $('.rate-number').each(function() { 24 var raw = $(this).find('span:not(.progress)').html(), 25 progress = parseFloat(raw); 26 27 $(this).find('.progress').css('width', (raw.search('%') === -1 ? (Math.round(progress / 10 * 100)) + '%' : progress)) ; 28 }); 29 30 // social icons widget 31 $('.lower-foot .social-icons a, .share-links a').tooltip({placement: 'top'}); 32 $('.social-icons a').tooltip({placement: 'bottom'}); 33 34 // news focus block 35 $('.news-focus .subcats a').click(function() { 36 37 if ($(this).hasClass('active')) { 38 return false; 39 } 40 41 var active = $(this).parents('.subcats').find('a.active'), 42 parent = $(this).parents('.news-focus'); 43 44 // show the news and hide the other block 45 parent.find('.news-' + active.data('id')).hide(); 46 parent.find('.news-' + $(this).data('id')).fadeIn('slow'); 47 48 $(this).addClass('active'); 49 active.removeClass('active'); 50 51 return false; 52 }); 53 54 $('.modal').on('shown.bs.modal', function() { 55 $(this).css({ 56 'margin-top': function () { 57 return -($(this).height() / 2); 58 } 59 }); 60 }); 61 62 // login 63 $(document).on('click', '.user-login', function() { 64 65 $('.login-modal .modal-content').hide(); 66 $('.login-modal .main-screen').show(); 67 68 $('#login-modal').modal('show'); 69 70 return false; 71 }); 72 73 var change_modal = function(name) { 74 75 if (!$('.login-modal').is(':visible')) { 76 $('#login-modal').modal('show'); 77 } 78 79 $('.login-modal .modal-content').hide(); 80 $('.login-modal ' + name).show(); 81 82 return false; 83 84 }; 85 86 $('a.register-modal').click(function() { 87 return change_modal('.register-now'); 88 }); 89 90 $('a.lost-pass-modal').click(function() { 91 return change_modal('.lost-pass'); 92 }); 93 94 // setup all sliders 95 this.sliders(); 96 97 // handle shortcodes 98 this.shortcodes(); 99 100 // setup mobile navigation 101 this.responsive_nav(); 102 this.touch_nav(); 103 104 // start the news ticker 105 this.news_ticker(); 106 107 // setup the lightbox 108 this.lightbox(); 109 110 // use sticky navigation if enabled 111 this.sticky_nav(); 112 113 // user ratings 114 this.user_ratings(); 115 116 117 // infinite scroll if enabled 118 this.infinite_scroll(); 119 120 /** 121 * Image scroll animations 122 */ 123 $('.main img, .main-footer img').addClass('no-display'); 124 125 $('.main img, .main-footer img, .main-featured .row').one('inview', function() { 126 $(this).addClass('appear'); 127 }); 128 129 $('.review-box ul li .bar').each(function() { 130 $(this).data('width', $(this)[0].style.width).css('width', 0); 131 }); 132 133 $('.review-box ul li').one('inview', function() { 134 var bar = $(this).find('.bar'); 135 bar.addClass('appear').css('width', bar.data('width')); 136 }); 137 138 139 /** 140 * IE fixes 141 */ 142 if ($.browser.msie && 8 == parseInt($.browser.version)) { 143 144 $('.main img, .main-footer img').addClass('no-display'); 145 $('.main img, .main-footer img, .main-featured .row').unbind('inview'); 146 147 // fontawesome4 fails to draw sometimes on IE8 148 $(function() { 149 var $ss = $('#smartmag-font-awesome-css'); 150 $ss[0].href = $ss[0].href; 151 }); 152 153 // flickr widget fix - ie8 only 154 $('.flickr-widget .flickr_badge_image:nth-of-type(4n)').css('margin-right', 0); 155 156 // background image fix for IE8 157 var bg = $('body').css('background-attachment'), 158 bg_url = $('body').css('background-image').replace(/^url\((['"]?)(.*)\1\)$/, '$2'); 159 160 if (bg == 'fixed' && bg_url) { 161 162 $('body').append('<style type="text/css">.bg-overlay { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + bg_url + '\', sizingMethod=\'scale\'); \ 163 -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + bg_url + '\', sizingMethod=\'scale\')"; }</style>'); 164 165 $('<div class="bg-overlay"></div>').appendTo('body'); 166 } 167 168 // more lackluster ie8 169 $('.listing > .column:nth-child(odd)').css('clear', 'both'); 170 } 171 172 // add support for placeholder in IE8/IE9 173 $('input, textarea').placeholder(); 174 175 /** 176 * Mobile devices "background-attachment: fixed" support 177 */ 178 if ($(window).width() < 1128) { 179 180 var bg = $('body').css('background-attachment'), 181 bg_image = $('body').css('background-image'); 182 183 if (bg == 'fixed' && bg_image) { 184 $('body').css('background-image', 'none').append( 185 $('<div class="background-cover">' + '</div>').css('background-image', bg_image) 186 ); 187 } 188 } 189 190 /** 191 * Woocommerce 192 */ 193 $('.woocommerce-ordering .drop li a').click(function(e) { 194 var form = $(this).closest('form'); 195 196 form.find('[name=orderby]').val($(this).parent().data('value')); 197 form.submit(); 198 199 e.preventDefault(); 200 }); 201 202 $('body').on('added_to_cart', function() { 203 $('.menu .widget_shopping_cart').css('opacity', ''); 204 }); 205 206 if ($('.menu .cart_list .empty').length) { 207 $('.menu .cart_list').remove(); 208 } 209 210 // safari 5.x fix 211 if (!!navigator.userAgent.match('Safari/') && !!navigator.userAgent.match('Version/5.')) { 212 $('.navigation .menu ul, .navigation .mega-menu').css('-webkit-transition', 'none'); 213 } 214 215 // add android class 216 if (navigator.userAgent.match(/android/i)) { 217 $('body').addClass('android'); 218 } 219 220 }, 221 222 news_ticker: function() 223 { 224 $('.trending-ticker ul').each(function() { 225 226 if (!$(this).find('li.active').length) { 227 $(this).find('li:first').addClass('active'); 228 } 229 230 var ticker = $(this); 231 232 window.setInterval(function() { 233 234 var active = ticker.find('li.active'); 235 active.fadeOut(function() { 236 237 var next = active.next(); 238 if (!next.length) { 239 next = ticker.find('li:first'); 240 } 241 242 next.addClass('active').fadeIn(); 243 active.removeClass('active'); 244 }); 245 246 247 248 }, 8000); 249 }); 250 }, 251 252 responsive_nav: function() 253 { 254 // detect touch capability dynamically 255 $(window).on('touchstart', function() { 256 hasTouch = true; 257 $('body').addClass('touch'); 258 }); 259 260 this.init_responsive_nav(); 261 var that = this; 262 263 $(window).on('resize orientationchange', function() { 264 that.init_responsive_nav(); 265 }); 266 }, 267 268 /** 269 * Setup the responsive nav events and markup 270 */ 271 init_responsive_nav: function() { 272 273 if ($(window).width() > 799 || responsive_menu) { 274 return; 275 } 276 277 // set responsive initialized 278 responsive_menu = true; 279 280 // clone navigation for mobile 281 var clone = $('.navigation > div[class$="-container"]').clone().addClass('mobile-menu-container'), 282 mobile_search = false, 283 off_canvas = ($('.navigation .mobile').data('type') == 'off-canvas'); 284 285 // off-canvas setup? 286 if (off_canvas) { 287 clone.addClass('off-canvas');
288 clone.find('.menu').prepend($('<li class="close"><a href="#"><span>' + $('.navigation .selected .text').text() + '</span> <i class="fa fa-times"></i></a></li>')); 289 $('body').addClass('nav-off-canvas'); 290 } 291 292 clone.find('.menu').addClass('mobile-menu'); 293 clone.appendTo('.navigation'); 294 295 296 // mobile search? 297 if ($('.navigation .mobile').data('search')) { 298 mobile_search = true; 299 } 300 301 // register click handlers for mobile menu 302 $('.navigation .mobile .selected').click(function(e) { 303 304 // search active? 305 if ($(e.target).hasClass('hamburger') || !mobile_search || !$(this).find('.search .query').is(':visible')) { 306 307 if (off_canvas) { 308 $('.navigation .mobile-menu').addClass('active'); 309 $('body').toggleClass('off-canvas-active'); 310 } 311 else { 312 $('.navigation .mobile-menu').toggleClass('active'); 313 } 314 315 return false; 316 } 317 }); 318 319 // off-canvas close 320 $('.off-canvas .close').click(function() { 321 $('body').toggleClass('off-canvas-active'); 322 }); 323 324 325 // add mobile search 326 if (mobile_search && $('.top-bar .search').length) { 327 328 $('.navigation .mobile .selected').append($('.top-bar .search')[0].outerHTML); 329 $('.mobile .search .search-button').click(function() { 330 331 if (!$('.mobile .search .query').is(':visible')) { 332 $('.navigation .mobile .selected .current, .navigation .mobile .selected .text').toggle(); 333 $('.mobile .search').toggleClass('active'); 334 335 return false; 336 } 337 }); 338 } 339 340 // setup mobile menu click handlers 341 $('.navigation .mobile-menu li > a').each(function() { 342 343 if ($(this).parent().children('ul').length) { 344 $('<a href="#" class="chevron"><i class="fa fa-angle-down"></i></a>').appendTo($(this)); 345 } 346 }); 347 348 $('.navigation .mobile-menu li .chevron').click(function() { 349 $(this).closest('li').find('ul').first().toggle().parent().toggleClass('active item-active'); 350 return false; 351 }); 352 353 // add active item 354 var last = $('.mobile-menu .current-menu-item').last().find('> a'); 355 if (last.length) { 356 357 var selected = $('.navigation .mobile .selected'), 358 current = selected.find('.current'), 359 cur_text = selected.find('.text').text(); 360 361 if (cur_text.slice(-1) !== ':') { 362 selected.find('.text').text(cur_text + ':'); 363 } 364 365 current.text(last.text()); 366 } 367 }, 368 369 touch_nav: function() { 370 371 var targets = $('.menu:not(.mobile-menu) a'), 372 open_class = 'item-active', 373 child_tag = 'ul, .mega-menu'; 374 375 targets.each(function() { 376 377 var $this = $(this), 378 $parent = $this.parent('li'), 379 $siblings = $parent.siblings().find('a'); 380 381 $this.click(function(e) { 382 383 if (!hasTouch) { 384 return; 385 } 386 387 var $this = $(this); 388 e.stopPropagation(); 389 390 $siblings.parent('li').removeClass(open_class); 391 392 // has a child? open the menu on tap 393 if (!$this.parent().hasClass(open_class) && $this.next(child_tag).length > 0 && !$this.parents('.mega-menu.links').length) { 394 e.preventDefault(); 395 $this.parent().addClass(open_class); 396 } 397 }); 398 }); 399 400 // close all menus 401 $(document).click(function(e) { 402 if (!$(e.target).is('.menu') && !$(e.target).parents('.menu').length) { 403 targets.parent('li').removeClass(open_class); 404 } 405 }); 406 }, 407 408 sticky_nav: function() 409 { 410 var nav = $('.navigation'), 411 nav_top = nav.offset().top; 412 413 // not enabled? 414 if (!nav.data('sticky-nav')) { 415 return; 416 } 417 418 if (nav.find('.sticky-logo').length) { 419 nav.addClass('has-logo'); 420 } 421 422 var sticky = function() { 423 424 if (!nav.data('sticky-nav') || $(window).width() < 800) { 425 return; 426 } 427 428 // make it sticky when viewport is scrolled beyond the navigation 429 if ($(window).scrollTop() > nav_top) { 430 431 if (!nav.hasClass('sticky')) { 432 nav.addClass('sticky no-transition'); 433 434 setTimeout(function() { 435 nav.removeClass('no-transition'); 436 }, 100); 437 } 438 439 } else { 440 nav.removeClass('sticky'); 441 } 442 }; 443 444 sticky(); 445 446 $(window).scroll(function() { 447 sticky(); 448 }); 449 450 }, 451 452 /** 453 * Setup all the sliders available 454 */ 455 sliders: function() 456 { 457 if (!$.fn.flexslider) { 458 return; 459 } 460 461 var is_rtl = ($('html').attr('dir') == 'rtl' ? true : false); 462
463 // main slider 464 var slider = $('.main-featured .slider'); 465 466 $('.main-featured .flexslider').flexslider({ 467 controlNav: true, 468 animationSpeed: slider.data('animation-speed'), 469 animation: slider.data('animation'), 470 slideshowSpeed: slider.data('slide-delay'), 471 manualControls: '.main-featured .flexslider .pages a', 472 pauseOnHover: true, 473 start: function() { 474 $('.main-featured .slider').css('opacity', 1); 475 }, 476 rtl: is_rtl 477 }); 478 479 // main slider dynamic pagination - if not at default of 5 480 var pages = $('.main-featured .pages'), 481 number = parseInt(pages.data('number')); 482 483 if (number && number != 5) { 484 var width = (100 - ((number + 1) * 0.284900285)) / number; // 100 - (slides + 1 * margin-left) / slides 485 pages.find('a').css('width', width + '%'); 486 } 487 488 489 // carousels / galleries 490 $('.carousel').flexslider({ 491 animation: 'slide', 492 animationLoop: false, 493 itemWidth: 214, 494 itemMargin: 30, 495 minItems: 3, 496 maxItems: 4, 497 controlNav: false, 498 slideshow: false, 499 rtl: is_rtl 500 501 }); 502 503 $('.gallery-block .flexslider').flexslider({ 504 controlNav: false, 505 pauseOnHover: true, 506 rtl: is_rtl 507 }); 508 509 // for post-galleries 510 $('.gallery-slider .flexslider').flexslider({ 511 controlNav: false, 512 pauseOnHover: true, 513 rtl: is_rtl 514 }); 515 516 /** 517 * Post Content Slideshow: AJAX 518 */ 519 var slideshow_cache = {}, 520 slideshow_wrap = '.post-slideshow .post-pagination-next'; 521 522 if ($(slideshow_wrap).length && $(slideshow_wrap).data('type') == 'ajax') { 523 524 var processing; 525 526 $('.main-content').on('click', '.post-slideshow .post-pagination-next .links a', function() { 527 528 // showing on home-page? 529 if ($('body').hasClass('page')) { 530 return; 531 } 532 533 // abort existing request 534 if (processing && processing.hasOwnProperty('abort')) { 535 processing.abort(); 536 } 537 538 var parent = $(this).closest('.post-slideshow'), 539 url = $(this).attr('href'); 540 541 parent.find('.content-page').removeClass('active').addClass('hidden previous'); 542 543 var show_slide = function(data) { 544 545 // change browser url 546 if (history.pushState) { 547 history.pushState({}, '', url); 548 } 549 550 var page = $(data).find('.post-slideshow'); 551 552 if (page.length) { 553 parent.find('.post-pagination-next').html(page.find('.post-pagination-next').html()); 554 parent.find('.content-page').after(page.find('.content-page').addClass('hidden loading')); 555 556 setTimeout(function() { 557 parent.find('.content-page.previous').remove(); 558 parent.find('.content-page.loading').removeClass('previous hidden loading'); 559 }, 1); 560 } 561 562 processing = null; 563 564 }; 565 566 // in cache? 567 if (slideshow_cache[url]) { 568 show_slide(slideshow_cache[url]); 569 } 570 else { 571 572 // get via ajax 573 processing = $.get(url, function(data) { 574 slideshow_cache[url] = data; 575 show_slide(data); 576 577 }); 578 } 579 580 return false; 581 }); 582 583 // keyboard nav 584 $(document).on('keyup', function(e) { 585 if (e.which == 37) { 586 $(slideshow_wrap).find('.prev').parent().click(); 587 } 588 else if (e.which == 39) { 589 $(slideshow_wrap).find('.next').parent().click(); 590 } 591 }); 592 593 } // end slideshow wrap 594 595 }, 596 597 /** 598 * Register shortcode related events 599 */ 600 shortcodes: function() 601 { 602 // normal tabs 603 $('.tabs-list a').click(function() { 604 605 var tab = $(this).data('tab'), 606 tabs_data = $(this).closest('.tabs-list').siblings('.tabs-data'), 607 parent = $(this).parent().parent(), 608 active = parent.find('.active'); 609 610 if (!active.length) { 611 active = parent.find('li:first-child'); 612 } 613 614 active.removeClass('active').addClass('inactive'); 615 $(this).parent().addClass('active').removeClass('inactive'); 616 617 // hide current and show the clicked one 618 var active_data = tabs_data.find('.tab-posts.active'); 619 if (!active_data.length) { 620 active_data = tabs_data.find('.tab-posts:first-child'); 621 } 622 623 active_data.hide(); 624 625 tabs_data.find('#recent-tab-' + tab).fadeIn().addClass('active').removeClass('inactive'); 626 627 return false;
628 629 }); 630 631 /** 632 * Shortcode: Tabs 633 */ 634 $('.sc-tabs a').click(function() { 635 636 // tabs first 637 var tabs = $(this).parents('ul'); 638 tabs.find('.active').removeClass('active'); 639 $(this).parent().addClass('active'); 640 641 // panes second 642 var panes = tabs.siblings('.sc-tabs-panes'); 643 644 panes.find('.active').hide().removeClass('active'); 645 panes.find('#sc-pane-' + $(this).data('id')).addClass('active').fadeIn(); 646 647 return false; 648 }); 649 650 /** 651 * Shortcode: Accordions & Toggles 652 */ 653 $('.sc-accordion-title > a').click(function() { 654 655 var container = $(this).parents('.sc-accordions'); 656 container.find('.sc-accordion-title').removeClass('active'); 657 container.find('.sc-accordion-pane').slideUp().toggleClass('active'); 658 659 var pane = $(this).parent().next(); 660 if (!pane.is(':visible')) { 661 $(this).parent().addClass('active'); 662 pane.slideDown(); 663 } 664 665 return false; 666 }); 667 668 $('.sc-toggle-title > a').click(function() { 669 $(this).parent().toggleClass('active'); 670 $(this).parent().next().slideToggle().toggleClass('active'); 671 672 return false; 673 }); 674 675 }, 676 677 /** 678 * User Ratings handling 679 */ 680 user_ratings: function() 681 { 682 683 var compute_percent = function(e) { 684 var offset = $(this).offset(), 685 percent = Math.round((e.pageX - Math.max(0, offset.left)) / $(this).width() * 100); 686 687 return percent; 688 }; 689 690 // percent or points? 691 var is_points = true, 692 scale = parseInt($('.review-box .value-title').text()) || 10; 693 694 if ($('.review-box .overall .percent').length) { 695 is_points = false; 696 } 697 698 // update the bar and percent/points on hover 699 $('.user-ratings .main-stars, .user-ratings .rating-bar').on('mousemove mouseenter mouseleave', 700 function(e) { 701 702 // set main variables 703 var bar = $(this).find('span'), 704 user_ratings = $(this).closest('.user-ratings'); 705 706 bar.css('transition', 'none'); 707 708 if (user_ratings.hasClass('voted')) { 709 return; 710 } 711 712 // hover over? 713 if (e.type == 'mouseleave') { 714 bar.css('width', bar.data('orig-width')); 715 user_ratings.find('.hover-number').hide(); 716 user_ratings.find('.rating').show(); 717 return; 718 } 719 720 var percent = compute_percent.call(this, e); 721 722 if (!bar.data('orig-width')) { 723 bar.data('orig-width', bar[0].style.width); 724 } 725 726 bar.css('width', percent + '%'); 727 user_ratings.find('.rating').hide(); 728 user_ratings.find('.hover-number').show().text((is_points ? +parseFloat(percent / 100 * scale).toFixed(1) : percent + '%')); 729 } 730 ); 731 732 // add the rating 733 $('.user-ratings .main-stars, .user-ratings .rating-bar').on('click', function(e) { 734 735 // set main variables 736 var bar = $(this).find('span'), 737 user_ratings = $(this).closest('.user-ratings'); 738 739 if (user_ratings.hasClass('voted')) { 740 return; 741 } 742 743 // setup ajax post data 744 var post_data = { 745 'action': 'bunyad_rate', 746 'id': user_ratings.data('post-id'), 747 'rating': compute_percent.call(this, e) 748 }; 749 750 // get current votes 751 var votes = user_ratings.find('.number'), 752 cur_votes = parseInt(votes.text()) || 0; 753 754 user_ratings.css('opacity', '0.3'); 755 bar.data('orig-width', bar[0].style.width); 756 757 // add to votes and disable further voting 758 votes.text((cur_votes + 1).toString()); 759 760 $(this).trigger('mouseleave'); 761 user_ratings.addClass('voted'); 762 763 $.post(Bunyad.ajaxurl, post_data, function(data) { 764 765 // update data 766 if (data === Object(data)) { 767 768 // change rating 769 var cur_rating = user_ratings.find('.rating').text(); 770 user_ratings.find('.rating').text( cur_rating.search('%') !== -1 ? data.percent + ' %' : data.decimal ); 771 772 bar.css('width', data.percent + '%'); 773 bar.data('orig-width', data.percent); 774 } 775 776 user_ratings.hide().css('opacity', 1).fadeIn('slow'); 777 }, 'json'); 778 }); 779 }, 780 781 /** 782 * Infinite Scroll 783 */ 784 785 infinite_scroll: function() 786 { 787 // require jquery plugin 788 if (!$.fn.infinitescroll) { 789 return; 790 } 791 792 $('.listing-classic, .listing, .listing-alt, .list-timeline').filter(function() { if ($(this).data('infinite')) { return true; } }).each(function() { 793 var that = this, 794 data_sel = '[data-infinite="' + $(this).data('infinite') + '"]', 795 timeline = false, 796 instance, 797 opts; 798 799 // infinitescroll options 800 var options = { 801 loading: { 802 finishedMsg: '',
803 msg: $('<div class="ajax-loading"><div class="spinner"><span></span><span></span><span></span></div>') 804 }, 805 navSelector: '.main-pagination', 806 nextSelector: '.main-pagination .next', 807 itemSelector: data_sel + ' > .column,' + data_sel + ' > .post,' + data_sel + ' > .post,' + data_sel + ' > .month' 808 }; 809 810 // is timeline listing? 811 if ($(this).hasClass('list-timeline')) { 812 timeline = true; 813 options.appendCallback = false; 814 } 815 816 /** 817 * Main callback when data is loaded via $.infinitescroll 818 */ 819 var callback = function(data) { 820 821 // handle timeline listing 822 if (timeline == true) { 823 824 $(data).each(function() { 825 var month = $(this).data('month'), 826 existing = $(data_sel + ' .month[data-month="' + month + '"] .posts'); 827 828 // month container exists 829 if (existing.length) { 830 existing.append($(this).find('.posts article')); 831 } 832 else { 833 $(data_sel).append($(this)); 834 } 835 }); 836 } 837 838 // re-bind the inview image animations 839 $(that).find('img').addClass('no-display').one('inview', function() { 840 $(this).addClass('appear'); 841 }); 842 843 $(window).trigger('checkInView.inview'); 844 }; 845 846 // setup infinitescroll instance and set callbacks 847 instance = new $.infinitescroll(options, callback, this); 848 opts = instance.options; 849 850 // overwrite start event 851 opts.loading.start = function() { 852 853 $(opts.loading.msg).insertAfter(that).show(); 854 instance.beginAjax(opts); 855 }; 856 857 opts.errorCallback = function() { 858 $(opts.loading.msg).hide(); 859 }; 860 861 // hide pagination if valid infinite scroll page 862 if (!opts.state.isInvalidPage) { 863 $(this).parent().find('.main-pagination').hide(); 864 } 865 }); 866 867 }, 868 869 870 /** 871 * Setup prettyPhoto 872 */ 873 lightbox: function() { 874 875 // disabled on mobile screens 876 if (!$.fn.prettyPhoto || $(window).width() < 700) { 877 return; 878 } 879 880 var filter_images = function() { 881 882 if (!$(this).attr('href')) { 883 return false; 884 } 885 886 return $(this).attr('href').match(/\.(jpe?g|png|bmp|gif)$/); 887 }; 888 889 (function() { 890 var gal_id = 1; 891 892 $('.post-content a, .main .featured a').has('img').filter(filter_images).attr('rel', 'prettyPhoto'); 893 894 $('.gallery-slider, .post-content .gallery, .post-content .tiled-gallery').each(function() { 895 gal_id++; // increment gallery group id 896 897 $(this).find('a').has('img').filter(filter_images) 898 .attr('rel', 'prettyPhoto[gal_'+ gal_id +']'); 899 }); 900 901 $("a[rel^='prettyPhoto']").prettyPhoto({social_tools: false}); 902 903 })(); 904 905 // WooCommerce lightbox 906 $('a[data-rel^="prettyPhoto"], a.zoom').prettyPhoto({hook: 'data-rel', social_tools: false}); 907 908 } 909 }; // end return 910 911})(jQuery); 912 913// load when ready 914jQuery(function($) { 915 Bunyad_Theme.init(); 916}); 917 918 919/** 920 * Plugins and 3rd Party Libraries 921 */ 922 923/** 924 * Author Christopher Blum 925 * Based on the idea of Remy Sharp, http://remysharp.com/2009/01/26/element-in-view-event-plugin/ 926 * 927 * License: WTFPL 928 */ 929(function(b){function t(){var e,a={height:k.innerHeight,width:k.innerWidth};a.height||!(e=l.compatMode)&&b.support.boxModel||(e="CSS1Compat"===e?f:l.body,a={height:e.clientHeight,width:e.clientWidth});return a}function u(){var e=b(),g,q=0;b.each(m,function(a,b){var c=b.data.selector,d=b.$element;e=e.add(c?d.find(c):d)});if(g=e.length)for(d=d||t(),a=a||{top:k.pageYOffset||f.scrollTop||l.body.scrollTop,left:k.pageXOffset||f.scrollLeft||l.body.scrollLeft};q<g;q++)if(b.contains(f,e[q])){var h=b(e[q]),n=h.height(),p=h.width(),c=h.offset(),r=h.data("inview");if(!a||!d)break;c.top+n>a.top&&c.top<a.top+d.height&&c.left+p>a.left&&c.left<a.left+d.width?(p=a.left>c.left?"right":a.left+d.width<c.left+p?"left":"both",n=a.top>c.top?"bottom":a.top+d.height<c.top+n?"top":"both",c=p+"-"+n,r&&r===c||h.data("inview",c).trigger("inview",[!0,p,n])):r&&h.data("inview",!1).trigger("inview",[!1])}}var m={},d,a,l=document,k=window,f=l.documentElement,s=b.expando,g;b.event.special.inview={add:function(a){m[a.guid+"-"+this[s]]={data:a,$element:b(this)};g||b.isEmptyObject(m)||(g=setInterval(u,250))},remove:function(a){try{delete m[a.guid+"-"+this[s]]}catch(d){}b.isEmptyObject(m)&&(clearInterval(g),g=null)}};b(k).bind("scroll resize",function(){d=a=null});!f.addEventListener&&f.attachEvent&&f.attachEvent("onfocusin",function(){a=null})})(jQuery); 930 931/** 932* Bootstrap.js by @fat & @mdo 933* plugins: bootstrap-tooltip.js 934* Copyright 2012 Twitter, Inc. 935* http://www.apache.org/licenses/LICENSE-2.0.txt 936*/ 937!function(a){var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger=="click"?this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this)):this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f+"."+this.type,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b}
937,enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!c.options.delay||!c.options.delay.hide)return c.hide();c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.detach().css({top:0,left:0,display:"block"}).insertAfter(this.$element),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.offset(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).detach()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.detach()})}var b=this,c=this.tip();return c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.detach(),this},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);c[c.tip().hasClass("in")?"hide":"show"]()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0,html:!1},a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(window.jQuery); 938 939/** 940* Bootstrap.js by @fat & @mdo 941* plugins: bootstrap-modal.js 942* Copyright 2013 Twitter, Inc. 943* http://www.apache.org/licenses/LICENSE-2.0.txt 944*/ 945!function(a){var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.backdrop(function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in").attr("aria-hidden",!1),b.enforceFocus(),c?b.$element.one(a.support.transition.end,function(){b.$element.focus().trigger("shown")}):b.$element.focus().trigger("shown")})},hide:function(b){b&&b.preventDefault();var c=this;b=a.Event("hide"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,this.escape(),a(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),a.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var b=this;a(document).on("focusin.modal",function(a){b.$element[0]!==a.target&&!b.$element.has(a.target).length&&b.$element.focus()})},escape:function(){var a=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(b){b.which==27&&a.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),b.hideModal()},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),b.hideModal()})},hideModal:function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.$backdrop.click(this.options.backdrop=="static"?a.proxy(this.$element[0].focus,this.$element[0]):a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!b)return;e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b):b()):b&&b()}};var c=a.fn.modal;a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f).one("hide",function(){c.focus()})})}(window.jQuery); 946 947/* 948 * FitVids 1.0.3 - Modified - https://github.com/davatron5000/FitVids.js 949 */ 950(function(e){"use strict";e.fn.fitVids=function(t){var n={customSelector:null};if(!document.getElementById("fit-vids-style")){var r=document.head||document.getElementsByTagName("head")[0];var i=".fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}";var s=document.createElement("div");s.innerHTML='<p>x</p><style id="fit-vids-style">'+i+"</style>";r.appendChild(s.childNodes[1])}if(t){e.extend(n,t)}return this.each(function(){var t=["iframe[src*='player.vimeo.com']","iframe[src*='youtube.com']","iframe[src*='youtube-nocookie.com']","iframe[src*='kickstarter.com'][src*='video.html']","object","embed"];if(n.customSelector){t.push(n.customSelector)}var r=e(this).find(t.join(","));r=r.not("object object");r.each(function(){var t=e(this);if(this.tagName.toLowerCase()==="embed"&&t.parent("object").length||t.parent(".fluid-width-video-wrapper").length){return}var n=this.tagName.toLowerCase()==="object"||t.attr("height")&&!isNaN(parseInt(t.attr("height"),10))?parseInt(t.attr("height"),10):t.height(),r=!isNaN(parseInt(t.attr("width"),10))?parseInt(t.attr("width"),10):t.width(),i=n/r;if(!t.attr("id")){var s="fitvid"+Math.floor(Math.random()*999999);t.attr("id",s)}t.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",i*100+"%");t.removeAttr("height").removeAttr("width")})})}})(window.jQuery||window.Zepto); 951 952 953/*! http://mths.be/placeholder v2.0.7 by @mathias */ 954(function(q,f,d){function r(b){var a={},c=/^jQuery\d+$/;d.each(b.attributes,function(b,d){d.specified&&!c.test(d.name)&&(a[d.name]=d.value)});return a}function g(b,a){var c=d(this);if(this.value==c.attr("placeholder")&&c.hasClass("placeholder"))if(c.data("placeholder-password")){c=c.hide().next().show().attr("id",c.removeAttr("id").data("placeholder-id"));if(!0===b)return c[0].value=a;c.focus()}else this.value="",c.removeClass("placeholder"),this==m()&&this.select()}function k(){var b,a=d(this),c=this.id;if(""==this.value){if("password"==this.type){if(!a.data("placeholder-textinput")){try{b=a.clone().attr({type:"text"})}catch(e){b=d("<input>").attr(d.extend(r(this),{type:"text"}))}b.removeAttr("name").data({"placeholder-password":a,"placeholder-id":c}).bind("focus.placeholder",g);a.data({"placeholder-textinput":b,"placeholder-id":c}).before(b)}a=a.removeAttr("id").hide().prev().attr("id",c).show()}a.addClass("placeholder");a[0].value=a.attr("placeholder")}else a.removeClass("placeholder")}function m(){try{return f.activeElement}catch(b){}}var h="placeholder"in f.createElement("input"),l="placeholder"in f.createElement("textarea"),e=d.fn,n=d.valHooks,p=d.propHooks;h&&l?(e=e.placeholder=function(){return this},e.input=e.textarea=!0):(e=e.placeholder=function(){this.filter((h?"textarea":":input")+"[placeholder]").not(".placeholder").bind({"focus.placeholder":g,"blur.placeholder":k}).data("placeholder-enabled",!0).trigger("blur.placeholder");return this},e.input=h,e.textarea=l,e={get:function(b){var a=d(b),c=a.data("placeholder-password");return c?c[0].value:a.data("placeholder-enabled")&&a.hasClass("placeholder")?"":b.value},set:function(b,a){var c=d(b),e=c.data("placeholder-password");if(e)return e[0].value=a;if(!c.data("placeholder-enabled"))return b.value=a;""==a?(b.value=a,b!=m()&&k.call(b)):c.hasClass("placeholder")?g.call(b,!0,a)||(b.value=a):b.value=a;return c}},h||(n.input=e,p.value=e),l||(n.textarea=e,p.value=e),d(function(){d(f).delegate("form","submit.placeholder",function(){var b=d(".placeholder",this).each(g);setTimeout(function(){b.each(k)},10)})}),d(q).bind("beforeunload.placeholder",function(){d(".placeholder").each(function(){this.value=""})}))})(this,document,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.