// Vimeo Vieo Function BoundlessNews_Vimeo(); function BoundlessNews_Vimeo(){ /*! vimeo-jquery-api 2016-05-05 */ !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"); $(".tooltips").mouseenter(function(){ $(this).find('span').empty().append($(this).attr('data-tooltip')); }); // Scroll To $(".scroll-content").click(function () { $('html, body').animate({ scrollTop: $(".site-content").offset().top }, 500); }); // Rating disable if (boundlessnews_custom.single_post == 1 && boundlessnews_custom.boundlessnews_ed_post_reaction) { $('.tpk-single-rating').remove(); $('.tpk-comment-rating-label').remove(); $('.comments-rating').remove(); $('.tpk-star-rating').remove(); } // Add Class on article $('.theme-article-area').each(function () { $(this).addClass('theme-article-loaded'); }); // Aub Menu Toggle $('.submenu-toggle').click(function () { $(this).toggleClass('button-toggle-active'); var currentClass = $(this).attr('data-toggle-target'); $(currentClass).toggleClass('submenu-toggle-active'); }); if ($(window).width() > b) { var c = $(".header-affix").height(); $(window).on("scroll", { previousTop: 0 }, function () { var b = $(window).scrollTop(); b < this.previousTop ? b > 0 && $(".header-affix").hasClass("is-fixed") ? $(".header-affix").addClass("is-visible") : $(".header-affix").removeClass("is-visible is-fixed") : ($(".header-affix").removeClass("is-visible"), b > c && !$(".header-affix").hasClass("is-fixed") && $(".header-affix").addClass("is-fixed")), this.previousTop = b; $(window).scroll(function(){ if( $('#site-header').hasClass('is-fixed') ){ $('.current-news-title').addClass('twp-read-slidein'); }else{ $('.current-news-title').removeClass('twp-read-slidein'); } }); }); } // Header Search show $('.header-searchbar').click(function () { $('.header-searchbar').removeClass('header-searchbar-active'); }); $(".header-searchbar-inner").click(function (e) { e.stopPropagation(); //stops click event from reaching document }); // Header Search hide $('#search-closer').click(function () { $('.header-searchbar').removeClass('header-searchbar-active'); setTimeout(function () { $('.navbar-control-search').focus(); }, 300); $('body').removeClass('body-scroll-locked'); }); // Focus on search input on search icon expand $('.navbar-control-search').click(function(){ $('.header-searchbar').toggleClass('header-searchbar-active'); setTimeout(function () { $('.header-searchbar .search-field').focus(); }, 300); $('body').addClass('body-scroll-locked'); }); $( 'input, a, button' ).on( 'focus', function() { if ( $( '.header-searchbar' ).hasClass( 'header-searchbar-active' ) ) { if( $(this).hasClass('skip-link-search-top') ){ $('.header-searchbar #search-closer').focus(); } if ( ! $( this ).parents( '.header-searchbar' ).length ) { $('.header-searchbar .search-field').focus(); } } } ); $(document).keyup(function(j) { if (j.key === "Escape") { // escape key maps to keycode `27` if ( $( '.header-searchbar' ).hasClass( 'header-searchbar-active' ) ) { $('.header-searchbar').removeClass('header-searchbar-active'); $('body').removeClass('body-scroll-locked'); setTimeout(function () { $('.navbar-control-search').focus(); }, 300); } if ( $( 'body' ).hasClass( 'boundlessnews-trending-news-active' ) ) { $('.trending-news-main-wrap').slideToggle(); $('body').toggleClass('boundlessnews-trending-news-active'); $('.navbar-control-trending-news').focus(); } } }); // Action On Esc Button $(document).keyup(function (j) { if (j.key === "Escape") { // escape key maps to keycode `27` if( $('#offcanvas-menu').hasClass('offcanvas-menu-active') ){ $('.header-searchbar').removeClass('header-searchbar-active'); $('#offcanvas-menu').removeClass('offcanvas-menu-active'); $('.navbar-control-offcanvas').removeClass('active'); $('body').removeClass('body-scroll-locked'); setTimeout(function () { $('.navbar-control-offcanvas').focus(); }, 300); } } }); // Toggle Menu $('.navbar-control-offcanvas').click(function () { $(this).addClass('active'); $('body').addClass('body-scroll-locked'); $('#offcanvas-menu').toggleClass('offcanvas-menu-active'); $('.button-offcanvas-close').focus(); }); // Offcanvas Close $('.offcanvas-close .button-offcanvas-close').click(function () { $('#offcanvas-menu').removeClass('offcanvas-menu-active'); $('.navbar-control-offcanvas').removeClass('active'); $('body').removeClass('body-scroll-locked'); setTimeout(function () { $('.navbar-control-offcanvas').focus(); }, 300); }); // Offcanvas Close $('#offcanvas-menu').click(function () { $('#offcanvas-menu').removeClass('offcanvas-menu-active'); $('.navbar-control-offcanvas').removeClass('active'); $('body').removeClass('body-scroll-locked'); }); $(".offcanvas-wraper").click(function (e) { e.stopPropagation(); //stops click event from reaching document }); // Offcanvas re focus on close button $('input, a, button').on('focus', function () { if ($('#offcanvas-menu').hasClass('offcanvas-menu-active')) { if( $(this).hasClass('skip-link-off-canvas') ){ if( !$("#offcanvas-menu #social-nav-offcanvas").length == 0 ){ $("#offcanvas-menu #social-nav-offcanvas ul li:last-child a").focus(); }else if( !$("#offcanvas-menu #primary-nav-offcanvas").length == 0 ){ $("#offcanvas-menu #primary-nav-offcanvas ul li:last-child a").focus(); } } } }); $('.skip-link-offcanvas').focus(function(){ $(".button-offcanvas-close").focus(); }); // Trending News Start $('.navbar-control-trending-news').click(function(){ $('.trending-news-main-wrap').slideToggle(); $('body').toggleClass('boundlessnews-trending-news-active'); $('#trending-collapse').focus(); }); $('.boundlessnews-skip-link-end').focus(function(){ $('#trending-collapse').focus(); }); $('.boundlessnews-skip-link-start').focus(function(){ $('.trending-news-main-wrap .column:last-child .entry-meta a').focus(); }); $('#trending-collapse').click(function(){ $('.trending-news-main-wrap').slideToggle(); $('body').toggleClass('boundlessnews-trending-news-active'); $('.navbar-control-trending-news').focus(); }); // Trending News End var rtled = false; if( $('body').hasClass('rtl') ){ rtled = true; } // Single Post content gallery slide $("figure.wp-block-gallery.has-nested-images.columns-1, .wp-block-gallery.columns-1 ul.blocks-gallery-grid, .gallery-columns-1").each(function () { $(this).slick({ slidesToShow: 1, slidesToScroll: 1, fade: true, autoplay: false, autoplaySpeed: 8000, infinite: true, nextArrow: '', prevArrow: '', dots: false, rtl: rtled }); }); // Content Gallery popup Start $('.entry-content .gallery, .widget .gallery, .wp-block-gallery').each(function () { $(this).magnificPopup({ delegate: 'a', type: 'image', closeOnContentClick: false, closeBtnInside: false, mainClass: 'mfp-with-zoom mfp-img-mobile', image: { verticalFit: true, titleSrc: function (item) { return item.el.attr('title'); } }, gallery: { enabled: true }, zoom: { enabled: true, duration: 300, opener: function (element) { return element.find('img'); } } }); }); // Content Gallery popup End // Carousel Block Home $(".theme-carousel-slider").each(function () { $(this).slick({ slidesToShow: 3, slidesToScroll: 3, autoplaySpeed: 8000, infinite: true, prevArrow: $(this).closest('.theme-block-carousel').find('.slide-prev-1'), nextArrow: $(this).closest('.theme-block-carousel').find('.slide-next-1'), responsive: [ { breakpoint: 991, settings: { slidesToShow: 2, slidesToScroll: 2 } }, { breakpoint: 550, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); }); // Carousel Block Home $(".theme-carousel-sliderwidget").each(function () { $(this).slick({ slidesToShow: 3, slidesToScroll: 1, autoplaySpeed: 8000, infinite: true, prevArrow: $(this).closest('.theme-block-widgetarea').find('.slide-prev-1'), nextArrow: $(this).closest('.theme-block-widgetarea').find('.slide-next-1'), responsive: [ { breakpoint: 991, settings: { slidesToShow: 2 } }, { breakpoint: 480, settings: { slidesToShow: 1 } } ] }); }); // Slider Block Home Image and content $(".theme-banner-default").each(function () { $(this).slick({ slidesToShow: 1, slidesToScroll: 1, fade: true, autoplay: true, speed: 500, autoplaySpeed: 7000, infinite: true, dots: false, arrows: false, asNavFor: '.theme-default-slicknav', }); }); // Slider Block Home Navigation $('.theme-default-slicknav').slick({ slidesToShow: 4, slidesToScroll: 4, asNavFor: '.theme-banner-default', dots: false, arrows: false, focusOnSelect: true, responsive: [ { breakpoint: 991, settings: { slidesToShow: 2 } }, { breakpoint: 640, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); // Slider Block Home Image and content $(".theme-banner-vertical").each(function () { $(this).slick({ slidesToShow: 1, slidesToScroll: 1, fade: true, autoplay: true, speed: 500, autoplaySpeed: 7000, infinite: true, dots: false, arrows: false, asNavFor: '.theme-vertical-slicknav', }); }); $('.theme-vertical-slicknav').slick({ slidesToShow: 4, slidesToScroll: 1, vertical: true, verticalSwiping: true, asNavFor: '.theme-banner-vertical', dots: false, arrows: false, focusOnSelect: true }); $(".theme-slider-widget-main").each(function () { $(this).slick({ slidesToShow: 1, slidesToScroll: 1, fade: true, autoplay: true, autoplaySpeed: 8000, infinite: true, nextArrow: '', prevArrow: '', dots: false, }); }); $(".theme-slider-block").each(function () { $(this).slick({ slidesToShow: 1, slidesToScroll: 1, fade: true, autoplay: false, autoplaySpeed: 8000, infinite: true, prevArrow: $(this).closest('.theme-block-elements').find('.slide-prev-lead'), nextArrow: $(this).closest('.theme-block-elements').find('.slide-next-lead'), dots: false, }); }); // Banner Block 1 $(".theme-main-slider-block").each(function () { $(this).slick({ slidesToShow: 1, slidesToScroll: 1, fade: true, autoplay: false, autoplaySpeed: 8000, infinite: true, prevArrow: $(this).closest('.theme-block-middlearea').find('.slide-prev-lead'), nextArrow: $(this).closest('.theme-block-middlearea').find('.slide-next-lead'), dots: false, }); }); $(".twp-marquee").each(function () { $(this).slick({ speed: 8000, autoplay: true, autoplaySpeed: 0, cssEase: 'linear', focusOnSelect: true, pauseOnHover:true, infinite: true, slidesToShow: 1, slidesToScroll: 1, variableWidth: true, arrows : false, dots: false, }); }); // Ticker Post Slider $(".ticker-slides").each(function () { $(this).slick({ slidesToShow: 4, slidesToScroll: 1, fade: false, draggable: true, autoplay: true, autoplaySpeed: 1000, infinite: true, nextArrow: '.slide-next-ticker', prevArrow: '.slide-prev-ticker', dots: false, responsive: [ { breakpoint: 1400, settings: { slidesToShow: 3 } }, { breakpoint: 991, settings: { slidesToShow: 2 } }, { breakpoint: 768, settings: { slidesToShow: 1 } } ] }); // Pause Autoplay on click $('.ticker-control-pause').click(function() { $('.ticker-slides').slick('slickPause'); $(this).removeClass('pp-button-active'); $('.ticker-control-play').addClass('pp-button-active'); }); // Autoplay active on click $('.ticker-control-play').click(function() { $('.ticker-slides').slick('slickPlay'); $(this).removeClass('pp-button-active'); $('.ticker-control-pause').addClass('pp-button-active'); }); }); $(".main-banner-vertical").each(function () { $(this).slick({ slidesToShow: 4, slidesToScroll: 1, autoplay: true, autoplaySpeed: 8000, speed: 1000, vertical: true, verticalSwiping: true, prevArrow: $(this).closest('.main-banner-vertical-nav').find('.slide-prev-lead'), nextArrow: $(this).closest('.main-banner-vertical-nav').find('.slide-next-lead'), focusOnSelect: true }); }); var pageSection = $(".data-bg"); pageSection.each(function (indx) { if ($(this).attr("data-background")) { $(this).css("background-image", "url(" + $(this).data("background") + ")"); } }); // Masonry Grid if ($('.archive-layout-masonry').length > 0) { /*Default masonry animation*/ var grid; var hidden = 'scale(0.5)'; var visible = 'scale(1)'; grid = $('.archive-layout-masonry').imagesLoaded(function () { grid.masonry({ itemSelector: '.theme-article-area', hiddenStyle: { transform: hidden, opacity: 0 }, visibleStyle: { transform: visible, opacity: 1 } }); }); } // Sticky Components $('.widget-area, .post-content-share').theiaStickySidebar({ additionalMarginTop: 30 }); // Widget Tab $('.twp-nav-tabs .tab').on('click', function (event) { var tabid = $(this).attr('id'); $(this).closest('.tabbed-container').find('.tab').removeClass('active'); $(this).addClass('active'); $(this).closest('.tabbed-container').find('.tab-pane').removeClass('active'); $('#content-' + tabid).addClass('active'); }); // Scroll to Top on Click $('.to-the-top').click(function () { $("html, body").animate({ scrollTop: 0 }, 700); return false; }); }); /* ----------------------------------------------------------------------------------------------- Intrinsic Ratio Embeds --------------------------------------------------------------------------------------------------- */ var boundlessnews = boundlessnews || {}, $ = jQuery; var $doc = $(document), $win = $(window), viewport = {}; viewport.top = $win.scrollTop(); viewport.bottom = viewport.top + $win.height(); boundlessnews.instrinsicRatioVideos = { init: function () { boundlessnews.instrinsicRatioVideos.makeFit(); $win.on('resize fit-videos', function () { boundlessnews.instrinsicRatioVideos.makeFit(); }); }, makeFit: function () { var vidSelector = "iframe, object, video"; $(vidSelector).each(function () { var $video = $(this), $container = $video.parent(), iTargetWidth = $container.width(); // Skip videos we want to ignore if ($video.hasClass('intrinsic-ignore') || $video.parent().hasClass('intrinsic-ignore')) { return true; } if (!$video.attr('data-origwidth')) { // Get the video element proportions $video.attr('data-origwidth', $video.attr('width')); $video.attr('data-origheight', $video.attr('height')); } // Get ratio from proportions var ratio = iTargetWidth / $video.attr('data-origwidth'); // Scale based on ratio, thus retaining proportions $video.css('width', iTargetWidth + 'px'); $video.css('height', ($video.attr('data-origheight') * ratio) + 'px'); }); } }; $doc.ready(function () { boundlessnews.instrinsicRatioVideos.init(); // Retain aspect ratio of videos on window resize }); function BoundlessNews_SetCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+ d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } function BoundlessNews_GetCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for(var i = 0; i