1// Vimeo Vieo Function 2NewsFort_Vimeo(); 3function NewsFort_Vimeo(){ 4 5 /*! vimeo-jquery-api 2016-05-05 */ 6 !function(a,b){var c={catchMethods:{methodreturn:[],count:0},init:function(b){;var c,d,e;b.originalEvent.origin.match(/vimeo/gi)&&"data"in b.originalEvent&&(e="string"===a.type(b.originalEvent.data)?a.parseJSON(b.originalEvent.data):b.originalEvent.data,e&&(c=this.setPlayerID(e),c.length&&(d=this.setVimeoAPIurl(c),e.hasOwnProperty("event")&&this.handleEvent(e,c,d),e.hasOwnProperty("method")&&this.handleMethod(e,c,d))))},setPlayerID:function(b){return a("iframe[src*="+b.player_id+"]")},setVimeoAPIurl:function(a){return"http"!==a.attr("src").substr(0,4)?"https:"+a.attr("src").split("?")[0]:a.attr("src").split("?")[0]},handleMethod:function(a){this.catchMethods.methodreturn.push(a.value)},handleEvent:function(b,c,d){switch(b.event.toLowerCase()){case"ready":for(var e in a._data(c[0],"events"))e.match(/loadProgress|playProgress|play|pause|finish|seek|cuechange/)&&c[0].contentWindow.postMessage(JSON.stringify({method:"addEventListener",value:e}),d);if(c.data("vimeoAPICall")){for(var f=c.data("vimeoAPICall"),g=0;g<f.length;g++)c[0].contentWindow.postMessage(JSON.stringify(f[g].message),f[g].api);c.removeData("vimeoAPICall")}c.data("vimeoReady",!0),c.triggerHandler("ready");break;case"seek":c.triggerHandler("seek",[b.data]);break;case"loadprogress":c.triggerHandler("loadProgress",[b.data]);break;case"playprogress":c.triggerHandler("playProgress",[b.data]);break;case"pause":c.triggerHandler("pause");break;case"finish":c.triggerHandler("finish");break;case"play":c.triggerHandler("play");break;case"cuechange":c.triggerHandler("cuechange")}}},d=a.fn.vimeoLoad=function(){var b=a(this).attr("src"),c=!1;if("https:"!==b.substr(0,6)&&(b="http"===b.substr(0,4)?"https"+b.substr(4):"https:"+b,c=!0),null===b.match(/player_id/g)){c=!0;var d=-1===b.indexOf("?")?"?":"&",e=a.param({api:1,player_id:"vvvvimeoVideo-"+Math.floor(1e7*Math.random()+1).toString()});b=b+d+e}return c&&a(this).attr("src",b),this};jQuery(document).ready(function(){a("iframe[src*='vimeo.com']").each(function(){d.call(this)})}),a(["loadProgress","playProgress","play","pause","finish","seek","cuechange"]).each(function(b,d){jQuery.event.special[d]={setup:function(){var b=a(this).attr("src");if(a(this).is("iframe")&&b.match(/vimeo/gi)){var e=a(this);if("undefined"!=typeof e.data("vimeoReady"))e[0].contentWindow.postMessage(JSON.stringify({method:"addEventListener",value:d}),c.setVimeoAPIurl(a(this)));else{var f="undefined"!=typeof e.data("vimeoAPICall")?e.data("vimeoAPICall"):[];f.push({message:d,api:c.setVimeoAPIurl(e)}),e.data("vimeoAPICall",f)}}}}}),a(b).on("message",function(a){c.init(a)}),a.vimeo=function(a,d,e){var f={},g=c.catchMethods.methodreturn.length;if("string"==typeof d&&(f.method=d),void 0!==typeof e&&"function"!=typeof e&&(f.value=e),a.is("iframe")&&f.hasOwnProperty("method"))if(a.data("vimeoReady"))a[0].contentWindow.postMessage(JSON.stringify(f),c.setVimeoAPIurl(a));else{var h=a.data("vimeoAPICall")?a.data("vimeoAPICall"):[];h.push({message:f,api:c.setVimeoAPIurl(a)}),a.data("vimeoAPICall",h)}return"get"!==d.toString().substr(0,3)&&"paused"!==d.toString()||"function"!=typeof e||(!function(a,d,e){var f=b.setInterval(function(){c.catchMethods.methodreturn.length!=a&&(b.clearInterval(f),d(c.catchMethods.methodreturn[e]))},10)}(g,e,c.catchMethods.count),c.catchMethods.count++),a},a.fn.vimeo=function(b,c){return a.vimeo(this,b,c)}}(jQuery,window); 7 8} 9 10// global variable for the action 11var action = []; 12var iframe = document.getElementsByClassName("video-main-wraper"); 13var src; 14var ratio_class; 15 16NewsFort_Video(); 17NewsFort_Video('video-main-wraper-2'); 18function NewsFort_Video( VideoWraperClass = '', youtubeClass = 'twp-iframe-video-youtube' ){ 19 20 if( VideoWraperClass ){ 21 iframe = document.getElementsByClassName(VideoWraperClass); 22 } 23 24 Array.prototype.forEach.call(iframe, function(el) { 25 // Do stuff here 26 var id = el.getAttribute("data-id"); 27 var autoplay = el.getAttribute("data-autoplay"); 28 if( autoplay == 'autoplay-enable' ){ 29 autoplay = 1; 30 }else{ 31 autoplay = 0; 32 } 33 jQuery(document).ready(function ($) { 34 "use strict"; 35 36 src = $(el).find('iframe').attr('src'); 37 38 if( src ){ 39 40 if( src.indexOf('youtube.com') != -1 ){ 41 42 $(el).find('iframe').attr('width',''); 43 $(el).find('iframe').attr('height',''); 44 $(el).find('iframe').attr('id',id); 45 $(el).find('iframe').addClass(youtubeClass); 46 if( autoplay ){ 47 48 $(el).find('iframe').attr('src',src+'&enablejsapi=1&autoplay=1&mute=1&rel=0&modestbranding=0&autohide=0&showinfo=0&controls=0&loop=1'); 49 50 }else{ 51 52 $(el).find('iframe').attr('src',src+'&enablejsapi=1'); 53 54 } 55 56 57 } 58 59 if( src.indexOf('vimeo.com') != -1 ){ 60 61 $(el).find('iframe').attr('id',id); 62 $(el).find('iframe').addClass('twp-iframe-video-vimeo'); 63 64 if( autoplay ){ 65 66 $(el).find('iframe').attr('src',src+'&title=0&byline=0&portrait=0&transparent=0&autoplay=1&controls=0&loop=1'); 67 68 }else{ 69 70 $(el).find('iframe').attr('src',src+'&title=0&byline=0&portrait=0&transparent=0&autoplay=0&controls=0&loop=1'); 71 72 } 73 74 $(el).find('iframe').attr('allow','autoplay;'); 75 76 var player = document.getElementById(id); 77 $(player).vimeo("setVolume", 0); 78 79 $('#'+id).closest('.entry-video').find('.twp-mute-unmute').on('click',function(){ 80 81 if( $(this).hasClass('unmute') ){ 82 83 $(player).vimeo("setVolume", 1); 84 $(this).removeClass('unmute'); 85 $(this).addClass('mute'); 86 87 $(this).find('.twp-video-control-action').empty(); 88 $(this).find('.twp-video-control-action').html(newsfort_custom.unmute); 89 $(this).find('.screen-reader-text').html(newsfort_custom.unmute_text); 90 91 }else if( $(this).hasClass('mute') ){ 92 93 $(player).vimeo("setVolume", 0); 94 $(this).removeClass('mute'); 95 $(this).addClass('unmute'); 96 $(this).find('.twp-video-control-action').empty(); 97 $(this).find('.twp-video-control-action').html(newsfort_custom.mute) 98 99 } 100 101 }); 102 103 $('#'+id).closest('.entry-video').find('.twp-pause-play').on('click',function(){ 104 105 if( $(this).hasClass('play') ){ 106 107 $(player).vimeo('play'); 108 109 $(this).removeClass('play'); 110 $(this).addClass('pause'); 111 $(this).find('.twp-video-control-action').html(newsfort_custom.pause); 112 $(this).find('.screen-reader-text').html(newsfort_custom.pause_text); 113 114 }else if( $(this).hasClass('pause') ){ 115 116 $(player).vimeo('pause'); 117 $(this).removeClass('pause'); 118 $(this).addClass('play'); 119 $(this).find('.twp-video-control-action').html(newsfort_custom.play); 120 $(this).find('.screen-reader-text').html(newsfort_custom.play_text); 121 122 } 123 124 }); 125 126 } 127 128 }else{ 129 130 var currentVideo; 131 132 $(el).find('video').attr('loop','loop'); 133 $(el).find('video').attr('autoplay','autoplay'); 134 $(el).find('video').removeAttr('controls'); 135 $(el).find('video').attr('id',id); 136 137 $('#'+id).closest('.entry-video').find('.twp-mute-unmute').on('click',function(){ 138 139 if( $(this).hasClass('unmute') ){ 140 141 currentVideo = document.getElementById(id); 142 $(currentVideo).prop('muted', false); 143 144 $(this).removeClass('unmute'); 145 $(this).addClass('mute'); 146 $(this).find('.twp-video-control-action').html(newsfort_custom.unmute); 147 $(this).find('.screen-reader-text').html(newsfort_custom.unmute_text); 148 149 }else if( $(this).hasClass('mute') ){ 150 151 currentVideo = document.getElementById(id); 152 $(currentVideo).prop('muted', true); 153 $(this).removeClass('mute'); 154 $(this).addClass('unmute'); 155 $(this).find('.twp-video-control-action').html(newsfort_custom.mute) 156 157 } 158 159 }); 160 161 162 if( autoplay ){ 163 164 setTimeout(function(){ 165 166 if( $('#'+id).length ){ 167 168 currentVideo = document.getElementById(id); 169 currentVideo.play(); 170 171 } 172 173 },3000); 174 175 } 176 177 $('#'+id).closest('.entry-video').find('.twp-pause-play').on('click',function(){ 178 179 if( $(this).hasClass('play') ){ 180 181 currentVideo = document.getElementById(id); 182 currentVideo.play(); 183 184 $(this).removeClass('play'); 185 $(this).addClass('pause'); 186 $(this).find('.twp-video-control-action').html(newsfort_custom.pause); 187 $(this).find('.screen-reader-text').html(newsfort_custom.pause_text); 188 189 }else if( $(this).hasClass('pause') ){ 190 191 currentVideo = document.getElementById(id); 192 currentVideo.pause(); 193 194 $(this).removeClass('pause'); 195 $(this).addClass('play'); 196 $(this).find('.twp-video-control-action').html(newsfort_custom.play); 197 $(this).find('.screen-reader-text').html(newsfort_custom.play_text); 198 199 } 200 201 }); 202 203 } 204 205 }); 206 207 }); 208 209} 210 211// this function gets called when API is ready to use 212function onYouTubePlayerAPIReady() { 213 214 jQuery(document).ready(function ($) { 215 "use strict"; 216 217 NewsFortYoutubeVideo('.twp-iframe-video-youtube'); 218 219 }); 220} 221 222 223function NewsFortYoutubeVideo( YTVideoClass = '' ){ 224 225 $( YTVideoClass ).each(function(){ 226 227 var id = $(this).attr('id'); 228 229 // create the global action from the specific iframe (#video) 230 action[id] = new YT.Player(id, { 231 events: { 232 // call this function when action is ready to use 233 'onReady': function onReady() { 234 235 var autoplay = $(this).closest('.theme-video-panel').attr('data-autoplay'); 236 if( autoplay == 'autoplay-enable' ){ 237 action[id].playVideo(); 238 } 239 240 $('#'+id).closest('.entry-video').find('.twp-pause-play').on('click',function(){ 241 242 var id = $(this).attr('attr-id'); 243 244 if( $(this).hasClass('play') ){ 245 246 action[id].playVideo(); 247 248 $(this).removeClass('play'); 249 $(this).addClass('pause'); 250 $(this).find('.twp-video-control-action').html(newsfort_custom.pause); 251 $(this).find('.screen-reader-text').html(newsfort_custom.pause_text); 252 253 }else if( $(this).hasClass('pause') ){ 254 255 action[id].pauseVideo(); 256 $(this).removeClass('pause'); 257 $(this).addClass('play'); 258 $(this).find('.twp-video-control-action').html(newsfort_custom.play); 259 $(this).find('.screen-reader-text').html(newsfort_custom.play_text); 260 261 } 262 263 264 }); 265 266 $('#'+id).closest('.entry-video').find('.twp-mute-unmute').on('click',function(){ 267 268 var id = $(this).attr('attr-id'); 269 if( $(this).hasClass('unmute') ){ 270 271 action[id].unMute(); 272 273 $(this).removeClass('unmute'); 274 $(this).addClass('mute'); 275 $(this).find('.twp-video-control-action').html(newsfort_custom.unmute); 276 $(this).find('.screen-reader-text').html(newsfort_custom.unmute_text); 277 278 }else if( $(this).hasClass('mute') ){ 279 280 action[id].mute(); 281 $(this).removeClass('mute'); 282 $(this).addClass('unmute'); 283 $(this).find('.twp-video-control-action').html(newsfort_custom.mute); 284 $(this).find('.screen-reader-text').html(newsfort_custom.mute_text); 285 286 } 287 288 289 }); 290 291 }, 292 } 293 }); 294 295 }); 296 297} 298
299// Inject YouTube API script 300var tag = document.createElement('script'); 301tag.src = "https://www.youtube.com/player_api"; 302var firstScriptTag = document.getElementsByTagName('script')[0]; 303firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 304 305 306window.addEventListener("load", function(){ 307 308 jQuery(document).ready(function($){ 309 "use strict"; 310 311 $("body").addClass("page-loaded"); 312 313 }); 314 315}); 316 317// Responsive Content Render Function 318var renderMenu; 319var menuContentMain; 320function newsfort_responsive_content( renderMenu ){ 321 322 jQuery(document).ready(function ($) { 323 "use strict"; 324 325 if( !menuContentMain ){ 326 327 menuContentMain = $('div#site-topbar').html(); 328 329 } 330 331 if( $(window).width() <= 991 ){ 332 333 var dateContent = $('.top-nav-date').html(); 334 var menuContent = $('.top-nav-menu').html(); 335 336 $('.responsive-content-date').html(dateContent); 337 $('.responsive-content-menu').html(menuContent); 338 $('div#site-topbar').empty(); 339 340 341 }else{ 342 343 $('.responsive-content-date').empty(); 344 $('.responsive-content-menu').empty(); 345 346 if( renderMenu ){ 347 348 $('div#site-topbar').html( menuContentMain ); 349 350 } 351 352 } 353 354 }); 355 356} 357 358jQuery(document).ready(function ($) { 359 "use strict"; 360 361 // Responsive Content 362 newsfort_responsive_content( renderMenu = false ); 363 364 $(window).resize(function(){ 365 366 newsfort_responsive_content( renderMenu = true ); 367 368 }); 369 370 // Hide Comments 371 $('.newsfort-no-comment .booster-block.booster-ratings-block, .newsfort-no-comment .comment-form-ratings, .newsfort-no-comment .twp-star-rating').hide(); 372 373 $('.tooltips').append("<span></span>"); 374 $(".tooltips").mouseenter(function(){ 375 $(this).find('span').empty().append($(this).attr('data-tooltip')); 376 }); 377 378 // Scroll To 379 $(".scroll-content").click(function () { 380 $('html, body').animate({ 381 scrollTop: $(".site-content").offset().top 382 }, 500); 383 }); 384 385 // Rating disable 386 if (newsfort_custom.single_post == 1 && newsfort_custom.newsfort_ed_post_reaction) { 387 388 $('.tpk-single-rating').remove(); 389 $('.tpk-comment-rating-label').remove(); 390 $('.comments-rating').remove(); 391 $('.tpk-star-rating').remove(); 392 393 } 394 395 // Add Class on article 396 $('.twp-archive-items').each(function () { 397 $(this).addClass('twp-article-loaded'); 398 }); 399 400 $(window).scroll(function () { 401 if ($(window).scrollTop() > 350) { 402 $("#site-header").addClass("site-header-fixed"); 403 } else { 404 $("#site-header").removeClass("site-header-fixed"); 405 } 406 }); 407 408 // Aub Menu Toggle 409 $('.submenu-toggle').click(function () { 410 411 $(this).toggleClass('button-toggle-active'); 412 var currentClass = $(this).attr('data-toggle-target'); 413 $(currentClass).toggleClass('submenu-toggle-active'); 414 415 }); 416 417 // Header Search show 418 $('.header-searchbar').click(function () { 419 420 $('.header-searchbar').removeClass('header-searchbar-active'); 421 422 }); 423 424 $(".header-searchbar-inner").click(function (e) { 425 426 e.stopPropagation(); //stops click event from reaching document 427 428 }); 429 430 // Header Search hide 431 $('#search-closer').click(function () { 432 433 $('.header-searchbar').removeClass('header-searchbar-active'); 434 setTimeout(function () { 435 436 $('.navbar-control-search').focus(); 437 438 }, 300); 439 440 $('body').removeClass('body-scroll-locked'); 441 442 }); 443 444 // Focus on search input on search icon expand 445 $('.navbar-control-search').click(function(){ 446 447 $('.header-searchbar').toggleClass('header-searchbar-active'); 448 449 setTimeout(function () { 450 451 $('.header-searchbar .search-field').focus(); 452 }, 300); 453 454 $('body').addClass('body-scroll-locked'); 455 456 }); 457 458 $( 'input, a, button' ).on( 'focus', function() { 459 if ( $( '.header-searchbar' ).hasClass( 'header-searchbar-active' ) ) { 460 461 if( $(this).hasClass('skip-link-search-top') ){ 462 $('.header-searchbar #search-closer').focus(); 463 } 464 465 if ( ! $( this ).parents( '.header-searchbar' ).length ) { 466 $('.header-searchbar .search-field').focus(); 467 } 468 } 469 } ); 470 471 $(document).keyup(function(j) { 472 if (j.key === "Escape") { // escape key maps to keycode `27` 473 if ( $( '.header-searchbar' ).hasClass( 'header-searchbar-active' ) ) { 474 475 $('.header-searchbar').removeClass('header-searchbar-active'); 476 $('body').removeClass('body-scroll-locked'); 477 478 setTimeout(function () { 479 $('.navbar-control-search').focus(); 480 }, 300); 481 482 } 483 484 if ( $( 'body' ).hasClass( 'newsfort-trending-news-active' ) ) { 485 486 $('.trending-news-main-wrap').slideToggle(); 487 $('body').toggleClass('newsfort-trending-news-active'); 488 $('.navbar-control-trending-news').focus(); 489 } 490 } 491 }); 492 493 // Action On Esc Button 494 $(document).keyup(function (j) { 495 if (j.key === "Escape") { // escape key maps to keycode `27` 496 497 if( $('#offcanvas-menu').hasClass('offcanvas-menu-active') ){ 498 499 $('.header-searchbar').removeClass('header-searchbar-active'); 500 $('#offcanvas-menu').removeClass('offcanvas-menu-active'); 501 $('.navbar-control-offcanvas').removeClass('active'); 502 $('body').removeClass('body-scroll-locked'); 503 504 setTimeout(function () { 505 $('.navbar-control-offcanvas').focus(); 506 }, 300); 507 508 } 509 } 510 }); 511 512 // Toggle Menu 513 $('.navbar-control-offcanvas').click(function () { 514 515 $(this).addClass('active'); 516 $('body').addClass('body-scroll-locked'); 517 $('#offcanvas-menu').toggleClass('offcanvas-menu-active'); 518 $('.button-offcanvas-close').focus(); 519 520 }); 521 522 // Offcanvas Close 523 $('.offcanvas-close .button-offcanvas-close').click(function () { 524 525 $('#offcanvas-menu').removeClass('offcanvas-menu-active'); 526 $('.navbar-control-offcanvas').removeClass('active'); 527 $('body').removeClass('body-scroll-locked'); 528 529 setTimeout(function () { 530 $('.navbar-control-offcanvas').focus(); 531 }, 300); 532 533 }); 534 535 // Offcanvas Close 536 $('#offcanvas-menu').click(function () { 537 538 $('#offcanvas-menu').removeClass('offcanvas-menu-active'); 539 $('.navbar-control-offcanvas').removeClass('active'); 540 $('body').removeClass('body-scroll-locked'); 541 542 }); 543 544 $(".offcanvas-wraper").click(function (e) { 545 546 e.stopPropagation(); //stops click event from reaching document 547 548 }); 549 550 // Offcanvas re focus on close button 551 $('input, a, button').on('focus', function () { 552 if ($('#offcanvas-menu').hasClass('offcanvas-menu-active')) { 553 554 if( $(this).hasClass('skip-link-off-canvas') ){ 555 556 if( !$("#offcanvas-menu #social-nav-offcanvas").length == 0 ){ 557 558 $("#offcanvas-menu #social-nav-offcanvas ul li:last-child a").focus(); 559 560 }else if( !$("#offcanvas-menu #primary-nav-offcanvas").length == 0 ){ 561 562 $("#offcanvas-menu #primary-nav-offcanvas ul li:last-child a").focus(); 563 564 } 565 } 566 567 568 569 } 570 }); 571 572 $('.skip-link-offcanvas').focus(function(){ 573 574 $(".button-offcanvas-close").focus(); 575 576 }); 577 578 // Trending News Start 579 580 $('.navbar-control-trending-news').click(function(){ 581 582 $('.trending-news-main-wrap').slideToggle(); 583 $('body').toggleClass('newsfort-trending-news-active'); 584 $('#trending-collapse').focus(); 585 586 }); 587 588 $('.newsfort-skip-link-end').focus(function(){ 589 $('#trending-collapse').focus(); 590 }); 591 592 $('.newsfort-skip-link-start').focus(function(){ 593 $('.trending-news-main-wrap .column:last-child span.posted-on a').focus(); 594 }); 595 596 $('#trending-collapse').click(function(){ 597 598 $('.trending-news-main-wrap').slideToggle(); 599 $('body').toggleClass('newsfort-trending-news-active'); 600 $('.navbar-control-trending-news').focus(); 601 602 }); 603 604 // Trending News End 605 606 // Single Post content gallery slide 607 $("ul.wp-block-gallery.columns-1, .wp-block-gallery.columns-1 .blocks-gallery-grid, .gallery-columns-1").each(function () { 608 $(this).slick({ 609 slidesToShow: 1, 610 slidesToScroll: 1, 611 fade: true, 612 autoplay: false, 613 autoplaySpeed: 8000, 614 infinite: true, 615 nextArrow: '<button type="button" class="slide-btn slide-btn-bg slide-next-icon">'+newsfort_custom.next_svg+'</button>', 616 prevArrow: '<button type="button" class="slide-btn slide-btn-bg slide-prev-icon">'+newsfort_custom.prev_svg+'</button>', 617 dots: false, 618 }); 619 }); 620 621 // Content Gallery popup Start 622 $('.entry-content .gallery, .widget .gallery, .wp-block-gallery, .zoom-gallery').each(function () { 623 $(this).magnificPopup({ 624 delegate: 'a', 625 type: 'image', 626 closeOnContentClick: false, 627 closeBtnInside: false, 628 mainClass: 'mfp-with-zoom mfp-img-mobile', 629 image: { 630 verticalFit: true, 631 titleSrc: function (item) { 632 return item.el.attr('title'); 633 } 634 }, 635 gallery: { 636 enabled: true 637 }, 638 zoom: { 639 enabled: true, 640 duration: 300, 641 opener: function (element) { 642 return element.find('img'); 643 } 644 } 645 }); 646 }); 647 648 // Content Gallery popup End 649 650 // Footer Affix Slider 651 $(".affix-carousel").each(function () { 652 653 $(this).slick({ 654 autoplay: true, 655 accessibility: true, 656 slidesToShow: 4, 657 slidesToScroll: 1, 658 autoplaySpeed: 8000, 659 infinite: true, 660 nextArrow: '<button type="button" class="slide-btn slide-btn-bg slide-next-icon">'+newsfort_custom.next_svg+'</button>', 661 prevArrow: '<button type="button" class="slide-btn slide-btn-bg slide-prev-icon">'+newsfort_custom.prev_svg+'</button>', 662 responsive: [ 663 { 664 breakpoint: 991, 665 settings: { 666 slidesToShow: 3 667 } 668 }, 669 { 670 breakpoint: 768, 671 settings: { 672 slidesToShow: 2 673 } 674 }, 675 { 676 breakpoint: 480, 677 settings: { 678 slidesToShow: 1 679 } 680 } 681 ] 682 }); 683 684 }); 685 686 $(window).scroll(function () { 687 688 if ($(window).scrollTop() > $(window).height() / 2) { 689 690 $(".affix-panel-content").addClass('active-scrollpanel').css({'opacity': 1}); 691 692 } else { 693 694 $(".affix-panel-content").removeClass('active-scrollpanel').css({'opacity': 0}); 695 696 } 697 698 }); 699 700 // Popup Newsletter Start 701 if( Newsfort_GetCookie('NewsfortAffix') == 'true' ){ 702 703 $('.drawer-handle').addClass('rec-panel-active'); 704 $('html').addClass('affix-panel-disabled'); 705 $('html').css({'padding-bottom': 0}); 706 707 } 708 709 // Footer Affix hide and show 710 $('.affix-panel-content').each(function () { 711 712 var post_bar = $(this); 713 var post_button = $(this).siblings('.drawer-handle'); 714 715 if( Newsfort_GetCookie('NewsfortAffix') == 'false' ){ 716 717 if (post_bar.hasClass("affix-panel-content")) { 718 $('html').animate({'padding-bottom': 115}, 200); 719 } 720 721 } 722 723 $(this).on('click', '.affix-handle-close', function () { 724 725 post_button.addClass('rec-panel-active'); 726 $('html').animate({'padding-bottom': 0}, 200); 727 $('html').addClass('affix-panel-disabled'); 728
729 Newsfort_SetCookie('NewsfortAffix', 'true',365); 730 731 $('.drawer-handle-open').focus(); 732 }); 733 734 post_button.on('click', function () { 735 736 $('.affix-handle-close').focus(); 737 post_button.removeClass('rec-panel-active'); 738 $('html').animate({'padding-bottom': 115}, 200); 739 $('html').removeClass('affix-panel-disabled'); 740 Newsfort_SetCookie('NewsfortAffix', 'false',365); 741 742 }); 743 744 }); 745 746 747 748 // Carousel Block Home 749 $(".theme-carousel-slider").each(function () { 750 751 $(this).slick({ 752 slidesToShow: 4, 753 slidesToScroll: 4, 754 autoplaySpeed: 8000, 755 infinite: true, 756 prevArrow: $(this).closest('.theme-block-carousel').find('.slide-prev-1'), 757 nextArrow: $(this).closest('.theme-block-carousel').find('.slide-next-1'), 758 responsive: [ 759 { 760 breakpoint: 991, 761 settings: { 762 slidesToShow: 3, 763 slidesToScroll: 3 764 } 765 }, 766 { 767 breakpoint: 768, 768 settings: { 769 slidesToShow: 2, 770 slidesToScroll: 2 771 } 772 }, 773 { 774 breakpoint: 480, 775 settings: { 776 slidesToShow: 1, 777 slidesToScroll: 1 778 } 779 } 780 ] 781 }); 782 783 }); 784 785 // Carousel Block Home 786 $(".theme-carousel-sliderwidget").each(function () { 787 788 $(this).slick({ 789 slidesToShow: 4, 790 slidesToScroll: 4, 791 autoplaySpeed: 8000, 792 infinite: true, 793 prevArrow: $(this).closest('.theme-block-widgetarea').find('.slide-prev-1'), 794 nextArrow: $(this).closest('.theme-block-widgetarea').find('.slide-next-1'), 795 responsive: [ 796 { 797 breakpoint: 991, 798 settings: { 799 slidesToShow: 3, 800 slidesToScroll: 3 801 } 802 }, 803 { 804 breakpoint: 768, 805 settings: { 806 slidesToShow: 2, 807 slidesToScroll: 2 808 } 809 }, 810 { 811 breakpoint: 480, 812 settings: { 813 slidesToShow: 1, 814 slidesToScroll: 1 815 } 816 } 817 ] 818 }); 819 820 }); 821 822 // Slider Block Home Image and content 823 $(".theme-slider-main").each(function () { 824 825 $(this).slick({ 826 slidesToShow: 1, 827 slidesToScroll: 1, 828 fade: true, 829 autoplay: true, 830 autoplaySpeed: 8000, 831 infinite: true, 832 dots: false, 833 arrows: false, 834 asNavFor: '.theme-slider-navigator', 835 }); 836 837 }); 838 839 // Slider Block Home Navigation 840 $('.theme-slider-navigator').slick({ 841 842 slidesToShow: 3, 843 slidesToScroll: 1, 844 asNavFor: '.theme-slider-main', 845 infinite: true, 846 dots: false, 847 arrows: false, 848 focusOnSelect: true, 849 responsive: [ 850 { 851 breakpoint: 991, 852 settings: { 853 slidesToShow: 2 854 } 855 }, 856 { 857 breakpoint: 640, 858 settings: { 859 slidesToShow: 1, 860 slidesToScroll: 1 861 } 862 } 863 ] 864 865 }); 866 867 // Slider Block Home Image and content 868 $(".theme-slider-main-1").each(function () { 869 870 $(this).slick({ 871 slidesToShow: 1, 872 slidesToScroll: 1, 873 fade: true, 874 autoplay: true, 875 autoplaySpeed: 8000, 876 infinite: true, 877 nextArrow: '<button type="button" class="slide-btn slide-btn-bg slide-next-icon">'+newsfort_custom.next_svg+'</button>', 878 prevArrow: '<button type="button" class="slide-btn slide-btn-bg slide-prev-icon">'+newsfort_custom.prev_svg+'</button>', 879 dots: false, 880 }); 881 882 }); 883 884 // Banner Block 1 885 $(".theme-slider-block").each(function () { 886 887 $(this).slick({ 888 slidesToShow: 1, 889 slidesToScroll: 1, 890 fade: true, 891 autoplay: false, 892 autoplaySpeed: 8000, 893 infinite: true, 894 prevArrow: $(this).closest('.theme-block-elements').find('.slide-prev-lead'), 895 nextArrow: $(this).closest('.theme-block-elements').find('.slide-next-lead'), 896 dots: false, 897 }); 898 899 }); 900 901 // Banner Block 1 902 $(".theme-main-slider-block").each(function () { 903 904 $(this).slick({ 905 slidesToShow: 1, 906 slidesToScroll: 1, 907 fade: true, 908 autoplay: false, 909 autoplaySpeed: 8000, 910 infinite: true, 911 nextArrow: '<button type="button" class="slide-btn slide-btn-bg slide-next-icon">'+newsfort_custom.next_svg+'</button>', 912 prevArrow: '<button type="button" class="slide-btn slide-btn-bg slide-prev-icon">'+newsfort_custom.prev_svg+'</button>', 913 dots: false, 914 }); 915 916 }); 917 918 if( newsfort_custom.wide_layout ){ 919 var slideToShow = 4; 920 }else{ 921 var slideToShow = 3; 922 } 923 // Ticker Post Slider 924 $(".ticker-slides").each(function () { 925 926 $(this).slick({ 927 slidesToShow: slideToShow, 928 slidesToScroll: 1, 929 fade: false, 930 draggable: true, 931 autoplay: true, 932 autoplaySpeed: 1000, 933 infinite: true, 934 nextArrow: '.slide-next-ticker', 935 prevArrow: '.slide-prev-ticker', 936 dots: false, 937 responsive: [ 938 { 939 breakpoint: 1400, 940 settings: { 941 slidesToShow: 3 942 } 943 }, 944 { 945 breakpoint: 991, 946 settings: { 947 slidesToShow: 2 948 } 949 }, 950 { 951 breakpoint: 768, 952 settings: { 953 slidesToShow: 1 954 } 955 } 956 ] 957 }); 958 959 // Pause Autoplay on click 960 $('.ticker-control-pause').click(function() { 961 $('.ticker-slides').slick('slickPause'); 962 $(this).removeClass('pp-button-active'); 963 $('.ticker-control-play').addClass('pp-button-active'); 964 }); 965 966 // Autoplay active on click 967 $('.ticker-control-play').click(function() { 968 $('.ticker-slides').slick('slickPlay'); 969 $(this).removeClass('pp-button-active'); 970 $('.ticker-control-pause').addClass('pp-button-active'); 971 }); 972 973 974 }); 975 976 977 978 $(".main-banner-vertical").each(function () { 979 980 $(this).slick({ 981 slidesToShow: 4, 982 slidesToScroll: 1, 983 autoplay: true, 984 autoplaySpeed: 8000, 985 speed: 1000, 986 vertical: true, 987 verticalSwiping: true,
988 nextArrow: false, 989 prevArrow: false, 990 focusOnSelect: true 991 992 }); 993 994 }); 995 996 var pageSection = $(".data-bg"); 997 pageSection.each(function (indx) { 998 999 if ($(this).attr("data-background")) { 1000 1001 $(this).css("background-image", "url(" + $(this).data("background") + ")"); 1002 1003 } 1004 1005 }); 1006 1007 // Masonry Grid 1008 if ($('.archive-layout-masonry').length > 0) { 1009 1010 /*Default masonry animation*/ 1011 var grid; 1012 var hidden = 'scale(0.5)'; 1013 var visible = 'scale(1)'; 1014 grid = $('.archive-layout-masonry').imagesLoaded(function () { 1015 grid.masonry({ 1016 itemSelector: '.twp-archive-items', 1017 hiddenStyle: { 1018 transform: hidden, 1019 opacity: 0 1020 }, 1021 visibleStyle: { 1022 transform: visible, 1023 opacity: 1 1024 } 1025 }); 1026 }); 1027 1028 } 1029 1030 // Masonry Script 1031 if ( $('.all-item-content').length > 0 ) { 1032 1033 /*Default masonry animation*/ 1034 var grid1; 1035 var hidden1 = 'scale(0.5)'; 1036 var visible1 = 'scale(1)'; 1037 grid1 = $('.all-item-content').imagesLoaded(function () { 1038 grid1.masonry({ 1039 itemSelector: '.twp-masonary-item', 1040 hiddenStyle: { 1041 transform: hidden1, 1042 opacity: 0 1043 }, 1044 visibleStyle: { 1045 transform: visible1, 1046 opacity: 1 1047 } 1048 }); 1049 }); 1050 1051 } 1052 1053 // Sticky Components 1054 $('.widget-area, .post-content-share').theiaStickySidebar({ 1055 additionalMarginTop: 30 1056 }); 1057 1058 // Widget Tab 1059 $('.twp-nav-tabs .tab').on('click', function (event) { 1060 1061 var tabid = $(this).attr('id'); 1062 $(this).closest('.tabbed-container').find('.tab').removeClass('active'); 1063 $(this).addClass('active'); 1064 $(this).closest('.tabbed-container').find('.tab-pane').removeClass('active'); 1065 $('#content-' + tabid).addClass('active'); 1066 1067 }); 1068 1069 // Scroll TO Top Hide & show 1070 1071 $(window).scroll(function () { 1072 1073 if ($(window).scrollTop() > $(window).height() / 2) { 1074 $('.scroll-up').addClass('enable-scroll-up'); 1075 } else { 1076 $('.scroll-up').removeClass('enable-scroll-up'); 1077 } 1078 1079 if( $(window).scrollTop() > $(window).height() / 2 ){ 1080 $('body').addClass('theme-floatingbar-active'); 1081 1082 }else{ 1083 $('body').removeClass('theme-floatingbar-active'); 1084 1085 } 1086 1087 }); 1088 1089 // Scroll to Top on Click 1090 $('.scroll-up').click(function () { 1091 1092 $("html, body").animate({ 1093 scrollTop: 0 1094 }, 700); 1095 1096 return false; 1097 1098 }); 1099 1100 var progressPath = document.querySelector('.scroll-up path'); 1101 if( progressPath ){ 1102 1103 var pathLength = progressPath.getTotalLength(); 1104 progressPath.style.transition = progressPath.style.WebkitTransition = 'none'; 1105 progressPath.style.strokeDasharray = pathLength + ' ' + pathLength; 1106 progressPath.style.strokeDashoffset = pathLength; 1107 progressPath.getBoundingClientRect(); 1108 progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 300ms linear'; 1109 1110 var updateProgress = function() { 1111 var scroll = $(window).scrollTop(); 1112 var height = $(document).height() - $(window).height(); 1113 var progress = pathLength - (scroll * pathLength / height); 1114 progressPath.style.strokeDashoffset = progress; 1115 }; 1116 1117 updateProgress(); 1118 $(window).scroll(updateProgress); 1119 1120 } 1121 1122}); 1123 1124 1125/* ----------------------------------------------------------------------------------------------- 1126 Intrinsic Ratio Embeds 1127--------------------------------------------------------------------------------------------------- */ 1128 1129var newsfort = newsfort || {}, 1130 $ = jQuery; 1131 1132var $doc = $(document), 1133 $win = $(window), 1134 1135viewport = {}; 1136viewport.top = $win.scrollTop(); 1137viewport.bottom = viewport.top + $win.height(); 1138 1139newsfort.instrinsicRatioVideos = { 1140 1141 init: function () { 1142 1143 newsfort.instrinsicRatioVideos.makeFit(); 1144 1145 $win.on('resize fit-videos', function () { 1146 1147 newsfort.instrinsicRatioVideos.makeFit(); 1148 1149 }); 1150 1151 }, 1152 1153 makeFit: function () { 1154 1155 var vidSelector = "iframe, object, video"; 1156 1157 $(vidSelector).each(function () { 1158 1159 var $video = $(this), 1160 $container = $video.parent(), 1161 iTargetWidth = $container.width(); 1162 1163 // Skip videos we want to ignore 1164 if ($video.hasClass('intrinsic-ignore') || $video.parent().hasClass('intrinsic-ignore')) { 1165 return true; 1166 } 1167 1168 if (!$video.attr('data-origwidth')) { 1169 1170 // Get the video element proportions 1171 $video.attr('data-origwidth', $video.attr('width')); 1172 $video.attr('data-origheight', $video.attr('height')); 1173 1174 } 1175 1176 // Get ratio from proportions 1177 var ratio = iTargetWidth / $video.attr('data-origwidth'); 1178 1179 // Scale based on ratio, thus retaining proportions 1180 $video.css('width', iTargetWidth + 'px'); 1181 $video.css('height', ($video.attr('data-origheight') * ratio) + 'px'); 1182 1183 }); 1184 1185 } 1186 1187}; 1188 1189$doc.ready(function () { 1190 1191 newsfort.instrinsicRatioVideos.init(); // Retain aspect ratio of videos on window resize 1192 1193}); 1194
1195function Newsfort_SetCookie(cname, cvalue, exdays) { 1196 1197 var d = new Date(); 1198 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 1199 var expires = "expires="+ d.toUTCString(); 1200 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 1201 1202} 1203 1204function Newsfort_GetCookie(cname) { 1205 1206 var name = cname + "="; 1207 var decodedCookie = decodeURIComponent(document.cookie); 1208 var ca = decodedCookie.split(';'); 1209 1210 for(var i = 0; i <ca.length; i++) { 1211 1212 var c = ca[i]; 1213 1214 while (c.charAt(0) == ' ') { 1215 1216 c = c.substring(1); 1217 1218 } 1219 1220 if (c.indexOf(name) == 0) { 1221 1222 return c.substring(name.length, c.length); 1223 1224 } 1225 1226 } 1227 1228 return ""; 1229}
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.