1jQuery(document).ready(function ($) { 2 3 var ajaxurl = newsfort_pagination.ajax_url; 4 5 function newsfort_is_on_screen(elem) { 6 7 if ($(elem)[0]) { 8 9 var tmtwindow = jQuery(window); 10 var viewport_top = tmtwindow.scrollTop(); 11 var viewport_height = tmtwindow.height(); 12 var viewport_bottom = viewport_top + viewport_height; 13 var tmtelem = jQuery(elem); 14 var top = tmtelem.offset().top; 15 var height = tmtelem.height(); 16 var bottom = top + height; 17 return (top >= viewport_top && top < viewport_bottom) || 18 (bottom > viewport_top && bottom <= viewport_bottom) || 19 (height > viewport_height && top <= viewport_top && bottom >= viewport_bottom); 20 } 21 } 22 23 var n = window.TWP_JS || {}; 24 var paged = parseInt(newsfort_pagination.paged) + 1; 25 var maxpage = newsfort_pagination.maxpage; 26 var nextLink = newsfort_pagination.nextLink; 27 var loadmore = newsfort_pagination.loadmore; 28 var loading = newsfort_pagination.loading; 29 var nomore = newsfort_pagination.nomore; 30 var pagination_layout = newsfort_pagination.pagination_layout; 31 32 $('.twp-loading-button').click(function () { 33 if ((!$('.twp-no-posts').hasClass('twp-no-posts'))) { 34 35 $('.twp-loading-button').text(loading); 36 $('.twp-loging-status').addClass('twp-ajax-loading'); 37 $('.twp-loaded-content').load(nextLink + ' .twp-archive-items', function () { 38 if (paged < 10) { 39 var newlink = nextLink.substring(0, nextLink.length - 2); 40 } else { 41 42 var newlink = nextLink.substring(0, nextLink.length - 3); 43 } 44 paged++; 45 nextLink = newlink + paged + '/'; 46 if (paged > maxpage) { 47 $('.twp-loading-button').addClass('twp-no-posts'); 48 $('.twp-loading-button').text(nomore); 49 } else { 50 $('.twp-loading-button').text(loadmore); 51 } 52 53 $('.twp-loaded-content .twp-archive-items').each(function(){ 54 $(this).addClass(paged + '-twp-article-ajax'); 55 }); 56 57 $('.twp-ajax-post-load .theme-video-panel').each(function(){ 58 59 var autoplay = $(this).attr('data-autoplay'); 60 var vidURL = $(this).find('iframe').attr('src'); 61 62 if( vidURL ){ 63 64 if( vidURL.indexOf('youtube.com') != -1 ){ 65 66 if( autoplay == 'autoplay-enable' ){ 67 68 $(this).find('iframe').attr('src',vidURL+'&enablejsapi=1&autoplay=1&mute=1&rel=0&modestbranding=0&autohide=0&showinfo=0&controls=0&loop=1'); 69 70 }else{ 71 72 $(this).find('iframe').attr('src',vidURL+'&enablejsapi=1&mute=1'); 73 74 } 75 76 } 77 78 if( vidURL.indexOf('vimeo.com') != -1 ){ 79 80 if( autoplay == 'autoplay-enable' ){ 81 82 $(this).find('iframe').attr('src',vidURL+'&title=0&byline=0&portrait=0&transparent=0&autoplay=1&controls=0&loop=1'); 83 84 }else{ 85 86 $(this).find('iframe').attr('src',vidURL+'&title=0&byline=0&portrait=0&transparent=0&autoplay=0&controls=0&loop=1'); 87 88 } 89 90 91 } 92 93 } 94 95 }); 96 97 var lodedContent = $('.twp-loaded-content').html(); 98 $('.twp-loaded-content').html(''); 99 100 if ($('.article-wraper').hasClass('archive-layout-masonry')) { 101 102 if ($('.archive-layout-masonry').length > 0) { 103 var content = $(lodedContent); 104 content.hide(); 105 grid = $('.archive-layout-masonry'); 106 grid.append(content); 107 grid.imagesLoaded(function () { 108 content.show(); 109 110 var winwidth = $(window).width(); 111 $(window).resize(function () { 112 winwidth = $(window).width(); 113 }); 114 115 if (winwidth > 990) { 116 grid.masonry('appended', content).masonry(); 117 } else { 118 grid.masonry('appended', content); 119 } 120 121 }); 122 } 123 124 } else { 125 126 $('.content-area .article-wraper').append(lodedContent); 127 128 } 129 130 $('.twp-loging-status').removeClass('twp-ajax-loading'); 131 132 $('.twp-archive-items').each(function () { 133 134 if (!$(this).hasClass('twp-article-loaded')) { 135 136 $(this).addClass(paged + '-twp-article-ajax'); 137 $(this).addClass('twp-article-loaded'); 138 $(this).find('.theme-video-panel').addClass( paged + '-twp-video-ajax' ); 139 $(this).find('.theme-video-panel').removeClass('video-main-wraper'); 140 } 141 142 }); 143 144 var action = []; 145 var iframe; 146 var src; 147 var ratio_class; 148 149 NewsFort_Vimeo(); 150 NewsFort_Video( paged + '-twp-video-ajax', paged + '-twp-video-ajax-2' ); 151 152 onYouTubePlayerAPIReady(); 153 function onYouTubePlayerAPIReady() { 154 155 jQuery(document).ready(function ($) { 156 "use strict"; 157 NewsFortYoutubeVideo( '.'+paged + '-twp-video-ajax-2' ); 158 159 }); 160 } 161
162 // Inject YouTube API script 163 var tag = document.createElement('script'); 164 tag.src = "https://www.youtube.com/player_api"; 165 var firstScriptTag = document.getElementsByTagName('script')[0]; 166 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 167 168 // Single Post content gallery slide 169 $( '.'+paged + '-twp-article-ajax ul.wp-block-gallery.columns-1, .'+paged + '-twp-article-ajax .wp-block-gallery.columns-1 .blocks-gallery-grid, .'+paged + '-twp-article-ajax .gallery-columns-1').each(function () { 170 $(this).slick({ 171 slidesToShow: 1, 172 slidesToScroll: 1, 173 fade: true, 174 autoplay: false, 175 autoplaySpeed: 8000, 176 infinite: true, 177 nextArrow: '<button type="button" class="slide-btn slide-btn-bg slide-next-icon">'+newsfort_custom.next_svg+'</button>', 178 prevArrow: '<button type="button" class="slide-btn slide-btn-bg slide-prev-icon">'+newsfort_custom.prev_svg+'</button>', 179 dots: false, 180 }); 181 }); 182 183 // Content Gallery popup Start 184 $('.entry-content .gallery, .widget .gallery, .wp-block-gallery, .zoom-gallery').each(function () { 185 $(this).magnificPopup({ 186 delegate: 'a', 187 type: 'image', 188 closeOnContentClick: false, 189 closeBtnInside: false, 190 mainClass: 'mfp-with-zoom mfp-img-mobile', 191 image: { 192 verticalFit: true, 193 titleSrc: function (item) { 194 return item.el.attr('title'); 195 } 196 }, 197 gallery: { 198 enabled: true 199 }, 200 zoom: { 201 enabled: true, 202 duration: 300, 203 opener: function (element) { 204 return element.find('img'); 205 } 206 } 207 }); 208 }); 209 210 // Content Gallery popup End 211 212 $('.twp-archive-items').each(function(){ 213 $(this).removeClass(paged + '-twp-article-ajax'); 214 }); 215 216 }); 217 218 } 219 }); 220 221 if (pagination_layout == 'auto-load') { 222 $(window).scroll(function () { 223 224 if (!$('.newsfort-auto-pagination').hasClass('twp-ajax-loading') && !$('.newsfort-auto-pagination').hasClass('twp-no-posts') && maxpage > 1 && newsfort_is_on_screen('.newsfort-auto-pagination')) { 225 $('.newsfort-auto-pagination').addClass('twp-ajax-loading'); 226 $('.newsfort-auto-pagination').text(loading); 227 228 $('.twp-loaded-content').load(nextLink + ' .twp-archive-items', function () { 229 230 if (paged < 10) { 231 var newlink = nextLink.substring(0, nextLink.length - 2); 232 } else { 233 234 var newlink = nextLink.substring(0, nextLink.length - 3); 235 } 236 paged++; 237 nextLink = newlink + paged + '/'; 238 if (paged > maxpage) { 239 $('.newsfort-auto-pagination').addClass('twp-no-posts'); 240 $('.newsfort-auto-pagination').text(nomore); 241 } else { 242 $('.newsfort-auto-pagination').removeClass('twp-ajax-loading'); 243 $('.newsfort-auto-pagination').text(loadmore); 244 } 245 246 $('.twp-loaded-content .twp-archive-items').each(function(){ 247 $(this).addClass(paged + '-twp-article-ajax'); 248 }); 249 250 var lodedContent = $('.twp-loaded-content').html(); 251 252 $('.twp-loaded-content').html(''); 253 254 if ($('.article-wraper').hasClass('archive-layout-masonry')) { 255 256 if ($('.archive-layout-masonry').length > 0) { 257 var content = $(lodedContent); 258 content.hide(); 259 grid = $('.archive-layout-masonry'); 260 grid.append(content); 261 grid.imagesLoaded(function () { 262 content.show(); 263 264 var winwidth = $(window).width(); 265 $(window).resize(function () { 266 winwidth = $(window).width(); 267 }); 268 269 if (winwidth > 990) { 270 grid.masonry('appended', content).masonry(); 271 } else { 272 grid.masonry('appended', content); 273 } 274 275 }); 276 } 277 278 } else { 279 280 $('.content-area .article-wraper').append(lodedContent); 281 282 } 283 284 $('.newsfort-auto-pagination').removeClass('twp-ajax-loading'); 285 286 $('.twp-archive-items').each(function(){ 287 $(this).removeClass(paged + '-twp-article-ajax'); 288 }); 289 290 291 }); 292 } 293 294 }); 295 } 296 297 $(window).scroll(function () { 298 299 if (!$('.twp-single-infinity').hasClass('twp-single-loading') && $('.twp-single-infinity').attr('loop-count') <= 3 && newsfort_is_on_screen('.twp-single-infinity')) { 300 301 $('.twp-single-infinity').addClass('twp-single-loading'); 302 var loopcount = $('.twp-single-infinity').attr('loop-count'); 303 var postid = $('.twp-single-infinity').attr('next-post'); 304 305 var data = { 306 'action': 'newsfort_single_infinity', 307 '_wpnonce': newsfort_pagination.ajax_nonce, 308 'postid': postid, 309 }; 310 311 $.post(ajaxurl, data, function (response) { 312 313 if (response) { 314 var content = response.data.content.join(''); 315 var content = $(content); 316 $('.twp-single-infinity').before(content); 317 var newpostid = response.data.postid['0']; 318 $('.twp-single-infinity').attr('next-post', newpostid); 319 320 $('article#post-' + postid + ' ul.wp-block-gallery.columns-1, article#post-' + postid + ' .wp-block-gallery.columns-1 .blocks-gallery-grid, article#post-' + postid + ' .gallery-columns-1').each(function () { 321 $(this).slick({ 322 slidesToShow: 1, 323 slidesToScroll: 1, 324 fade: true, 325 autoplay: true, 326 autoplaySpeed: 8000, 327 infinite: true, 328 nextArrow: '<button type="button" class="slide-btn slide-btn-bg slide-next-icon">'+newsfort_custom.next_svg+'</button>', 329 prevArrow: '<button type="button" class="slide-btn slide-btn-bg slide-prev-icon">'+newsfort_custom.prev_svg+'</button>', 330 dots: false 331 }); 332 }); 333 334 $('article').each(function () { 335 336 if ($('body').hasClass('booster-extension') && $(this).hasClass('after-load-ajax') ) { 337 338 var cid = $(this).attr('id'); 339 $(this).addClass( cid ); 340 341 likedislike(cid); 342 booster_extension_post_reaction(cid); 343 344 } 345 346 $(this).removeClass('after-load-ajax'); 347 348 }); 349 350 } 351 352 $('.twp-single-infinity').removeClass('twp-single-loading'); 353 loopcount++; 354 $('.twp-single-infinity').attr('loop-count', loopcount); 355 356 }); 357 358 } 359 360 });
361 362});
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.