1(function ($) { 2$.fn.ednDynamicArticleLoader = function (settings) { 3 return this.each(function(i, el) { 4 var startingArticle = settings.startingArticle, 5 $articlesContainer = $(el), 6 $triggerWrapper = $(settings.triggerWrapperSelector), 7 $returnHtml = $('> .trigger > .actionTextContainer > span', $triggerWrapper), 8 $window = $(window), 9 $document = $(document), 10 11 requestInProgress = false, 12 allArticlesLoaded = false, 13 isotopeLayout = $.fn.isotope && $articlesContainer.parent().hasClass('edn_isotopeLayout'), 14 15 getMoreArticles = function () { 16 if (requestInProgress || allArticlesLoaded) 17 return false; 18 19 requestInProgress = true; 20 21 $.ajax({ 22 data: $.extend({}, settings.params, {startingArticle: startingArticle}), 23 dataType: 'json', 24 success: function (response) { 25 var $newHtml, 26 isotopeItems = []; 27 28 $newHtml = $(response.content).appendTo($articlesContainer); 29 30 if (isotopeLayout) { 31 $newHtml.each(function () { 32 if ($(this).hasClass('edn_articleWrapper')) 33 isotopeItems.push(this); 34 }); 35 36 $articlesContainer.isotope('insert', isotopeItems); 37 } 38 39 startingArticle = startingArticle + settings.numberOfPostsperPage; 40 41 if (response.itemsRemaining < 1) 42 allArticlesLoaded = true; 43 44 if (response.itemsRemaining < 1) 45 $triggerWrapper.addClass('hide'); 46 47 $returnHtml.html(response.newActionText); 48 49 if (settings.addThis) { 50 window.addthis_config = { 51 ui_delay: 500, 52 data_track_addressbar: false 53 } 54 55 if (window.addthis) { 56 window.addthis = null; 57 window._adr = null; 58 window._atc = null; 59 window._atd = null; 60 window._ate = null; 61 window._atr = null; 62 window._atw = null; 63 } 64 65 $.getScript('//s7.addthis.com/js/300/addthis_widget.js#domready=1'); 66 } 67 68 if (settings.addThisProfileId && settings.addThisProfileId.length > 0) { 69 eds3_5_jq(document).ready(function ($) { 70 var addthis_config = addthis_config || {}; 71 addthis_config.pubid = settings.addThisProfileId; 72 addthis.layers.refresh(); 73 }); 74 } 75 76 if (settings.initCaptcha && window.edsgg_recaptchaCallback) { 77 window.edsgg_recaptchaCallback(); 78 } 79 80 $('.edNews__secondaryArticleList_' + settings.moduleId) 81 .append(response.secondaryListContent) 82 .map(function () { 83 $(this).parents('.edNews__secondaryArticleList').eq(0).data('plugin_eds_tinyscrollbar').update('relative'); 84 }); 85 }, 86 complete: function () { 87 var $imgs, 88 imageLoadedKey = 'imageLoaded'; 89 90 requestInProgress = false; 91 92 $triggerWrapper.removeClass('loading'); 93 $('.rateit').rateit(); 94 95 if (isotopeLayout) { 96 $imgs = $('img', $articlesContainer); 97 98 if ($imgs.length != 0) 99 $imgs.imagesLoaded() 100 .progress(function (instance, image) { 101 var $img = $(image.img); 102 103 if ($img.data(imageLoadedKey)) 104 return; 105 106 $img.data(imageLoadedKey, true); 107 108 $articlesContainer.isotope('layout'); 109 }); 110 111 $articlesContainer.isotope('layout'); 112 } 113 114 $articlesContainer.trigger('contentLoaded'); 115 }, 116 url: settings.sourceUrl 117 }); 118 119 return true; 120 }; 121 122 $('> .trigger', $triggerWrapper).on('click', function () { 123 if (getMoreArticles()) 124 $triggerWrapper.addClass('loading'); 125 126 return false; 127 }); 128 129 if (settings.triggerOnScroll) { 130 $window.scroll(function () { 131 var pixelsToBottom = $document.height() - $window.scrollTop() - $window.height(); 132 133 if (pixelsToBottom < 2000 && getMoreArticles()) 134 $triggerWrapper.addClass('loading'); 135 }); 136 } 137 }); 138}; 139})(eds3_5_jq);
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.