1var G5Plus = G5Plus || {}; 2(function ($) { 3 "use strict"; 4 var $window = $(window), 5 $body = $('body'), 6 $header = $('header#header-wrap'), 7 isRTL = $body.hasClass('rtl') ? true : false, 8 deviceAgent = navigator.userAgent.toLowerCase(), 9 isMobile = deviceAgent.match(/(iphone|ipod|android|iemobile)/), 10 isMobileAlt = deviceAgent.match(/(iphone|ipod|ipad|android|iemobile)/), 11 isAppleDevice = deviceAgent.match(/(iphone|ipod|ipad)/), 12 isIEMobile = deviceAgent.match(/(iemobile)/); 13 14 G5Plus.common = { 15 init : function() { 16 this.owlCarousel(); 17 this.prettyPhoto(); 18 this.slick(); 19 this.owlCarouselTab(); 20 }, 21 owlCarousel : function() { 22 $('.owl-carousel:not(.manual):not(.owl-loaded)').each(function () { 23 var slider = $(this); 24 var defaults = { 25 items: 4, 26 loop: true, 27 rtl: isRTL, 28 nav : true, 29 navText: [ '<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>' ], 30 dots: false, 31 autoHeight : false 32 }; 33 var config = $.extend({}, defaults, slider.data("owl-carousel-config")); 34 35 slider.imagesLoaded({ background: true },function () { 36 // Initialize Slider 37 slider.owlCarousel(config); 38 }); 39 40 slider.on('initialized.owl.carousel', function(event) { 41 setTimeout(function() { 42 $('.owl-stage-outer',slider).css('height',''); 43 slider.data('owlCarousel').onResize(); 44 },1000); 45 }); 46 47 }); 48 }, 49 owlCarouselTab : function() { 50 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { 51 $('.owl-carousel',e.target.hash).each(function(){ 52 $('.owl-stage-outer',$(this)).css('height',''); 53 $(this).data('owlCarousel').onResize(); 54 }); 55 }); 56 }, 57 slick : function() { 58 $('.slick:not(.slick-initialized)').each(function () { 59 var slider = $(this); 60 var defaults = { 61 slidesToShow: 4, 62 slidesToScroll: 1, 63 infinite: true, 64 arrows: true, 65 rtl: isRTL, 66 prevArrow: '<div class="button-prev"><i class="fa fa-angle-left"></i></div>', 67 nextArrow: '<div class="button-next"><i class="fa fa-angle-right"></i></div>' 68 }; 69 var config = $.extend({}, defaults, slider.data("slick")); 70 // Initialize Slider 71 slider.slick(config); 72 }); 73 }, 74 isDesktop : function() { 75 var responsive_breakpoint = 991; 76 if ((typeof ($body.data('responsive')) != "undefined" ) && !isNaN(parseInt($body.data('responsive'), 10))) { 77 responsive_breakpoint = parseInt($body.data('responsive'), 10); 78 } 79 return window.matchMedia('(min-width: ' + (responsive_breakpoint + 1) + 'px)').matches; 80 }, 81 prettyPhoto : function() { 82 $("a[data-rel^='prettyPhoto']").prettyPhoto({ 83 hook:'data-rel', 84 social_tools:'', 85 animation_speed:'normal', 86 theme:'light_square' 87 }); 88 } 89 }; 90 91 G5Plus.header = { 92 init : function() { 93 this.searchButton(); 94 this.headerNavSpacing(1); 95 this.menuAddCaret(); 96 this.scrollBar(); 97 }, 98 windowResized : function() { 99 this.headerNavSpacing(1); 100 }, 101 windowLoad : function() { 102 this.headerNavSpacing(1); 103 }, 104 searchButton : function() { 105 var $searchForm = $('.header-search-form'); 106 $('#header-search-button').on('click',function(e){ 107 e.preventDefault(); 108 $searchForm.toggleClass('active'); 109 if ($searchForm.hasClass('active')) { 110 setTimeout(function(){ 111 $searchForm.find('input').focus(); 112 }, 50); 113 } 114 }); 115 $body.on('click',function(e){ 116 if ($(e.target).closest('.header-search-button-wrap').length === 0) { 117 $searchForm.removeClass('active'); 118 } 119 }); 120 }, 121 headerNavSpacing : function(retryAmount) { 122 if (typeof (retryAmount) == "undefined") { 123 retryAmount = 0; 124 } 125 var arrConfig = { 126 'header-1': { 127 container: 'header.main-header .header-nav .container', 128 items: '> .header-mobile-wrap, > .menu-wrap' 129 } 130 }; 131 132 var headerLayout = $('body').data('header'); 133 if ((typeof (headerLayout) != "undefined") && (headerLayout != null) && (typeof (arrConfig[headerLayout]) != "undefined")) { 134 $(arrConfig[headerLayout].container).each(function() { 135 var $container = $(this), 136 marginDefault = 30, 137 containerWidth = $container.width(), 138 navItemCount = $('ul.main-menu > li:visible', $container).length, 139 totalWidth = 0; 140 141 $('ul.main-menu > li', $container).css('margin-left',''); 142 143 if (!G5Plus.common.isDesktop()) { 144 return; 145 } 146 147 $(arrConfig[headerLayout].items, $container).each(function(){ 148 var $this = $(this); 149 if ($this.is(':visible')) { 150 totalWidth += $this.outerWidth(); 151 } 152 });
153 154 if (containerWidth < totalWidth) { 155 navItemCount--; 156 if (navItemCount > 0) { 157 var marginLeft = marginDefault - (totalWidth - containerWidth + 40) * 1.0/ navItemCount; 158 } 159 if (marginLeft < 10) { 160 marginLeft = 10; 161 } 162 if (marginLeft < marginDefault) { 163 $('ul.main-menu > li', $container).not(':first').css('margin-left', marginLeft + 'px'); 164 } 165 } 166 167 }); 168 } 169 170 if (retryAmount > 0) { 171 setTimeout(function() { 172 G5Plus.header.headerNavSpacing(retryAmount - 1); 173 }, 100); 174 } 175 176 }, 177 menuAddCaret : function() { 178 if ($('body').attr('data-header') == 'header-2') { 179 $('#main-menu li.menu-item-has-children').each(function(){ 180 $(this).append('<span class="menu-caret"></span>'); 181 }); 182 } 183 else { 184 $('#main-menu li.menu-item-has-children > a').each(function(){ 185 $(this).append('<span class="menu-caret"></span>'); 186 }); 187 } 188 }, 189 scrollBar : function() { 190 $('header.header-2').perfectScrollbar({ 191 wheelSpeed: 0.5, 192 suppressScrollX: true 193 }); 194 }, 195 sticky: function () { 196 if (!$('header.main-header').hasClass('header-sticky')) { 197 return; 198 } 199 if ($(window).scrollTop() > 0) { 200 if (!$('header.main-header').hasClass('sticky-in')) { 201 $('header.main-header').addClass('sticky-in'); 202 } 203 } 204 else { 205 if ($('header.main-header').hasClass('sticky-in')) { 206 $('header.main-header').removeClass('sticky-in'); 207 } 208 } 209 } 210 }; 211 212 G5Plus.menuMobile = { 213 init : function() { 214 this.scrollBar(); 215 this.toggleClick(); 216 this.menuClick(); 217 this.processPosition(); 218 }, 219 windowScroll : function() { 220 this.processPosition(); 221 }, 222 windowResized : function() { 223 this.scrollBar(); 224 this.reset(); 225 this.processPosition(); 226 }, 227 scrollBar : function() { 228 if (G5Plus.common.isDesktop()) { 229 $('header#header-wrap .menu-wrap').perfectScrollbar('destroy'); // Destroy 230 } else { 231 $('header#header-wrap .menu-wrap').perfectScrollbar({ 232 wheelSpeed: 0.5, 233 suppressScrollX: true 234 }); 235 } 236 }, 237 reset : function() { 238 if (G5Plus.common.isDesktop()) { 239 var $menuButton = $('#toggle-mobile-menu[data-ref]'), 240 menuId = $menuButton.data('ref'); 241 if ($menuButton.hasClass('in')) { 242 $menuButton.toggleClass('in'); 243 $('body').toggleClass('menu-mobile-in'); 244 $('#' + menuId).toggleClass('in'); 245 } 246 247 $('#main-menu li.sub-menu-open').each(function(){ 248 $(this).toggleClass('sub-menu-open'); 249 $('> ul.sub-menu', this).attr('style',''); 250 }); 251 } 252 }, 253 toggleClick : function() { 254 $('#toggle-mobile-menu[data-ref]').on('click',function(event){ 255 event.preventDefault(); 256 var $this = $(this), 257 menuId = $this.data('ref'); 258 $this.toggleClass('in'); 259 $('body').toggleClass('menu-mobile-in'); 260 $('#' + menuId).toggleClass('in'); 261 }); 262 }, 263 menuClick : function() { 264 $('#main-menu li.menu-item-has-children').on('click',function(event) { 265 if ((G5Plus.common.isDesktop() && $header.hasClass('header-1') ) || ($(event.target ).closest($('> ul.sub-menu', this)).length > 0)) { 266 return; 267 } 268 if (($(event.target ).closest($('> a', this)).length > 0) && ($(event.target ).closest($('> a > span', this)).length == 0)) { 269 var baseUri = ''; 270 if ((typeof (event.target) != "undefined") && (event.target != null) && (typeof (event.target.baseURI) != "undefined") && (event.target.baseURI != null)) { 271 var arrBaseUri = event.target.baseURI.split('#'); 272 if (arrBaseUri.length > 0) { 273 baseUri = arrBaseUri[0]; 274 } 275 var $aClicked = $('> a', this); 276 if ($aClicked.length > 0) { 277 var clickUrl = $aClicked.attr('href'); 278 if (clickUrl != '#') { 279 if ((typeof (clickUrl) != "undefined") && (clickUrl != null)) { 280 clickUrl = clickUrl.split('#')[0]; 281 } 282 if (baseUri != clickUrl) { 283 return; 284 } 285 } 286 } 287 } 288 } 289 event.preventDefault();
290 $(this).toggleClass('sub-menu-open'); 291 $('> ul.sub-menu', this).slideToggle(); 292 }); 293 }, 294 processPosition : function() { 295 var $adminBar = $('#wpadminbar'), 296 $adminBarHeight = $adminBar.length > 0 ? $adminBar.outerHeight() : 0, 297 $adminBarPosition = $adminBar.css('position'), 298 scrollPosition = $window.scrollTop(), 299 $headerNavWrap = $('.header-1.header-sticky .header-nav,.header-1 .menu-wrap,.header-mobile .header-mobile-top,header.header-2'); 300 if ($adminBar.length == 0) return; 301 302 if ((G5Plus.common.isDesktop()) || ((scrollPosition >= $adminBarHeight) && ($adminBarPosition == 'absolute'))) { 303 $headerNavWrap.css({ 304 'top' : '' 305 }); 306 if (G5Plus.common.isDesktop() && $('#header-wrap').hasClass('header-2')) { 307 $headerNavWrap.css({ 308 'top' : $adminBarHeight + 'px' 309 }); 310 } 311 } else { 312 $headerNavWrap.css({ 313 'top' : $adminBarHeight + 'px' 314 }); 315 } 316 } 317 }; 318 319 G5Plus.featured = { 320 init: function(){ 321 this.height(); 322 this.next_prev(); 323 this.hide(); 324 this.responsive_vertical(); 325 this.active(); 326 }, 327 height: function(){ 328 var $height = $(".featured-area.single-image-large-2 .hover-effect").height(); 329 $(".featured-area.single-image-large-2 .owl-prev").css('height',$height); 330 $(".featured-area.single-image-large-2 .owl-next").css('height',$height); 331 }, 332 resize: function(){ 333 var $width = $(".featured-area.single-image-large-2 .hover-effect .content-middle").width()+20; 334 var $width_controls = $(".featured-area.single-image-large-2 .owl-next").width()+2; 335 var $space = ($width + $width_controls*2)/2; 336 $(".featured-area.single-image-large-2 .owl-prev").css('left',-$space); 337 $(".featured-area.single-image-large-2 .owl-next").css('right',-$space); 338 }, 339 next_prev: function(){ 340 $(".featured-area.single-image-medium-2 .button-prev").click(function(){ 341 $(".featured-area.single-image-medium-2 .owl-prev").click(); 342 }); 343 $(".featured-area.single-image-medium-2 .button-next").click(function(){ 344 $(".featured-area.single-image-medium-2 .owl-next").click(); 345 }); 346 var $margin = $(".featured-area.single-image-medium-2 .hover-effect").height(); 347 $(".featured-area.single-image-medium-2 .item").css('margin-bottom',$margin/2); 348 }, 349 hide: function(){ 350 $('.vertical-slider').on('afterChange', function(event, slick, currentSlide, nextSlide){ 351 $(".vertical-slider .item").css('display','block'); 352 var $index = $(".horizontal-slider .slick-active").attr("data-slick-index"); 353 $('.vertical-slider .item[data-slick-index= '+$index+']').css('display','none'); 354 }); 355 356 $('.horizontal-slider').on('beforeChange', function(event, slick, currentSlide, nextSlide){ 357 $(".vertical-slider .item").css('display','block'); 358 var $index = $(".horizontal-slider .slick-active").attr("data-slick-index"); 359 $('.vertical-slider .item[data-slick-index= '+$index+']').css('display','none'); 360 }); 361 }, 362 responsive_vertical: function() { 363 if (window.matchMedia('(max-width: ' + 991 + 'px)').matches) { 364 $('.vertical-slider').slick('unslick'); 365 $('.vertical-slider').slick({ 366 draggable: false, 367 slidesToShow: 2, 368 slidesToScroll: 1, 369 infinite: true, 370 arrows: false, 371 vertical: false, 372 centerMode: true, 373 rtl: isRTL, 374 verticalSwiping: false, 375 speed: 200, 376 }); 377 }; 378 if (window.matchMedia('(min-width: ' + 992 + 'px)').matches) { 379 $('.vertical-slider').slick('unslick'); 380 $('.vertical-slider').slick({ 381 draggable: false, 382 lazyLoad: 'ondemand', 383 speed: 300, 384 slidesToShow: 2, 385 vertical: true, 386 verticalSwiping: true, 387 arrows: false, 388 asNavFor: '.horizontal-slider', 389 focusOnSelect: true, 390 centerMode: true, 391 }); 392 }; 393 }, 394 active: function(){ 395 var active_cate = $('.feature-area.category-tab .categories-tab li.category-item.active a').html(); 396 $('.feature-area.category-tab .menu-mobile-tab .show-active').html(active_cate); 397 }, 398 click: function(){ 399 $('.feature-area.category-tab .menu-mobile-tab i.fa').click(function() { 400 $('.feature-area.category-tab .categories-tab li').css('display', 'block'); 401 $('.feature-area.category-tab .categories-tab').slideToggle('slow'); 402 var active_cate = $('.feature-area.category-tab .categories-tab li.category-item.active a').html(); 403 $('.feature-area.category-tab .menu-mobile-tab .show-active').html(active_cate); 404 $(this).toggleClass('active'); 405 $('.feature-area.category-tab .menu-mobile-tab').toggleClass('active'); 406 }) 407 } 408 }; 409 410 G5Plus.widget = { 411 init: function() { 412 this.categoryCaret(); 413 this.searchBox(); 414 }, 415 windowResized : function() { 416 this.searchBox(); 417 }, 418 categoryCaret: function() { 419 $('li', '.widget_categories, .widget_pages, .widget_nav_menu').each(function() { 420 if ($(' > ul', this).length > 0) { 421 $(this).append('<span class="li-caret"></span>'); 422 } 423 }); 424 $('.li-caret').on('click', function(){ 425 $(this).toggleClass('in'); 426 $(' > ul', $(this).parent()).slideToggle(); 427 }); 428 }, 429 searchBox: function() { 430 $('.search-form').each(function() { 431 var formWidth = $(this).width(); 432 var buttonWidth = $('button',$(this)).outerWidth(); 433 $('label',$(this)).width(formWidth - buttonWidth - 2); 434 }); 435 } 436 }; 437 438 G5Plus.blog = { 439 init : function() { 440 this.gridLayout(); 441 setTimeout(this.gridLayout,300); 442 this.masonryLayout(); 443 setTimeout(this.masonryLayout,300); 444 this.zigzagLayout(); 445 setTimeout(this.zigzagLayout,300); 446 this.postMeta(); 447 this.loadMore(); 448 this.infiniteScroll(); 449 this.process_quote(); 450 this.singleMetaTags(); 451 }, 452 windowResized : function() { 453 this.zigzagLayout(); 454 this.postMeta(); 455 this.process_quote(); 456 this.singleMetaTags(); 457 458 }, 459 postMeta : function() { 460 $('article.post-large-image .entry-meta-wrap,.post-x-medium-image .entry-meta-wrap').each(function(){ 461 var $this = $(this), 462 $moreLink = $('.entry-more-link',$this), 463 $meta = $('.entry-post-meta',$this); 464 $this.removeClass('center'); 465 if (($moreLink.width() + $meta.width()) > $this.width()) { 466 $this.addClass('center'); 467 } 468 }); 469 470 $('article.post-grid .entry-meta-inner').each(function() { 471 var $this = $(this), 472 $social = $('.social-share',$this), 473 $meta = $('.entry-post-meta',$this); 474 $this.removeClass('left'); 475 if (($social.width() + $meta.width()) > $this.width()) { 476 $this.addClass('left'); 477 } 478 }); 479 }, 480 loadMore : function() { 481 $('.paging-navigation').on('click','.blog-load-more',function(event){ 482 event.preventDefault(); 483 var $this = $(this).button('loading'), 484 link = $(this).attr('data-href'), 485 contentWrapper = '.blog-wrap', 486 element = '.blog-wrap article'; 487 488 $.get(link,function (data) { 489 var next_href = $('.blog-load-more', data).attr('data-href'), 490 $newElems = $(element, data).css({ 491 opacity: 0 492 });
493 $(contentWrapper).append($newElems); 494 495 $newElems.imagesLoaded({ background: true },function () { 496 G5Plus.blog.zigzagLayout(); 497 G5Plus.common.owlCarousel(); 498 G5Plus.common.prettyPhoto(); 499 G5Plus.blog.postMeta(); 500 G5Plus.blog.process_quote(); 501 502 $newElems.animate({ 503 opacity: 1 504 }); 505 506 if ($('.archive-wrap').hasClass('archive-1-large-image-grid') 507 || $('.archive-wrap').hasClass('archive-grid') 508 || $('.archive-wrap').hasClass('archive-masonry') 509 || $('.archive-wrap').hasClass('archive-large-image-grid') 510 ) { 511 $(contentWrapper).isotope('appended', $newElems); 512 setTimeout(function() { 513 $(contentWrapper).isotope('layout'); 514 }, 400); 515 } 516 }); 517 518 if (typeof(next_href) == 'undefined') { 519 $this.parent().remove(); 520 } else { 521 $this.button('reset'); 522 $this.attr('data-href', next_href); 523 } 524 }); 525 }); 526 }, 527 infiniteScroll : function() { 528 var $container = $('.blog-wrap'); 529 $container.infinitescroll({ 530 navSelector : '#infinite_scroll_button', // selector for the paged navigation 531 nextSelector : '#infinite_scroll_button a', // selector for the NEXT link (to page 2) 532 itemSelector : 'article', // selector for all items you'll retrieve 533 animate : true, 534 loading: { 535 finishedMsg: 'No more pages to load.', 536 selector: '#infinite_scroll_loading', 537 img: g5plus_app_variable.theme_url + 'assets/images/ajax-loader.gif', 538 msgText: 'Loading...' 539 } 540 },function(newElements){ 541 var $newElems = $(newElements).css({ 542 opacity: 0 543 }); 544 545 $newElems.imagesLoaded({ background: true },function () { 546 G5Plus.blog.zigzagLayout(); 547 G5Plus.common.owlCarousel(); 548 G5Plus.common.prettyPhoto(); 549 G5Plus.blog.postMeta(); 550 G5Plus.blog.process_quote(); 551 $newElems.animate({ 552 opacity: 1 553 }); 554 555 if ($('.archive-wrap').hasClass('archive-1-large-image-grid') 556 || $('.archive-wrap').hasClass('archive-grid') 557 || $('.archive-wrap').hasClass('archive-masonry') 558 || $('.archive-wrap').hasClass('archive-large-image-grid') 559 ) { 560 $container.isotope('appended', $newElems); 561 setTimeout(function() { 562 $container.isotope('layout'); 563 }, 400); 564 } 565 }); 566 }); 567 }, 568 gridLayout : function() { 569 var $container = $('.archive-1-large-image-grid .blog-wrap,.archive-grid .blog-wrap,.archive-large-image-grid .blog-wrap'); 570 $container.imagesLoaded({ background: true }, function() { 571 $container.isotope({ 572 itemSelector : 'article', 573 layoutMode: "fitRows", 574 isOriginLeft: !isRTL 575 }); 576 setTimeout(function () { 577 $container.isotope('layout'); 578 }, 500); 579 580 $('.owl-carousel').on('changed.owl.carousel', function(event) { 581 setTimeout(function () { 582 $container.isotope('layout'); 583 }, 500); 584 }); 585 586 }); 587 588 }, 589 masonryLayout : function() { 590 var $container = $('.archive-masonry .blog-wrap'); 591 $container.imagesLoaded({ background: true }, function() { 592 $container.isotope({ 593 itemSelector : 'article', 594 layoutMode: "masonry", 595 isOriginLeft: !isRTL 596 }); 597 setTimeout(function () { 598 $container.isotope('layout'); 599 }, 500); 600 601 $('.owl-carousel').on('changed.owl.carousel', function(event) { 602 setTimeout(function () { 603 $container.isotope('layout'); 604 }, 500); 605 606 }); 607 608 }); 609 610 611 }, 612 process_quote : function() { 613 $('article.post_format-post-format-quote,article.post_format-post-format-link').each(function(){ 614 var $wrap = $('.entry-thumb-wrap',$(this)), 615 $container = $('.entry-quote-content',$(this)), 616 $content = $('.block-center-inner',$(this)); 617 $wrap.removeClass('quote'); 618 if ($content.height() > $container.height()) { 619 $wrap.addClass('quote'); 620 } 621 }); 622 }, 623 zigzagLayout : function() { 624 $('.blog-wrap article.post-zigzag').each(function(){ 625 var $this = $(this); 626 if (window.matchMedia('(min-width: 992px)').matches) {
627 $('.entry-thumbnail',$(this)).css({ 628 'height': $('.entry-content-wrap',$this).outerHeight() 629 }); 630 } else { 631 $('.entry-thumbnail',$(this)).css({ 632 'height': '' 633 }); 634 } 635 }); 636 }, 637 singleMetaTags : function() { 638 var $container = $('article.post-single .entry-meta-tag-wrap'), 639 $tags = $('.entry-meta-tag',$container), 640 $social = $('.social-share',$container); 641 $container.removeClass('left'); 642 if (($tags.outerWidth() + $social.outerWidth()) > $container.outerWidth()) { 643 $container.addClass('left'); 644 } 645 } 646 }; 647 648 G5Plus.page = { 649 init : function(){ 650 this.backToTop(); 651 this.pageTransition(); 652 }, 653 windowLoad : function() { 654 this.fadePageIn(); 655 }, 656 backToTop : function() { 657 var $backToTop = $('.back-to-top'); 658 if ($backToTop.length > 0) { 659 $backToTop.click(function(event) { 660 event.preventDefault(); 661 $('html,body').animate({scrollTop: '0px'},800); 662 }); 663 $window.on('scroll', function (event) { 664 var scrollPosition = $window.scrollTop(); 665 var windowHeight = $window.height() / 2; 666 if (scrollPosition > windowHeight) { 667 $backToTop.addClass('in'); 668 } 669 else { 670 $backToTop.removeClass('in'); 671 } 672 }); 673 } 674 }, 675 pageTransition : function() { 676 if ($body.hasClass('page-transitions')) { 677 var linkElement = '.animsition-link, a[href]:not([target="_blank"]):not([href^="#"]):not([href*="javascript"]):not([href*=".jpg"]):not([href*=".jpeg"]):not([href*=".gif"]):not([href*=".png"]):not([href*=".mov"]):not([href*=".swf"]):not([href*=".mp4"]):not([href*=".flv"]):not([href*=".avi"]):not([href*=".mp3"]):not([href^="mailto:"]):not([class*="no-animation"]):not([class*="prettyPhoto"]):not([class*="add_to_wishlist"]):not([class*="add_to_cart_button"]):not([data-rel="prettyPhoto"]):not([class="comment-reply-link"]):not([id="cancel-comment-reply-link"])'; 678 $(linkElement).on('click', function(event) { 679 if ($( event.target ).closest($('.menu-caret', this)).length > 0) { 680 event.preventDefault(); 681 return; 682 } 683 event.preventDefault(); 684 var $self = $(this); 685 var url = $self.attr('href'); 686 687 // middle mouse button issue #24 688 // if(middle mouse button || command key || shift key || win control key) 689 if (event.which === 2 || event.metaKey || event.shiftKey || navigator.platform.toUpperCase().indexOf('WIN') !== -1 && event.ctrlKey) { 690 window.open(url, '_blank'); 691 } else { 692 G5Plus.page.fadePageOut(url); 693 } 694 695 }); 696 } 697 }, 698 fadePageOut: function(link) { 699 $('.site-loading').css('display', 'block').animate({ 700 opacity: 1, 701 delay: 200 702 }, 600, "linear" ); 703 704 //$('html,body').animate({scrollTop: '0px'},800); 705 706 setTimeout(function() { 707 window.location = link; 708 }, 600); 709 }, 710 fadePageIn : function() { 711 if ($body.hasClass('page-loading')) { 712 var preloadTime = 1000, 713 $loading = $('.site-loading'); 714 $loading.css('opacity', '0'); 715 setTimeout(function() { 716 $loading.css('display', 'none'); 717 }, preloadTime); 718 } 719 } 720 }; 721 722 G5Plus.events = { 723 onReady : function() { 724 G5Plus.common.init(); 725 G5Plus.header.init(); 726 G5Plus.menuMobile.init(); 727 G5Plus.widget.init(); 728 G5Plus.featured.init(); 729 G5Plus.featured.click(); 730 G5Plus.blog.init(); 731 G5Plus.page.init(); 732 }, 733 onLoad : function() { 734 G5Plus.header.windowLoad(); 735 G5Plus.featured.init(); 736 G5Plus.page.windowLoad(); 737 }, 738 onResize : function() { 739 G5Plus.header.windowResized(); 740 G5Plus.menuMobile.windowResized(); 741 G5Plus.widget.searchBox(); 742 G5Plus.featured.init(); 743 G5Plus.blog.windowResized(); 744 G5Plus.widget.windowResized(); 745 }, 746 onScroll : function() { 747 G5Plus.menuMobile.windowScroll(); 748 G5Plus.featured.height(); 749 G5Plus.featured.next_prev(); 750 G5Plus.header.sticky(); 751 752 } 753 }; 754 755 $(window).scroll(G5Plus.events.onScroll); 756 $(window).resize(G5Plus.events.onResize); 757 $(document).ready(G5Plus.events.onReady); 758 $(window).load(G5Plus.events.onLoad); 759 760 jQuery('#menu-item-316 a,#menu-item-317 a,#menu-item-318 a, #menu-item-281 a,#menu-item-282 a,#menu-item-283 a,.header-social-profile-wrap a,.social-profiles a,.download-footer a').attr('target','_blank'); 761 $('#menu-item-266 a').attr('target', '_blank'); 762 763 764
765 function init() { 766 window.addEventListener('scroll', function(e){ 767 var distanceY = window.pageYOffset || document.documentElement.scrollTop, 768 shrinkOn = 50, 769 header = document.querySelector("header"); 770 if (distanceY > shrinkOn) { 771 classie.add(header,"smaller"); 772 } else { 773 if (classie.has(header,"smaller")) { 774 classie.remove(header,"smaller"); 775 } 776 } 777 }); 778} 779window.onload = init(); 780 781 782 783})(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.