1(function ($) { 2 3 var breakingTitle; 4 5 $(document).ready(function () { 6 var $container = $('.breaking-news-container'); 7 breakingTitle = $container.data('title'); 8 if (!$container.length) { 9 return; 10 } 11 var url = $container.data('url'); 12 if (!url) { 13 return; 14 } 15 fetchBreakingNews(url, function (res) { 16 var dom = ''; 17 $.each(res, function (i, val) { 18 dom += getDom(val); 19 }); 20 displayBreakingElements($container, dom); 21 }); 22 }); 23 24 function fetchBreakingNews(url, cb) { 25 $.ajax({ 26 url: url, 27 method: 'GET' 28 }).success(function (res) { 29 cb(res); 30 }); 31 } 32 33 function getDom(val) { 34 35 return '<a href="' + val.url + '" class="breaking-news-url">' + 36 getTitle() + 37 '<div class="breaking-news-content">' + val.name + '</div></a>'; 38 } 39 40 function getTitle() { 41 42 if (breakingTitle === undefined) { 43 return ''; 44 } 45 46 return '<div class="breaking-news-title">' + breakingTitle + '</div>'; 47 } 48 49 function displayBreakingElements($container, elements) { 50 $container.html('<div class="breaking-news-background"></div>' + elements); 51 } 52})(jQuery);
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.