1var JS_PATH = "js"; 2 3(function($){ 4 5 "use strict"; 6 7 var themeData = []; 8 var parallaxImages = []; 9 10 //window 11 themeData.win = $(window); 12 themeData.winHeight = themeData.win.height(); 13 themeData.winScrollTop = themeData.win.scrollTop(); 14 themeData.winHash = window.location.hash.replace('#', ''); 15 themeData.stateObject = {}; 16 17 //document 18 themeData.doc = $(document); 19 themeData.docHeight = themeData.doc.height(); 20 21 //ID A~Z 22 themeData.backTop = $('#back-top'); 23 themeData.footer = $('#footer'); 24 themeData.headerWrap = $('#header'); 25 themeData.header = $('#header-main'); 26 themeData.MenuOverPanel = $('#mobile-panel'); 27 themeData.MenuOverTrigger = $('#navi-trigger'); 28 themeData.jplayer = $('#jquery_jplayer'); 29 themeData.logo = $('.navi-logo'); 30 themeData.navi = $('#navi'); 31 themeData.container = $('#wrap'); 32 themeData.WrapOurter = $('#wrap-outer'); 33 themeData.searchOpen = $('.search-top-btn-class'); 34 themeData.socialHeader = $('#social-header-out'); 35 themeData.contentWrap = $('#content_wrap'); 36 themeData.TopsliderTrggleDown = $('#ux-slider-down'); 37 38 //tag 39 themeData.body = $('body'); 40 41 //tag class 42 themeData.carousel = $('.owl-carousel'); 43 themeData.uxResponsive = $('body.responsive-ux'); 44 themeData.headerNaviMenu = themeData.header.find('#navi ul.menu'); 45 themeData.galleryCollage = $('section.Collage'); 46 47 //class 48 themeData.audioUnit = $('.audio-unit'); 49 themeData.pageLoading = $('.page-loading'); 50 themeData.lightboxPhotoSwipe = $('.lightbox-photoswipe'); 51 themeData.Menu = $('.menu'); 52 themeData.pagenumsDefault = $('.pagenums-default'); 53 themeData.tooltip = $('.tool-tip'); 54 themeData.searchForm = $('.search-overlay-form'); 55 themeData.titlecon = $('.title-wrap-con'); 56 themeData.isotope = $('.container-masonry'); 57 themeData.isotope_filter = themeData.isotope.find('.filters'); 58 59 themeData.videoFace = $('.blog-unit-img-wrap, .archive-item'); 60 themeData.videoOverlay = $('.video-overlay'); 61 62 themeData.blogPagenumsTwitter = $('.blog-list .pagenums.page_twitter a'); 63 themeData.blogPagenumsSelect = $('.blog-list .pagenums .select_pagination, .magzine-list .pagenums .select_pagination'); 64 65 themeData.listLayout = $('.list-layout'); 66 themeData.singleGalleryFilled = $('.single-gallery-wrap-inn[data-style="filled"]'); 67 themeData.singleGalleryListWrap = $('.ux-portfolio-ajaxed-list-wrap'); 68 themeData.singleGalleryList = $('.ux-portfolio-ajaxed-list'); 69 70 //define 71 themeData.globalFootHeight = 0; 72 themeData.itemParallax = []; 73 74 var footer_visible = false; 75 var resizeTimer = null; 76 77 //condition 78 themeData.isResponsive = function(){ 79 if(themeData.uxResponsive.length){ 80 return true; 81 }else{ 82 return false; 83 } 84 } 85 86 var switchWidth = 767; 87 88 89 themeData.isMobile = function(){ 90 if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || themeData.win.width() < switchWidth){ 91 return true; 92 }else{ 93 return false; 94 } 95 } 96 97 var ios = navigator.userAgent.match(/(iPod|iPhone|iPad)/); 98 99 function get_browser(){ 100 var ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; 101 if(/trident/i.test(M[1])){ 102 tem=/\brv[ :]+(\d+)/g.exec(ua) || []; 103 return {name:'IE',version:(tem[1]||'')}; 104 } 105 if(M[1]==='Chrome'){ 106 tem=ua.match(/\bOPR\/(\d+)/) 107 if(tem!=null) {return {name:'Opera', version:tem[1]};} 108 } 109 M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; 110 if((tem=ua.match(/version\/(\d+)/i))!=null) {M.splice(1,1,tem[1]);} 111 return { 112 name: M[0], 113 version: M[1] 114 }; 115 } 116 117 var ux_browser = get_browser(); 118 119 themeData.body.addClass(ux_browser.name + ux_browser.version); 120 121 //Resign Velocity custom aniamtion effect - for menu icon 122 $.Velocity.RegisterEffect("scaleXin", { 123 defaultDuration: 100,
124 calls: [ 125 [ { scaleX: 1.333 } ] 126 ] 127 }); 128 129 130 //Function 131 132 // Top slider Triggle Down Click 133 themeData.TopsliderTrggleDownFn = function(){ 134 135 var _border = 0; 136 137 if ($('.border10px').length) { 138 _border = 20; 139 } else if ($('.border20px').length) { 140 _border = 40; 141 } else if ($('.border30px').length) { 142 _border = 60; 143 } else if ($('.border40px').length) { 144 _border = 80; 145 } 146 147 var _win_real_h = themeData.win.height() - _border; 148 149 themeData.TopsliderTrggleDown.on({'touchstart click': function(){ 150 $('html, body').animate({scrollTop:_win_real_h}, 400); 151 }}); 152 } 153 154 //Calc Fullscreen wrap / slider Height 155 themeData.fnFullscreenWrapHeight = function(){ 156 if (!Modernizr.cssvhunit) { 157 if($('.fullscreen-wrap').length) { 158 $('.fullscreen-wrap').each(function(){ 159 $(this).css('height',themeData.win.height()); 160 }); 161 } 162 } 163 } 164 165 // Top slider 166 themeData.carouselFn = function(carouselWrap){ 167 168 carouselWrap.each(function(){ 169 170 var 171 _carousel = $(this), 172 _margin = $(this).data('margin'), 173 _center = $(this).data('center'), 174 _item = $(this).data('item'), 175 _autoW = $(this).data('autowidth'), 176 _slideby = $(this).data('slideby'), 177 _auto = $(this).data('auto'), 178 _showdot = $(this).data('showdot'), 179 _shownav = $(this).data('nav'), 180 _animateIn = $(this).data('animatein'), 181 _animateOut = $(this).data('animateout'), 182 _loop = $(this).data('loop'), 183 _lazyLoad = $(this).data('lazy'); 184 185 setTimeout(function(){ 186 if(_lazyLoad){ 187 188 if(themeData.body.hasClass('single-portfolio-fullwidth-slider')){ 189 _carousel.on('refreshed.owl.carousel', function (e) { 190 _carousel.find('.owl-item').each(function(){ 191 if($(this).hasClass('cloned')){ 192 var data_src = $(this).find('img').data('src'); 193 $(this).find('img').attr('src', data_src); 194 } 195 });
196 }); 197 } 198 199 } 200 _carousel.owlCarousel({ 201 margin: _margin, 202 loop: _loop, 203 autoWidth:_autoW, 204 center: _center, 205 animateIn: _animateIn, 206 animateOut: _animateOut, 207 slideSpeed : 300, 208 paginationSpeed : 400, 209 items: _item, 210 autoplay: _auto, 211 autoplayTimeout:5000, 212 responsiveClass:true, 213 navText:["",""], 214 slideBy:_slideby, 215 dots:_showdot, 216 nav:_shownav, 217 responsive:{ 218 0:{ 219 items:_item, 220 margin:0, 221 nav:_shownav 222 }, 223 481:{ 224 items:_item, 225 margin:10, 226 nav:_shownav 227 }, 228 1024:{ 229 items:_item, 230 margin: _margin, 231 nav:_shownav 232 } 233 } 234 }); 235 236 if(themeData.body.hasClass('single-portfolio-fullscreen-slider')){ 237 _carousel.on('mousewheel', '.owl-stage', function (e) { 238 if(themeData.win.scrollTop() == 0){ 239 if (e.deltaY>0) { 240 _carousel.trigger('prev.owl'); 241 } else { 242 _carousel.trigger('next.owl'); 243 } 244 e.preventDefault(); 245 } 246 }); 247 } 248 249 if(_lazyLoad){ 250 _carousel.on('translated.owl.carousel', function(event){ 251 if(Number(_item) > 1){ 252 var current_items = $(event.target).find('.owl-item.active, .owl-item.cloned'); 253 current_items.each(function(){ 254 var current_item = $(this); 255 var current_item_img = current_item.find('img'); 256 var current_item_img_bg = current_item_img.attr('data-src'); 257 258 if(current_item_img_bg){ 259 current_item_img.addClass('lazy-loaded').attr('src', current_item_img_bg); 260 current_item_img.removeAttr('data-src'); 261 } 262 }); 263 }else{ 264 var current_item = $(event.target).find('.owl-item.active'); 265 var current_item_img = current_item.find('.carousel-img-wrap'); 266 var current_item_img_bg = current_item_img.attr('data-bg'); 267 268 if(current_item_img_bg){ 269 current_item_img.addClass('lazy-loaded').css('background-image', 'url("' +current_item_img_bg+ '")'); 270 current_item_img.removeAttr('data-bg'); 271 } 272 } 273 }) 274 } 275 276 },10) 277 278 279 }); 280 } 281 282 //Search show 283 themeData.fnSerchShow = function(){ 284 285 var 286 _search_btn = themeData.searchOpen.find('.fa-search'), 287 _search_form = _search_btn.siblings('form'); 288 289 _search_btn.click(function(){ 290 291 if(_search_form.hasClass('search_top_form_shown')){ 292 _search_form.removeClass('search_top_form_shown'); 293 _search_form.find('.search_top_form_text').blur(); 294 $('.menu-panel-bottom-right').css('opacity','1'); 295 } else { 296 _search_form.addClass('search_top_form_shown'); 297 _search_form.find('.search_top_form_text').focus(); 298 $('.menu-panel-bottom-right').css('opacity','0'); 299 } 300 return false; 301 302 }); 303 304 } 305 306 //Responsive Mobile Menu function 307 themeData.fnResponsiveMenu = function(){ 308 309 if(themeData.win.width() > switchWidth) { 310 themeData.body.removeClass('ux-mobile'); 311 } else { 312 themeData.body.addClass('ux-mobile'); 313 } 314 315 themeData.win.resize(function(){ 316 317 if(themeData.win.width() > switchWidth) { 318 themeData.body.removeClass('ux-mobile'); 319 } else { 320 themeData.body.addClass('ux-mobile'); 321 } 322 323 }); 324 325 if(themeData.MenuOverTrigger.length){ 326 themeData.MenuOverTrigger.velocity("transition.fadeIn"); 327 328 themeData.MenuOverTrigger.hover(function(){ 329 $('.navi-trigger-hamberg-line').velocity("scaleXin", { stagger: 100 }); 330 },function(){ 331 $('.navi-trigger-hamberg-line').velocity({ scaleX : 1 }); 332 }); 333 } 334 335 if($('#woocomerce-cart-side').length) { 336 $('#woocomerce-cart-side').velocity("transition.fadeIn"); 337 } 338 339 var $post_logo_color = false; 340 341 if(themeData.body.hasClass('light-logo')){ 342 $post_logo_color = 'light-logo'; 343 } else if(themeData.body.hasClass('dark-logo')){ 344 $post_logo_color = 'dark-logo'; 345 } 346 347 themeData.MenuOverTrigger.click(function(){ 348 349 if(themeData.body.is('.show_mobile_menu')){ 350 $('body.phone #navi-telefon').show(); 351 setTimeout(function() { 352 if(themeData.body.hasClass('show_mobile_menu')) { 353 themeData.body.removeClass('show_mobile_menu'); 354 } 355 356 setTimeout(function() { 357 themeData.body.addClass($post_logo_color); 358 },1000); 359 360 if($('#navi-wrap .sub-menu').length) { 361 $('#navi-wrap .sub-menu').velocity("transition.fadeOut"); 362 $('#navi-wrap .sub-menu').siblings('a').css('display','inline-block'); 363 $('#navi-wrap > ul > li').velocity("transition.fadeIn"); 364 } 365 366 if(themeData.footer.length) { 367 if(!footer_visible) { 368 setTimeout(function() { 369 themeData.footer.css('visibility','visible'); 370 },200);
371 footer_visible = true; 372 } 373 } 374 },10); 375 376 }else{ 377 $('body.phone #navi-telefon').hide(); 378 setTimeout(function() { 379 if(!themeData.body.hasClass('show_mobile_menu')) { 380 if(themeData.win.scrollTop() > 1){ 381 $('html, body').animate({scrollTop:0}, 200,function(){ 382 themeData.body.addClass('show_mobile_menu'); 383 }); 384 } else { 385 themeData.body.addClass('show_mobile_menu'); 386 } 387 } 388 389 setTimeout(function() { 390 if(themeData.body.hasClass('light-logo')){ 391 themeData.body.removeClass('light-logo'); 392 } 393 if(themeData.body.hasClass('dark-logo')){ 394 themeData.body.removeClass('dark-logo'); 395 } 396 },1000); 397 398 if(themeData.footer.length) { 399 if(footer_visible) { 400 themeData.footer.css('visibility','hidden'); 401 footer_visible = false; 402 } 403 } 404 },10); 405 } 406 return false; 407 }); 408 409 window.addEventListener('scroll', function() { 410 411 if(themeData.body.is('.show_mobile_menu')){ 412 if(themeData.win.scrollTop() > 200){ 413 setTimeout(function() { 414 themeData.body.addClass($post_logo_color); 415 },1000); 416 setTimeout(function() { 417 themeData.body.removeClass('show_mobile_menu'); 418 if(themeData.footer.length) { 419 if(!footer_visible) { 420 setTimeout(function() { 421 themeData.footer.css('visibility','visible'); 422 },200); 423 footer_visible = true; 424 } 425 } 426 if($('#navi-wrap .sub-menu').length) { 427 $('#navi-wrap .sub-menu').velocity("transition.fadeOut"); 428 $('#navi-wrap .sub-menu').siblings('a').css('display','inline-block'); 429 $('#navi-wrap > ul > li').velocity("transition.fadeIn"); 430 } 431 },10); 432 } 433 } 434 }, false); 435 436 if(themeData.navi.length) { 437 themeData.fnSubMenu(); 438 } 439 440 } 441 442 //Back top 443 themeData.fnBackTop = function(){ 444 445 themeData.win.find('img').imagesLoaded(function(){ 446 447 themeData.win.scroll(function(){ 448 449 if(themeData.win.scrollTop() > 200){ 450 if(!themeData.backTop.hasClass('backtop-shown')) { 451 themeData.backTop.addClass('backtop-shown'); 452 } 453 } else { 454 if(themeData.backTop.hasClass('backtop-shown')) { 455 themeData.backTop.removeClass('backtop-shown'); 456 } 457 } 458 }); 459 460 var BacktopBottom = themeData.footer.find('.footer-info').height() - 50; 461 462 }); 463 464 } 465 466 //Video cover title show & hide 467 themeData.fnVideocoverTitle = function(){ 468 469 themeData.win.scroll(function(){ 470 themeData.winScrollTop = themeData.win.scrollTop(); 471 if(themeData.winScrollTop > 100){ 472 if(!themeData.titlecon.hasClass('witle-wrap-con-shown')) { 473 themeData.titlecon.addClass('witle-wrap-con-shown'); 474 } 475 476 }else{ 477 if(themeData.titlecon.hasClass('witle-wrap-con-shown')) { 478 themeData.titlecon.removeClass('witle-wrap-con-shown'); 479 } 480 481 } 482 }); 483 } 484 //audio player function 485 themeData.fnJplayerCall = function(){ 486 if(themeData.jplayer.length){ 487 themeData.jplayer.jPlayer({ 488 ready: function(){ 489 $(this).jPlayer("setMedia", { 490 mp3:"" 491 }); 492 }, 493 swfPath: JS_PATH, 494 supplied: "mp3", 495 wmode: "window" 496 }); 497 498 $('.audiobutton').each(function(){ 499 themeData.fnAudioPlay($(this)); 500 }); 501 } 502 } 503 504 //call player play 505 themeData.fnAudioPlay = function(el){ 506 el.click(function(){ 507 var thisID = $(this).attr("id"); 508 if($(this).hasClass('pause')){ 509 $('.audiobutton').removeClass('play').addClass('pause'); 510 $(this).removeClass('pause').addClass('play'); 511 themeData.jplayer.jPlayer("setMedia", { 512 mp3: $(this).attr("rel") 513 }); 514 themeData.jplayer.jPlayer("play"); 515 themeData.jplayer.bind($.jPlayer.event.ended, function(event) { 516 $('#'+thisID).removeClass('play').addClass('pause'); 517 }); 518 }else if($(this).hasClass('play')){ 519 $(this).removeClass('play').addClass('pause'); 520 themeData.jplayer.jPlayer("stop"); 521 } 522 }); 523 } 524 525 //video face 526 themeData.fnVideoFace = function(arrayVideo){ 527 arrayVideo.each(function(){ 528 var videoFace = []; 529 var videoOverlay = []; 530 531 videoFace.item = $(this); 532 videoFace.playBtn = videoFace.item.find('.blog-unit-video-play'); 533 videoFace.videoWrap = videoFace.item.find('.video-wrap'); 534 videoFace.videoIframe = videoFace.videoWrap.find('iframe'); 535 536 videoOverlay.item = themeData.videoOverlay; 537 videoOverlay.videoWrap = videoOverlay.item.find('.video-wrap'); 538 videoOverlay.close = videoOverlay.item.find('.video-close'); 539 540 videoFace.playBtn.click(function(){ 541 var src = videoFace.videoIframe.attr('data-src').replace('autoplay=0', 'autoplay=1'); 542 videoFace.videoIframe.attr('src', src); 543 videoOverlay.close.before(videoFace.videoWrap.removeClass('hidden').attr('style', 'he
543ight:100%;padding-bottom:0px;')); 544 videoOverlay.item.addClass('video-slidedown'); 545 return false; 546 }); 547 548 videoOverlay.close.click(function(){ 549 videoOverlay.item.removeClass('video-slidedown'); 550 videoOverlay.item.find('.video-wrap').remove(); 551 return false; 552 }); 553 }); 554 } 555 556 //Module Load Ajax 557 themeData.fnModuleLoad = function(data, container){ 558 $.post(AJAX_M, { 559 'mode': 'module', 560 'data': data 561 }).done(function(content){ 562 var newElems = $(content); 563 switch(data['mode']){ 564 case 'pagenums': 565 var this_pagenums = container.find('a[data-post=\"'+data["module_post"]+'\"][data-paged=\"'+data["paged"]+'\"]'); 566 567 this_pagenums.text(data["paged"]); 568 $('html,body').animate({ 569 scrollTop: container.parent().offset().top - 80 570 }, 571 1000); 572 573 container.parent().find('section').remove(); 574 container.before(newElems); 575 break; 576 case 'twitter': 577 var this_twitter = container.find('a[data-post=\"'+data["module_post"]+'\"]'); 578 var pagination_text = this_twitter.parent('.page_twitter').data('pagetext'); 579 580 this_twitter.attr('data-paged',Number(data['paged']) + 1).text(pagination_text).removeClass('tw-style-loading'); 581 582 if(data['paged'] == this_twitter.data('count')){ 583 this_twitter.fadeOut(300); 584 this_twitter.parent('.page_twitter').css('margin-top','0'); 585 } 586 587 container.before(newElems); 588 break; 589 } 590 591 //Fadein theitems of next page 592 newElems.animate({opacity:1}, 1000); 593 594 //gallery 595 themeData.gallerycarousel = $('.blog-gallery-carousel'); 596 if(themeData.gallerycarousel.length){ 597 themeData.fnGalleryCarousel(); 598 } 599 600 if(newElems.find('.audio_player_list').length){ 601 602 //Audio player 603 themeData.fnJplayerCall(); 604 themeData.jplayer.jPlayer("stop"); 605 themeData.audioPlayClick(newElems); 606 themeData.audioPauseClick(newElems); 607 608 } 609 610 //Video play 611 if(newElems.find('.blog-unit-video-play').length){ 612 themeData.fnVideoFace(newElems.find('.blog-unit-img-wrap')); 613 themeData.fnVideoFace(newElems.find('.archive-item')); 614 } 615 616 //gallery list 617 if(newElems.find('.Collage').length){ 618 $('.Collage').imagesLoaded(function(){ 619 $('.Collage').collagePlus({ 620 'fadeSpeed' : 2000, 621 'targetHeight' : 200 622 }); 623 }); 624 } 625 626 //call carousel 627 if(newElems.find('.owl-carousel').length){ 628 themeData.carouselFn(newElems.find('.owl-carousel')); 629 } 630 631 }); 632 } 633 634 //gallery collage 635 themeData.fnGalleryCollage = function(collageWrap){ 636 collageWrap.collagePlus({ 637 'fadeSpeed' : 2000, 638 'targetHeight' : 200 639 }); 640 } 641 642 643 //List Layout Height 644 themeData.fnListLayoutHeight = function(){ 645 themeData.listLayout.find('.list-layout-col2, .list-layout-col3, .list-layout-col4').each(function(){ 646 var layoutGetmin = new Array(); 647 var changeColWidthSum = 0; 648 var base = 1; 649 var lastWidthSum = 0; 650 var colItems = $(this).find('.list-layout-item'); 651 var colWidth = $(this).width(); 652 var colCount = colItems.length; 653 var colGap = Number(themeData.listLayout.data('gap')); 654 655 colItems.each(function(){ 656 657 var thisWidth = $(this).width(); 658 659 layoutGetmin.push(Number($(this).find('img').attr('height'))); 660 if(colWidth != thisWidth){ 661 colWidth = colWidth - colGap; 662 } 663 }); 664 665 var itemHeight = eval("Math.min("+layoutGetmin.toString()+")");
666 colItems.each(function(index){ 667 var imgWidth = parseFloat(Number($(this).find('img').attr('width'))); 668 var imgHeight = parseFloat(Number($(this).find('img').attr('height'))); 669 var imgBase = itemHeight / imgHeight; 670 671 imgWidth = imgWidth * imgBase; 672 imgHeight = itemHeight; 673 674 changeColWidthSum = changeColWidthSum + imgWidth; 675 }); 676 677 base = colWidth / changeColWidthSum; 678 679 colItems.each(function(){ 680 var imgWidth = parseFloat(Number($(this).find('img').attr('width'))); 681 var imgHeight = parseFloat(Number($(this).find('img').attr('height'))); 682 var imgBase = itemHeight / imgHeight; 683 var thisWidth = $(this).width(); 684 685 imgWidth = (imgWidth * imgBase) * base; 686 imgHeight = itemHeight * base; 687 688 if(colWidth != thisWidth){ 689 $(this).css('width', 'auto'); 690 691 $(this).find('.ux-lazyload-wrap').css({ 692 'width': imgWidth, 693 'height': imgHeight, 694 'overflow': 'hidden' 695 }); 696 697 $(this).find('img').css({ 698 'width': '100%', 699 'height': 'auto' 700 }); 701 702 lastWidthSum = lastWidthSum + imgWidth; 703 if(Math.round(lastWidthSum) > colWidth){ 704 $(this).find('.ux-lazyload-wrap').width(imgWidth - (lastWidthSum - colWidth)); 705 }else if(Math.round(lastWidthSum) == colWidth){ 706 $(this).find('.ux-lazyload-wrap').css({ 707 'width': imgWidth - 1 708 }); 709 } 710 }else{ 711 $(this).find('.ux-lazyload-wrap').css({ 712 'width': 'auto', 713 'height': 'auto', 714 'overflow': 'hidden' 715 }); 716 } 717 }); 718 }); 719 } 720 721 //Isotope 722 themeData.isotopelist = function(){ 723 724 themeData.isotope.each(function(){ 725 726 var _this_wrap = $(this), 727 _this = $(this).find('.masonry-list'), 728 _this_wrap_st = $(this).scrollTop(), 729 _this_wrap_pt = $(this).attr('data-template'); 730 731 if(_this.hasClass('grid-list')) { 732 733 if(_this_wrap.data('spacer') == '0') { 734 themeData.isotopelistResize(_this, _this_wrap); 735 } 736 737 var $iso_list = _this.isotope({ 738 itemSelector: '.grid-item', 739 layoutMode: 'fitRows' 740 }); 741 742 743 } else { 744 745 if(_this.hasClass('masonry-grid')) { 746 themeData.isotopelistResize(_this, _this_wrap); 747 } 748 749 var $iso_list = _this.isotope({ 750 itemSelector: '.grid-item', 751 layoutMode: 'packery' 752 753 }); 754 } 755 756 if(_this_wrap.find('.filters').length) { 757 var _filters = _this_wrap.find('.filters'); 758 759 _filters.find('a').on( 'click', function() { 760 var filterValue = $( this ).attr('data-filter'); 761 $iso_list.isotope({ filter: filterValue }); 762 jQuery(this).parent().parent().find('li').removeClass('active'); 763 jQuery(this).parent().addClass('active'); 764 setTimeout(function() { 765 $(window).lazyLoadXT(); 766 $iso_list.find('.grid-item-inside').addClass('grid-show'); 767 setTimeout(function() {if(_filters.offset().top < themeData.winHeight ){ 768 $('html, body').animate({scrollTop:_filters.offset().top}, 300); 769 }}, 150); 770 }, 50); 771 772 return false; 773 }); 774 775 if(_this_wrap.find('.grid-item-cate-a').length) { 776 $('.grid-item-cate-a').each(function(){ 777 $(this).on( 'click', function() { 778 var filterValue = $( this ).attr('data-filter'); 779 $iso_list.isotope({ filter: filterValue }); 780 _filters.find('li').removeClass('active'); 781 _filters.find('[data-filter="'+filterValue+'"]').parent().addClass('active'); 782 setTimeout(function() { 783 $(window).lazyLoadXT(); 784 $iso_list.find('.grid-item-inside').addClass('grid-show'); 785 }, 50); 786 return false; 787 }); 788 }); 789 } 790 } 791 792 //call page load more 793 if(_this_wrap.find('.ux-page-load-more').length){ 794 var loadBtn = _this_wrap.find('.ux-page-load-more'); 795 var postID = loadBtn.attr('data-pageid'); 796 var postMAX = loadBtn.attr('data-max'); 797 var pageText = loadBtn.parent().attr('data-pagetext'); 798 var loadingText = loadBtn.parent().attr('data-loadingtext'); 799 800 loadBtn.click(function(){ 801 var paged = loadBtn.attr('data-paged'); 802 var filters = _this_wrap.find('.filters'); 803 var filterActive = filters.find('li.active'); 804 var filterValue = filterActive.find('> a').attr('data-filter'); 805 var catID = filterActive.find('> a').attr('data-catid'); 806 var postCount = Number(filterActive.find('.filter-num').text()); 807 808 if(filterValue == '*'){ 809 catID = 0; 810 } 811 812 var post__not_in = []; 813 $iso_list.find('section').each(function(){ 814 var section_postid = $(this).attr('data-postid'); 815 if(filterValue != '*'){ 816 if($(this).is(filterValue)){ 817 post__not_in.push(section_postid); 818 } 819 }else{ 820 post__not_in.push(section_postid); 821 } 822 });
823 824 loadBtn.text(loadingText); 825 826 if(!_this.hasClass('loading-more')){ 827 _this.addClass('loading-more'); 828 $.post(ajaxurl, { 829 'action': 'airtheme_interface_page_ajax_filter', 830 'cat_id': catID, 831 'post_id': postID, 832 'post__not_in': post__not_in 833 }).done(function(content){ 834 $iso_list.isotope('insert', $(content)); 835 if(_this.hasClass('masonry-grid')) { 836 themeData.isotopelistResize(_this, _this_wrap); 837 $iso_list.isotope('layout'); 838 } 839 840 loadBtn.text(pageText); 841 _this.removeClass('loading-more'); 842 843 var thisPostCount = $iso_list.find('section').length; 844 if(filterValue != '*'){ 845 thisPostCount = $iso_list.find('section' +filterValue).length; 846 } 847 //console.log(thisPostCount); console.log(postCount); 848 if(thisPostCount >= postCount){ 849 loadBtn.parent().hide(); 850 }else{ 851 loadBtn.parent().show(); 852 } 853 854 setTimeout(function() { 855 $(window).lazyLoadXT(); 856 $iso_list.find('.grid-item-inside').addClass('grid-show'); 857 }, 50); 858 }); 859 } 860 861 return false; 862 }); 863 } 864 865 //call infiniti scroll 866 if(_this.hasClass('infiniti-scroll')){ 867 var postID = _this.attr('data-pageid'); 868 var postMAX = _this.attr('data-max'); 869 870 var waypoints = _this.waypoint({ 871 handler: function(direction){ 872 var paged = _this.attr('data-paged'); 873 var filters = _this_wrap.find('.filters'); 874 var filterActive = filters.find('li.active'); 875 var filterValue = filterActive.find('> a').attr('data-filter'); 876 var catID = filterActive.find('> a').attr('data-catid'); 877 var postCount = Number(filterActive.find('.filter-num').text()); 878 879 var post__not_in = []; 880 $iso_list.find('section').each(function(){ 881 var section_postid = $(this).attr('data-postid'); 882 if(filterValue != '*'){ 883 if($(this).is(filterValue)){ 884 post__not_in.push(section_postid); 885 } 886 }else{ 887 post__not_in.push(section_postid); 888 } 889 }); 890 891 if(!_this.hasClass('infiniti-scrolling')){ 892 _this.addClass('infiniti-scrolling'); 893 $.post(ajaxurl, { 894 'action': 'airtheme_interface_page_ajax_filter', 895 'cat_id': catID, 896 'post_id': postID, 897 'post__not_in': post__not_in 898 }).done(function(content){ 899 $iso_list.isotope('insert', $(content)); 900 if(_this.hasClass('masonry-grid')) { 901 themeData.isotopelistResize(_this, _this_wrap); 902 903 $iso_list.isotope('layout'); 904 } 905 906 _this.removeClass('infiniti-scrolling'); 907 908 setTimeout(function() { 909 $(window).lazyLoadXT(); 910 $iso_list.find('.grid-item-inside').addClass('grid-show'); 911 }, 50); 912 913 }); 914 } 915 }, 916 offset: 'bottom-in-view' 917 }) 918 } 919 920 if(_this_wrap.find('.filters').length) { 921 922 if(_this_wrap.find('.grid-item-cate-a').length) { 923 $('.grid-item-cate-a').each(function(){ 924 $(this).on( 'click', function() { 925 var filterValue = $( this ).attr('data-filter'); 926 $iso_list.isotope({ filter: filterValue }); 927 _filters.find('li').removeClass('active'); 928 _filters.find('[data-filter="'+filterValue+'"]').parent().addClass('active'); 929 return false; 930 }); 931 }); 932 } 933 } 934 935 if(_this.hasClass('masonry-grid')) { 936 themeData.win.on( 'resize', function () { 937 themeData.isotopelistResize(_this, _this_wrap); 938 }).resize(); 939 } 940 941 }); 942 } 943 944 themeData.isotopelistResize = function(_this, _this_wrap){ 945 var winWidth = window.innerWidth, 946 ListWidth = _this.width(), 947 GridSpacer = _this_wrap.data('spacer'), 948 columnNumb = _this_wrap.data('col'), 949 GridWith = Math.floor(ListWidth / columnNumb); 950 951 if (winWidth >= 768) { 952 953 _this.find('.grid-item').each(function () { 954 $('.grid-item').css({ 955 width : GridWith * 1 - GridSpacer + 'px', 956 height : GridWith * 0.75 - GridSpacer + 'px', 957 margin : GridSpacer * 0.5 + 'px' 958 }); 959 $('.grid-item .ux-lazyload-wrap').css(
960 "padding-top", ((GridWith * 0.75 - GridSpacer)/(GridWith * 1 - GridSpacer)) * 100 + '%' 961 ); 962 $('.grid-item.grid-item-big').css({ 963 width : GridWith * 2 - GridSpacer + 'px', 964 height : GridWith * 1.5 - GridSpacer + 'px', 965 margin : GridSpacer * 0.5 + 'px' 966 }); 967 $('.grid-item.grid-item-big .ux-lazyload-wrap').css( 968 "padding-top", ((GridWith * 1.5 - GridSpacer)/(GridWith * 2 - GridSpacer)) * 100 + '%' 969 ); 970 $('.grid-item.grid-item-long').css({ 971 width : GridWith * 2 - GridSpacer + 'px', 972 height : GridWith * 0.75 - GridSpacer + 'px', 973 margin : GridSpacer * 0.5 + 'px' 974 }); 975 $('.grid-item.grid-item-long .ux-lazyload-wrap').css( 976 "padding-top", ((GridWith * 0.75 - GridSpacer)/(GridWith * 2 - GridSpacer)) * 100 + '%' 977 ); 978 $('.grid-item.grid-item-tall').css({ 979 width : GridWith * 1 - GridSpacer + 'px', 980 height : GridWith * 1.5 - GridSpacer + 'px', 981 margin : GridSpacer * 0.5 + 'px' 982 }); 983 $('.grid-item.grid-item-tall .ux-lazyload-wrap').css( 984 "padding-top", ((GridWith * 1.5 - GridSpacer)/(GridWith * 1 - GridSpacer)) * 100 + '%' 985 ); 986 987 }); 988 989 } else { 990 991 GridWith = Math.floor(ListWidth / 1); 992 993 _this.find('.grid-item.grid-item-small').each(function () { 994 $('.grid-item').css({ 995 width : GridWith * 1 - GridSpacer + 'px', 996 height : GridWith * 0.75 - GridSpacer + 'px', 997 margin : GridSpacer * 0.5 + 'px' 998 }); 999 $('.grid-item .ux-lazyload-wrap').css( 1000 "padding-top", ((GridWith * 0.75 - GridSpacer)/(GridWith * 1 - GridSpacer)) * 100 + '%' 1001 );
1002 $('.grid-item.grid-item-big').css({ 1003 width : GridWith * 1 - GridSpacer + 'px', 1004 height : GridWith * 0.75 - GridSpacer + 'px', 1005 margin : GridSpacer * 0.5 + 'px' 1006 }); 1007 $('.grid-item.grid-item-big .ux-lazyload-wrap').css( 1008 "padding-top", ((GridWith * 0.75 - GridSpacer)/(GridWith * 1 - GridSpacer)) * 100 + '%' 1009 ); 1010 $('.grid-item.grid-item-long').css({ 1011 width : GridWith * 1 - GridSpacer + 'px', 1012 height : GridWith * 0.375 - GridSpacer + 'px', 1013 margin : GridSpacer * 0.5 + 'px' 1014 }); 1015 $('.grid-item.grid-item-long .ux-lazyload-wrap').css( 1016 "padding-top", ((GridWith * 0.75 - GridSpacer)/(GridWith * 2 - GridSpacer)) * 100 + '%' 1017 ); 1018 $('.grid-item.grid-item-tall').css({ 1019 width : GridWith * 1 - GridSpacer + 'px', 1020 height : GridWith * 1.5 - GridSpacer + 'px', 1021 margin : GridSpacer * 0.5 + 'px' 1022 }); 1023 $('.grid-item.grid-item-tall .ux-lazyload-wrap').css( 1024 "padding-top", ((GridWith * 1.5 - GridSpacer)/(GridWith * 1 - GridSpacer)) * 100 + '%' 1025 ); 1026 1027 }); 1028 } 1029 } 1030 1031 // Header & Filter sticky 1032 1033 themeData.header_sticky = function(){ 1034 1035 var lastScrollTop = 0, delta = 5; 1036 1037 themeData.win.bind('scroll', function() { 1038 1039 var st = $(this).scrollTop(); 1040 1041 if(Math.abs(lastScrollTop - st) <= delta) return; 1042 1043 if (st > lastScrollTop){ 1044 //scroll down 1045 if(themeData.body.hasClass('header-scrolled')){ 1046 themeData.body.removeClass('header-scrolled'); 1047 } 1048 if(!themeData.body.hasClass('header-scrolling') && st > 100 ){ 1049 themeData.body.addClass('header-scrolling'); 1050 } 1051 1052 } else { 1053 //scroll up 1054 if( st > 10 ){ 1055 if(!themeData.body.hasClass('header-scrolled')){ 1056 themeData.body.addClass('header-scrolled'); 1057 } 1058 } else { 1059 if(themeData.body.hasClass('header-scrolled')){ 1060 themeData.body.removeClass('header-scrolled'); 1061 } 1062 } 1063 if(themeData.body.hasClass('header-scrolling')){ 1064 themeData.body.removeClass('header-scrolling'); 1065 } 1066 1067 } 1068 1069 lastScrollTop = st; 1070 }); 1071 1072 } 1073 1074 //Single Gallery Filled 1075 themeData.fnSingleGalleryFilled = function(){ 1076 var singleCol2TextWrap = $('.single-col2-text-wrap'); 1077 var singleCol2GalleryWrap = $('.single-col2-gallery-wrap'); 1078 var singleCol2GalleryWrapLeft = singleCol2GalleryWrap.css('padding-left'); 1079 var singleCol2GalleryWrapRight = singleCol2GalleryWrap.css('padding-right'); 1080 var singleGalleryWrapInn = $('.single-gallery-wrap-inn'); 1081 var singleArticle = themeData.contentWrap.find('> article'); 1082 var singleArticleLeft = singleArticle.offset().left; 1083 var singleArticleRight = singleArticle.offset().left; 1084 1085 if(singleCol2TextWrap.is('.pull-right')){ 1086 $('.single-gallery-wrap-inn').css('margin-left', '0px').velocity({ opacity : 1 }); 1087 var singleGalleryLeft = Number(singleArticleLeft) + Number(singleCol2GalleryWrapLeft.replace('px', '')); 1088 singleGalleryWrapInn.css({ 1089 'margin-left': '-' + singleGalleryLeft + 'px' 1090 }); 1091 }else{ 1092 $('.single-gallery-wrap-inn').css('margin-right', '0px').velocity({ opacity : 1 }); 1093 var singleGalleryRight = Number(singleArticleRight) + Number(singleCol2GalleryWrapRight.replace('px', '')); 1094 singleGalleryWrapInn.css({ 1095 'margin-right': '-' + singleGalleryRight + 'px' 1096 }); 1097 1098 } 1099 1100 themeData.fnListLayoutHeight(); 1101 } 1102 1103 //fix Lazy with filter 1104 if(themeData.isotope_filter.length) { 1105 $.lazyLoadXT.updateEvent+=' layoutComplete'; 1106 } 1107 1108 //Sub Menu 1109 themeData.fnSetMenuLevel = function(index, el){ 1110 if(el){ 1111 el.each(function(i){ 1112 $(this).addClass('level-' +index); 1113 if($(this).hasClass('menu-item-has-children')){ 1114 themeData.fnSetMenuLevel(index + 1, $(this).find('> .sub-menu > li')); 1115 } 1116 }); 1117 } 1118 } 1119 1120 themeData.fnSubMenu = function() { 1121 themeData.NaviWrapMobile = $('#menu-panel .menu'); 1122 themeData.fnSetMenuLevel(1, themeData.NaviWrapMobile.find('> li')); 1123 1124 themeData.NaviWrapMobile.find('li').each(function(index){ 1125 var _this = $(this), 1126 _this_link = _this.find('> a'); 1127 1128 if(_this.hasClass('menu-item-has-children')){ 1129 1130 _this.find('> .sub-menu').prepend('<li class="menu-item-back"><a href="#" class="menu-item-back-a archive-arrow"><span class="archive-arrow-inn"></span></a></li>'); 1131 _this_link.append('<span class="submenu-icon"></span>'); 1132 1133 _this_link.click(function(){ 1134 themeData.NaviWrapMobile.find('li').velocity("transition.slideLeftOut",200, function() { 1135 _this_link.hide(); 1136 _this_link.next().velocity("transition.slideLeftIn", 100); 1137 _this_link.next().children().velocity("transition.slideLeftIn", 100); 1138 _this_link.parents('.menu-item').velocity("transition.slideLeftIn", 100); 1139 1140 }); 1141 return false; 1142 }); 1143 1144 _this.find('> .sub-menu > .menu-item-back > a').click(function(){ 1145 var sub_menu = $(this).parent().parent(); 1146 var parent_item = sub_menu.parent(); 1147 var parent_item_link = parent_item.find('> a'); 1148 1149 if(parent_item.not('.level-1')){ 1150 sub_menu.velocity("transition.fadeOut",1, function(){ 1151 parent_item.parent().children().velocity("transition.slideLeftIn", 300); 1152 parent_item_link.velocity("transition.fadeIn", 300); 1153 });
1154 } 1155 1156 return false; 1157 }); 1158 }else{ 1159 _this_link.click(function(){ 1160 1161 if(themeData.pageLoading.length){ 1162 1163 if(!Modernizr.touchevents){ 1164 if(!$(this).parent().hasClass('current-menu-anchor')){ 1165 if($(this).attr('target')=='_blank'){}else{ 1166 themeData.fnPageLoadingEvent($(this)); 1167 return false; 1168 } 1169 } 1170 } else { 1171 if(!$(this).parent().hasClass('current-menu-anchor')&& !$(this).parent().hasClass('menu-item-has-children')&& !$(this).parent().hasClass('menu-item-has-children')){ 1172 if($(this).attr('target')=='_blank'){}else{ 1173 themeData.fnPageLoadingEvent($(this)); 1174 return false; 1175 } 1176 } 1177 } 1178 1179 } 1180 1181 }); 1182 } 1183 1184 }); 1185 1186 }; 1187 1188 //Footer fixed 1189 themeData.fnFooterFixed = function(){ 1190 1191 var foot_height = themeData.footer.find('.footer-info').outerHeight(); 1192 if(themeData.footer.find('.widget_footer').length) { 1193 foot_height = foot_height + themeData.footer.find('.widget_footer').outerHeight(); 1194 } 1195 1196 if( themeData.win.width() > switchWidth){ 1197 themeData.container.css('margin-bottom', foot_height); 1198 themeData.footer.css('position', 'fixed'); 1199 } else { 1200 themeData.container.css({'margin-bottom': '0'}); 1201 themeData.footer.css({ 'position': 'relative'}); 1202 } 1203 1204 }; 1205 1206 themeData.fnFooterAnima = function(){ 1207 1208 themeData.container.find('#content_wrap').waypoint(function(direction) { 1209 if (direction === 'down') { 1210 themeData.footer.find('.footer-info').velocity("transition.slideUpIn"); 1211 footer_visible = true; 1212 } 1213 this.destroy(); 1214 },{ 1215 offset: "bottom-in-view" 1216 }); 1217 } 1218 1219 // List Animation Queue 1220 var itemQueue = [] 1221 var itemDelay = 150 1222 var queueTimer 1223 1224 function fnListItemQueue () { 1225 if (queueTimer) return 1226 queueTimer = window.setInterval(function () { 1227 if (itemQueue.length) { 1228 $(itemQueue.shift()).addClass('grid-show'); 1229 fnListItemQueue(); 1230 } 1231 else { 1232 window.clearInterval(queueTimer); 1233 queueTimer = null; 1234 } 1235 }, itemDelay); 1236 } 1237 1238 // Main Scrolled Animation 1239 themeData.fnMainAnima = function(){ 1240 1241 if($('.grid-item-inside').length) { 1242 $('.grid-item-inside').waypoint(function (direction) { 1243 itemQueue.push(this.element); 1244 fnListItemQueue(); 1245 }, { 1246 offset: '100%' 1247 }); 1248 1249 $('.grid-item-inside').each(function(index, element) { 1250 if($(this).parent().offset().top < (themeData.winScrollTop + themeData.winHeight)){ 1251 var lazyload = $(this).find('.ux-lazyload-bgimg'); 1252 var lazyload_bgimg = lazyload.data('bg'); 1253 if(lazyload_bgimg) { 1254 lazyload.addClass('lazy-loaded').css('background-image', 'url("' +lazyload_bgimg+ '")'); 1255 } 1256 itemQueue.push($(this)); 1257 fnListItemQueue(); 1258 } 1259 }); 1260 1261 } 1262 1263 if($('.pagenums .tw-style-a').length) { 1264 var _tw_loadmore_btn = $('.pagenums .tw-style-a'); 1265 _tw_loadmore_btn.waypoint(function(direction) { 1266 if (direction === 'down') { 1267 _tw_loadmore_btn.velocity('transition.slideUpBigIn'); 1268 } 1269 this.destroy(); 1270 },{ 1271 offset: '90%' 1272 }); 1273 } 1274 1275 if($('.archive-item').length) { 1276 $('.archive-item').each(function(){ 1277 var _this = $(this); 1278 _this.waypoint(function(direction) { 1279 if (direction === 'down') { 1280 _this.find('.archive-arrow').velocity('transition.slideLeftBigIn'); 1281 } 1282 this.destroy(); 1283 },{ 1284 offset: 'bottom-in-view' 1285 }); 1286 }); 1287 1288 } 1289 } 1290 1291 // Single Post Scrolled Animation 1292 themeData.fnSingleAnima = function(){ 1293 1294 if($('.blog-unit-meta-bottom').length) { 1295 var _meta_bottom = $('.blog-unit-meta-bottom'); 1296 _meta_bottom.waypoint(function(direction) { 1297 if (direction === 'down') { 1298 _meta_bottom.find('.arrow-prev').velocity('transition.slideLeftBigIn'); 1299 _meta_bottom.find('.arrow-next').velocity('transition.slideRightBigIn'); 1300 } 1301 this.destroy(); 1302 },{ 1303 offset: '80%' 1304 }); 1305 } 1306 1307 if($('.social-bar').length) { 1308 var _social_bar = $('.social-bar'); 1309 _social_bar.waypoint(function(direction) { 1310 if (direction === 'down') { 1311 _social_bar.find('.fa').velocity('transition.expandIn', { stagger: 160 }); 1312 } 1313 this.destroy(); 1314 },{ 1315 offset: '70%' 1316 }); 1317 } 1318 1319 } 1320 1321 //page loading event 1322 themeData.fnPageLoadingEvent = function(el){ 1323 var _url = el.attr('href'); 1324 if(_url){ 1325 themeData.pageLoading.addClass('visible'); 1326 setTimeout(function(){ 1327 window.location.href = _url; 1328 }, 400); 1329 1330 } 1331 } 1332
1333 //Portfolio link open item 1334 themeData.fnPortfolioGoUrl = function(){ 1335 $('.grid-item-open-url').each(function(){ 1336 var _this = $(this); 1337 var _this_url = _this.attr('href'); 1338 _this.siblings('.grid-item-con-text').click(function(){ 1339 setTimeout(function(){ 1340 window.location.href = _this_url; 1341 }, 10); 1342 return false; 1343 }); 1344 }); 1345 } 1346 1347 //document ready 1348 themeData.doc.ready(function(){ 1349 1350 // Run Scroll Animation 1351 themeData.fnSingleAnima(); 1352 1353 //call menu 1354 if(themeData.isResponsive()){ 1355 themeData.win.find('img').imagesLoaded(function(){ 1356 themeData.fnResponsiveMenu(); 1357 }); 1358 } 1359 1360 //Call Isotope 1361 if(themeData.isotope.length){ 1362 1363 themeData.isotopelist(); 1364 $('.masonry-list').isotope('on', 'layoutComplete', function() { 1365 $(window).trigger('layoutComplete'); 1366 }); 1367 } 1368 1369 //Call audio player 1370 themeData.fnJplayerCall(); 1371 1372 //Lazy offset Y 1373 $.extend($.lazyLoadXT, { 1374 edgeY: 300 1375 }); 1376 1377 if($('.pagenums').length) { 1378 $('.pagenums').each(function(){ 1379 if ($(this).is(':empty')){ 1380 $(this).hide(); 1381 } 1382 }); 1383 } 1384 1385 themeData.fnFullscreenWrapHeight(); 1386 $(window).bind('resize', themeData.fnFullscreenWrapHeight); 1387 1388 1389 //Pageone navi 1390 if($('.anchor-in-current-page').length){ 1391 if(themeData.WrapOurter.hasClass('enbale-onepage')) { 1392 themeData.Menu.onePageNav({ 1393 currentClass: 'current', 1394 filter: ':not(.external)' 1395 }); 1396 } 1397 } 1398 1399 //Pagenumber re-layout 1400 if(themeData.pagenumsDefault.length) { 1401 themeData.pagenumsDefault.each(function(){ 1402 if($(this).find('.prev').length && $(this).find('.next').length){ 1403 $(this).find('.next').after($(this).find('.prev'));
1404 } 1405 }); 1406 } 1407 1408 //Pagination - twitter style 1409 if(themeData.blogPagenumsTwitter.length){ 1410 themeData.blogPagenumsTwitter.each(function(){ 1411 var twitterLink = []; 1412 1413 twitterLink.item = $(this); 1414 twitterLink.moduleID = twitterLink.item.data('module'); 1415 twitterLink.modulePost = twitterLink.item.data('post'); 1416 twitterLink.postID = twitterLink.item.data('postid'); 1417 twitterLink.paged = twitterLink.item.data('paged'); 1418 1419 twitterLink.item.click(function(){ 1420 twitterLink.item.html('<span>Loading...</span>'); 1421 1422 twitterLink.item.addClass('tw-style-loading'); 1423 twitterLink.paged = twitterLink.item.attr('data-paged'); 1424 1425 var ajax_data = { 1426 'module_id' : twitterLink.moduleID, 1427 'module_post' : twitterLink.modulePost, 1428 'post_id' : twitterLink.postID, 1429 'paged' : twitterLink.paged, 1430 'mode' : 'twitter' 1431 } 1432 1433 themeData.fnModuleLoad(ajax_data, twitterLink.item.parents('.pagenums')); 1434 return false; 1435 }); 1436 }) 1437 1438 } 1439 1440 //call video popup 1441 if(themeData.videoFace.length){ 1442 themeData.fnVideoFace(themeData.videoFace); 1443 } 1444 1445 //Call Portfolio link open item 1446 if($('.grid-item-open-url').length) { 1447 themeData.fnPortfolioGoUrl(); 1448 } 1449 1450 //Page Loading 1451 if(themeData.pageLoading.length){ 1452 1453 //Logo 1454 $('#logo a,#logo-footer a').click(function(){ 1455 themeData.fnPageLoadingEvent($(this)); 1456 return false; 1457 }); 1458 1459 // Gallery, Post 1460 $('.arrow-item,.article-cate-a').click(function(){ 1461 themeData.fnPageLoadingEvent($(this)); 1462 return false; 1463 }); 1464 1465 // Archive, News unit 1466 $('.archive-item > a.ux-lazyload-wrap,.arvhive-tit > a,.archive-arrow,.grid-meta-a,.gird-blog-tit-a').click(function(){ 1467 themeData.fnPageLoadingEvent($(this)); 1468 return false; 1469 }); 1470 1471 /** Modules */ 1472 $('.entry a,.pagebuilder-wrap a').click(function(){ 1473 if($(this).is('.lightbox')||$(this).is('.lightbox-item')){}else{ 1474 if($(this).attr('target')=='_blank'){}else{ 1475 themeData.fnPageLoadingEvent($(this)); 1476 return false; 1477 } 1478 } 1479 }); 1480 1481 } 1482 1483 }); 1484 1485 //win load 1486 themeData.win.load(function(){ 1487 1488 if(themeData.listLayout.length && !themeData.singleGalleryFilled.length){ 1489 themeData.fnListLayoutHeight(); 1490 themeData.win.bind('resize', themeData.fnListLayoutHeight); 1491 } 1492 1493 if(themeData.singleGalleryFilled.length){ 1494 themeData.fnSingleGalleryFilled(); 1495 } 1496 1497 setTimeout(function(){ 1498 themeData.pageLoading.removeClass('visible'); 1499 },10); 1500 1501 if($('#header').length) { 1502 themeData.header_sticky(); 1503 } 1504 1505 //Call Sticky sidebar in gallery post 1506 if($(".sticky_column").length) { 1507 $(".sticky_column").stick_in_parent(); 1508 } 1509 1510 //Call down button in gallery post 1511 if(themeData.TopsliderTrggleDown.length){ 1512 themeData.TopsliderTrggleDownFn(); 1513 } 1514 1515 //Footer fixed 1516 if(themeData.footer.length) { 1517 themeData.fnFooterFixed(); 1518 themeData.fnFooterAnima(); 1519 themeData.win.on("debouncedresize", themeData.fnFooterFixed); 1520 } 1521 1522 //Call Lightbox 1523 if(themeData.lightboxPhotoSwipe.length){ 1524 fnInitPhotoSwipeFromDOM('.lightbox-photoswipe'); 1525 } 1526 1527 //Call top silder 1528 if(themeData.carousel.length) { 1529 themeData.carouselFn(themeData.carousel); 1530 } 1531 1532 //Call Tip 1533 if(themeData.tooltip.length){ 1534 themeData.tooltip.tooltip(); 1535 } 1536 1537 // Back top 1538 if(themeData.backTop.length){ 1539 themeData.backTop.on({'touchstart click': function(){ 1540 $('html, body').animate({scrollTop:0}, 1200); 1541 }}); 1542 } 1543 1544 //Call Search 1545 if(themeData.searchOpen.length){ 1546 themeData.fnSerchShow(); 1547 } 1548 1549 themeData.body.removeClass("preload"); 1550 1551 if(themeData.galleryCollage.length) { 1552 themeData.win.find('img').imagesLoaded(function(){ 1553 themeData.fnGalleryCollage(themeData.galleryCollage); 1554 }); 1555 } 1556 1557 if(themeData.body.hasClass('with-video-cover')) { 1558 themeData.fnVideocoverTitle(); 1559 } 1560 1561 if(themeData.backTop.length) { 1562 themeData.fnBackTop(); 1563 } 1564 1565 1566 // Run Main Scroll Animation 1567 themeData.fnMainAnima(); 1568 1569 }); 1570 1571 1572 //win resize 1573 themeData.win.resize(function(){ 1574 if(themeData.galleryCollage.length){ 1575 $('.Collage .Image_Wrapper').css("opacity", 0); 1576 if (resizeTimer) clearTimeout(resizeTimer); 1577 resizeTimer = setTimeout(function(){ 1578 themeData.fnGalleryCollage(themeData.galleryCollage) 1579 }, 200); 1580 } 1581 1582 if(themeData.singleGalleryFilled.length){ 1583 themeData.fnSingleGalleryFilled(); 1584 } 1585 1586 }); 1587 1588 window.onpageshow = function(event) { 1589 if (event.persisted) { 1590 window.location.reload() 1591 } 1592 }; 1593 1594})(jQuery); 1595 1596//Lazy offset Y 1597jQuery.extend(jQuery.lazyLoadXT, { 1598 edgeY: 500 1599}); 1600 1601function fnInitPhotoSwipeFromDOM(gallerySelector){ 1602 var parseThumbnailElements = function(el){ 1603 var thumbElements = jQuery(el).find('[data-lightbox=\"true\"]'), 1604 numNodes = thumbElements.length, 1605 items = [], 1606 figureEl, 1607 linkEl, 1608 size, 1609 type, 1610 item; 1611 1612 for(var i = 0; i < numNodes; i++){ 1613 1614 figureEl = thumbElements[i]; // <figure> element 1615 1616 // include only element nodes 1617 if(figureEl.nodeType !== 1){ 1618 continue; 1619 } 1620 1621 //linkEl = figureEl.children[0]; // <a> element 1622 linkEl = jQuery(figureEl).find('.lightbox-item'); 1623 1624 size = linkEl.attr('data-size').split('x'); 1625 type = linkEl.attr('data-type'); 1626 1627 // create slide object 1628 if(type == 'video'){ 1629 item = { 1630 html: linkEl.find('> div').html() 1631 } 1632 }else{ 1633 item = { 1634 src: linkEl.attr('href'), 1635 w: parseInt(size[0], 10), 1636 h: parseInt(size[1], 10) 1637 }; 1638 } 1639 1640 if(figureEl.children.length > 0){ 1641 // <figcaption> content 1642 item.title = linkEl.attr('title'); 1643 } 1644 1645 if(linkEl.find('img').length > 0){ 1646 // <img> thumbnail element, retrieving thumbnail url 1647 item.msrc = linkEl.find('img').attr('src'); 1648 } 1649 1650 item.el = figureEl; // save link to element for getThumbBoundsFn 1651 items.push(item); 1652 } 1653 1654 return items; 1655 }; 1656 1657 // find nearest parent element 1658 var closest = function closest(el, fn){ 1659 return el && (fn(el) ? el : closest(el.parentNode, fn)); 1660 }; 1661 1662 // triggers when user clicks on thumbnail 1663 var onThumbnailsClick = function(e){
1664 e = e || window.event; 1665 e.preventDefault ? e.preventDefault() : e.returnValue = false; 1666 1667 var eTarget = e.target || e.srcElement; 1668 1669 // find root element of slide 1670 var clickedListItem = closest(eTarget, function(el){ 1671 if(el.tagName){ 1672 return (el.hasAttribute('data-lightbox') && el.getAttribute('data-lightbox') === 'true'); 1673 } 1674 }); 1675 1676 if(!clickedListItem){ 1677 return; 1678 } 1679 1680 // find index of clicked item by looping through all child nodes 1681 // alternatively, you may define index via data- attribute 1682 var clickedGallery = jQuery(clickedListItem).parents('.lightbox-photoswipe'), 1683 childNodes = clickedGallery.find('[data-lightbox=\"true\"]'), 1684 numChildNodes = childNodes.length, 1685 nodeIndex = 0, 1686 index; 1687 1688 for (var i = 0; i < numChildNodes; i++){ 1689 if(childNodes[i].nodeType !== 1){ 1690 continue; 1691 } 1692 1693 if(childNodes[i] === clickedListItem){ 1694 index = nodeIndex; 1695 break; 1696 } 1697 nodeIndex++; 1698 } 1699 1700 if(index >= 0){ 1701 // open PhotoSwipe if valid index found 1702 openPhotoSwipe(index, clickedGallery[0]); 1703 } 1704 return false; 1705 }; 1706 1707 // parse picture index and gallery index from URL (#&pid=1&gid=2) 1708 var photoswipeParseHash = function(){ 1709 var hash = window.location.hash.substring(1), 1710 params = {}; 1711 1712 if(hash.length < 5) { 1713 return params; 1714 } 1715 1716 var vars = hash.split('&'); 1717 for (var i = 0; i < vars.length; i++) { 1718 if(!vars[i]) { 1719 continue; 1720 } 1721 var pair = vars[i].split('='); 1722 if(pair.length < 2) { 1723 continue; 1724 } 1725 params[pair[0]] = pair[1]; 1726 } 1727 1728 if(params.gid) { 1729 params.gid = parseInt(params.gid, 10); 1730 } 1731 1732 if(!params.hasOwnProperty('pid')) { 1733 return params; 1734 } 1735 params.pid = parseInt(params.pid, 10); 1736 return params; 1737 }; 1738 1739 var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL){ 1740 var pswpElement = document.querySelectorAll('.pswp')[0], 1741 gallery, 1742 options, 1743 items; 1744 1745 items = parseThumbnailElements(galleryElement); 1746 1747 // define options (if needed) 1748 options = { 1749 index: index, 1750 1751 // define gallery index (for URL) 1752 galleryUID: galleryElement.getAttribute('data-pswp-uid'), 1753 1754 showHideOpacity:true, 1755 1756 getThumbBoundsFn: function(index) { 1757 // See Options -> getThumbBoundsFn section of documentation for more info 1758 var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail 1759 pageYScroll = window.pageYOffset || document.documentElement.scrollTop, 1760 rect = thumbnail.getBoundingClientRect(); 1761 1762 return {x:rect.left, y:rect.top + pageYScroll, w:rect.width}; 1763 }, 1764 1765 addCaptionHTMLFn: function(item, captionEl, isFake) { 1766 if(!item.title) { 1767 captionEl.children[0].innerText = ''; 1768 return false; 1769 } 1770 captionEl.children[0].innerHTML = item.title; 1771 return true; 1772 } 1773 }; 1774 1775 if(fromURL) { 1776 if(options.galleryPIDs) { 1777 // parse real index when custom PIDs are used 1778 // http://photoswipe.com/documentation/faq.html#custom-pid-in-url 1779 for(var j = 0; j < items.length; j++) { 1780 if(items[j].pid == index) { 1781 options.index = j; 1782 break; 1783 } 1784 } 1785 } else { 1786 options.index = parseInt(index, 10) - 1; 1787 } 1788 } else { 1789 options.index = parseInt(index, 10); 1790 } 1791 1792 // exit if index not found 1793 if( isNaN(options.index) ) { 1794 return; 1795 } 1796 1797 var radios = document.getElementsByName('gallery-style'); 1798 for (var i = 0, length = radios.length; i < length; i++) { 1799 if (radios[i].checked) { 1800 if(radios[i].id == 'radio-all-controls') { 1801 1802 } else if(radios[i].id == 'radio-minimal-black') { 1803 options.mainClass = 'pswp--minimal--dark'; 1804 options.barsSize = {top:0,bottom:0}; 1805 options.captionEl = false; 1806 options.fullscreenEl = false; 1807 options.shareEl = false; 1808 options.bgOpacity = 0.85; 1809 options.tapToClose = true; 1810 options.tapToToggleControls = false; 1811 } 1812 break; 1813 } 1814 } 1815 1816 if(disableAnimation) { 1817 options.showAnimationDuration = 0; 1818 } 1819 1820 // Pass data to PhotoSwipe and initialize it 1821 gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); 1822 gallery.init(); 1823 }; 1824 1825 // loop through all gallery elements and bind events 1826 var galleryElements = document.querySelectorAll(gallerySelector); 1827 1828 for(var i = 0, l = galleryElements.length; i < l; i++){ 1829 galleryElements[i].setAttribute('data-pswp-uid', i+1); 1830 //galleryElements[i].onclick = onThumbnailsClick; 1831 } 1832 1833 // Parse URL and open gallery if it contains #&pid=3&gid=1 1834 var hashData = photoswipeParseHash(); 1835 if(hashData.pid > 0 && hashData.gid > 0) { 1836 openPhotoSwipe( hashData.pid - 1 , galleryElements[ hashData.gid - 1 ], true, true ); 1837 } 1838}
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.