1var currentArticlesPage = 0; 2var rowCounter = 0; 3 4jQuery(document).ready(function() { 5 jQuery('.load-news').click(function() { 6 loadNews(false); 7 }); 8 9 jQuery(window).resize(function() { 10 resizeNews(); 11 }); 12 13 jQuery(window).scroll(function() { 14 scrollNews(); 15 }); 16 17 loadNews(true); 18}); 19 20function loadNews(init) { 21 if (!init) { 22 jQuery('button.load-news').hide(); 23 jQuery('.loading').show(); 24 window.currentArticlesPage++; 25 } 26 27 jQuery.ajax({ 28 url: templetonVars.ajaxUrl, 29 type: 'POST', 30 data: { 31 action: 'load_articles', 32 page: window.currentArticlesPage, 33 numberOfArticles: 11 34 }, 35 success: function(result) { 36 var articles = JSON.parse(result); 37 38 if (articles.length > 0) { 39 var articleCounter = 0; 40 var html = ''; 41 42 while (articleCounter < articles.length) { 43 var rowClasses = 'row '; 44 if (rowCounter == 0) { 45 rowClasses += ' first '; 46 } 47 48 if (rowCounter % 2 == 0) { 49 rowClasses += ' halves '; 50 } 51 else { 52 rowClasses += ' full '; 53 } 54 55 html += '<div class="' + rowClasses + '">'; 56 var rowArticleTotal = 1; 57 if (rowClasses.indexOf('halves') > -1) { 58 rowArticleTotal = 2; 59 } 60 61 for (rowArticleCounter = 0; rowArticleCounter < rowArticleTotal; rowArticleCounter++) { 62 var rowArticleClasses = 'article '; 63 if (rowArticleCounter == 0) { 64 rowArticleClasses += ' first '; 65 } 66 67 var article = articles[articleCounter]; 68 69 if (article.articleType == 'linked') { 70 html += '<a class="' + rowArticleClasses + '" href="' + article.articleLink + '" target="_new">'; 71 } 72 else { 73 html += '<a class="' + rowArticleClasses + '" href="' + article.postLink + '">'; 74 } 75 html += '<div class="image-container" style="background-image: url(\'' + article.image[0] + '\');">'; 76 html += '</div> <!-- image-container -->'; 77 78 html += '<div class="content-container">'; 79 html += '<div class="title">'; 80 html += article.title; 81 html += '</div>'; 82 html += '<div class="meta">'; 83 html += '<div class="source-container">'; 84 html += '<i class="fa fa-newspaper"></i>'; 85 html += '<span>' + article.source + '</span>'; 86 html += '</div>'; 87 html += '<div class="date-container">'; 88 html += '<img src="' + templetonVars.stylesheetDir + '/images/calendar-icon.png" alt="Article date">'; 89 html += '<span>' + article.date + '</span>'; 90 html += '</div>'; 91 html += '</div>'; 92 html += '</div> <!-- content-container -->'; 93 html += '</a> <!-- article -->'; 94 95 if (++articleCounter >= articles.length) { 96 break; 97 } 98 } // for each article in row 99 100 html += '</div> <!-- row -->'; 101 102 rowCounter++; 103 } // while articles 104 105 jQuery('.articles').append(html); 106 jQuery('.loading').hide(); 107 jQuery('button.load-news').show(); 108 } // if results 109 else { 110 jQuery('.loading').hide(); 111 jQuery('button.load-news').hide(); 112 jQuery('.end-of-list').show(); 113 } // no results 114 115 if (init) { 116 resizeNews(); 117 scrollNews(); 118 } 119 }, 120 error: function(result) { 121 if (init) { 122 resizeNews(); 123 scrollNews(); 124 } 125 } 126 }); 127} 128 129function resizeNews() { 130 if (jQuery(window).width() < 1024) { 131 jQuery('.page-content-container .right').css('height', 'auto'); 132 } 133 else { 134 var leftHeight = jQuery('.page-content-container .left').outerHeight(); 135 var rightHeight = jQuery('.page-content-container .right').outerHeight(); 136 137 if (leftHeight > rightHeight) { 138 jQuery('.page-content-container .right').css('height', leftHeight + 93); 139 } 140 else { 141 jQuery('.page-content-container .right').css('height', 'auto'); 142 } 143 } 144} 145 146function scrollNews() { 147 window.setTimeout(function() { 148 animatePills('.news-header .floating-pill', false); 149 }, 2000); 150 151 if (jQuery(window).width() > 767) { 152 window.setTimeout(function() { 153 animatePills('.page-content-container .floating-pill', true, '.page-content-container'); 154 }, 3000); 155 } 156} 157
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.