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 var rtled = false; 170 if ($('body').hasClass('rtl')) { 171 rtled = true; 172 } 173 $( '.'+paged + '-twp-article-ajax figure.wp-block-gallery.has-nested-images.columns-1, .'+paged + '-twp-article-ajax .wp-block-gallery.columns-1 ul.blocks-gallery-grid, .'+paged + '-twp-article-ajax .gallery-columns-1').each(function () { 174 $(this).slick({ 175 slidesToShow: 1, 176 slidesToScroll: 1, 177 fade: true, 178 autoplay: false, 179 autoplaySpeed: 8000, 180 infinite: true, 181 nextArrow: '<button type="button" class="slide-btn slide-btn-bg slide-next-icon">'+newsfort_custom.next_svg+'</button>', 182 prevArrow: '<button type="button" class="slide-btn slide-btn-bg slide-prev-icon">'+newsfort_custom.prev_svg+'</button>', 183 dots: false, 184 rtl: rtled 185 }); 186 }); 187 188 // Content Gallery popup Start 189 $('.entry-content .gallery, .widget .gallery, .wp-block-gallery, .zoom-gallery').each(function () { 190 $(this).magnificPopup({ 191 delegate: 'a', 192 type: 'image', 193 closeOnContentClick: false, 194 closeBtnInside: false, 195 mainClass: 'mfp-with-zoom mfp-img-mobile', 196 image: { 197 verticalFit: true, 198 titleSrc: function (item) { 199 return item.el.attr('title'); 200 } 201 }, 202 gallery: { 203 enabled: true 204 }, 205 zoom: { 206 enabled: true, 207 duration: 300, 208 opener: function (element) { 209 return element.find('img'); 210 } 211 } 212 }); 213 }); 214 215 // Content Gallery popup End 216 217 $('.twp-archive-items').each(function(){ 218 $(this).removeClass(paged + '-twp-article-ajax'); 219 }); 220 221 }); 222 223 } 224 }); 225 226 if (pagination_layout == 'auto-load') { 227 $(window).scroll(function () { 228 229 if (!$('.newsfort-auto-pagination').hasClass('twp-ajax-loading') && !$('.newsfort-auto-pagination').hasClass('twp-no-posts') && maxpage > 1 && newsfort_is_on_screen('.newsfort-auto-pagination')) { 230 $('.newsfort-auto-pagination').addClass('twp-ajax-loading'); 231 $('.newsfort-auto-pagination').text(loading); 232 233 $('.twp-loaded-content').load(nextLink + ' .twp-archive-items', function () { 234 235 if (paged < 10) { 236 var newlink = nextLink.substring(0, nextLink.length - 2); 237 } else { 238 239 var newlink = nextLink.substring(0, nextLink.length - 3); 240 } 241 paged++; 242 nextLink = newlink + paged + '/'; 243 if (paged > maxpage) { 244 $('.newsfort-auto-pagination').addClass('twp-no-posts'); 245 $('.newsfort-auto-pagination').text(nomore); 246 } else { 247 $('.newsfort-auto-pagination').removeClass('twp-ajax-loading'); 248 $('.newsfort-auto-pagination').text(loadmore); 249 } 250 251 $('.twp-loaded-content .twp-archive-items').each(function(){ 252 $(this).addClass(paged + '-twp-article-ajax'); 253 }); 254 255 var lodedContent = $('.twp-loaded-content').html(); 256 257 $('.twp-loaded-content').html(''); 258 259 if ($('.article-wraper').hasClass('archive-layout-masonry')) { 260 261 if ($('.archive-layout-masonry').length > 0) { 262 var content = $(lodedContent); 263 content.hide(); 264 grid = $('.archive-layout-masonry'); 265 grid.append(content); 266 grid.imagesLoaded(function () { 267 content.show(); 268 269 var winwidth = $(window).width(); 270 $(window).resize(function () { 271 winwidth = $(window).width(); 272 }); 273 274 if (winwidth > 990) { 275 grid.masonry('appended', content).masonry(); 276 } else { 277 grid.masonry('appended', content); 278 } 279 280 }); 281 } 282 283 } else { 284 285 $('.content-area .article-wraper').append(lodedContent); 286 287 } 288 289 $('.newsfort-auto-pagination').removeClass('twp-ajax-loading'); 290 291 $('.twp-archive-items').each(function(){ 292 $(this).removeClass(paged + '-twp-article-ajax'); 293 }); 294 295 296 }); 297 } 298 299 }); 300 } 301 302 $(window).scroll(function () { 303 304 if (!$('.twp-single-infinity').hasClass('twp-single-loading') && $('.twp-single-infinity').attr('loop-count') <= 3 && newsfort_is_on_screen('.twp-single-infinity')) { 305 306 $('.twp-single-infinity').addClass('twp-single-loading'); 307 var loopcount = $('.twp-single-infinity').attr('loop-count'); 308 var postid = $('.twp-single-infinity').attr('next-post'); 309 310 var data = { 311 'action': 'newsfort_single_infinity', 312 '_wpnonce': newsfort_pagination.ajax_nonce, 313 'postid': postid, 314 }; 315 316 $.post(ajaxurl, data, function (response) { 317 318 if (response) { 319 var content = response.data.content.join(''); 320 var content = $(content); 321 $('.twp-single-infinity').before(content); 322 var newpostid = response.data.postid['0']; 323 $('.twp-single-infinity').attr('next-post', newpostid); 324 325 var rtled = false; 326 if ($('body').hasClass('rtl')) { 327 rtled = true; 328 } 329 330 $('article#post-' + postid + ' figure.wp-block-gallery.has-nested-images.columns-1, article#post-' + postid + ' .wp-block-gallery.columns-1 ul.blocks-gallery-grid, article#post-' + postid + ' .gallery-columns-1').each(function () { 331 $(this).slick({ 332 slidesToShow: 1, 333 slidesToScroll: 1, 334 fade: true, 335 autoplay: true, 336 autoplaySpeed: 8000, 337 infinite: true, 338 nextArrow: '<button type="button" class="slide-btn slide-btn-bg slide-next-icon">'+newsfort_custom.next_svg+'</button>', 339 prevArrow: '<button type="button" class="slide-btn slide-btn-bg slide-prev-icon">'+newsfort_custom.prev_svg+'</button>', 340 dots: false, 341 rtl: rtled 342 }); 343 }); 344 345 $('article').each(function () { 346 347 if ($('body').hasClass('booster-extension') && $(this).hasClass('after-load-ajax') ) { 348 349 var cid = $(this).attr('id'); 350 $(this).addClass( cid ); 351 352 likedislike(cid); 353 booster_extension_post_reaction(cid); 354 355 } 356 357 $(this).removeClass('after-load-ajax'); 358 359 }); 360 361 } 362 363 $('.twp-single-infinity').removeClass('twp-single-loading'); 364 loopcount++; 365 $('.twp-single-infinity').attr('loop-count', loopcount); 366 367 }); 368 369 } 370 371 });
372 373});
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.