1/** 2 * I feeds sono le news 3 */ 4 5/* globals Backbone, _ */ 6 7var bit = bit || {}; 8 9bit.latestfeeds = (function ($) { 10 "use strict"; 11 var Model = Backbone.Model.extend({ 12 defaults: function () { 13 return { 14 releaseddatetime: '', 15 type: '', 16 typelink: '', 17 category: '', 18 title: '', 19 body: '', 20 newsabstract: '', 21 newslink: '', 22 imagelink: '', 23 islast:false 24 }; 25 }, 26 initialize: function () { 27 } 28 }), 29 30 Collection = Backbone.Collection.extend({ 31 model: Model, 32 url: bit.init.latestfeed 33 }), 34 35 View = Backbone.View.extend({ 36 el: $('#latestfeeds'), 37 initialize: function () { 38 var _thisView = this; 39 this.template = _.template('<article class="m-feed__wrapper--strike reset-border"> <a href="<%= newslink %>" title="<%= title %>" class="m-feed__link -inlined"> <h3 class="m-feed__title epsilon--small | inline"><%= title %></h3> <span class="m-feed__footer"> <span class="small m-feed__date"><%= formatTimeDate(releaseddatetime) %></span> <span class="small m-feed__author | inline"><%= type %></span> </span> </a> </article> '); 40 this.collection.fetch().done(function () { 41 _thisView.render(); 42 }); 43 }, 44 render: function () { 45 var that = this; 46 var length = this.collection.length; 47 this.collection.each(function (model, index) { 48 if (_.isEqual(model.attributes.type, "TELEBORSA")) { 49 model.attributes.imagelink = model.attributes.imagelink.replace(".jpg", "-small.jpg"); 50 model.attributes.typelink = "/borsa/notizie/teleborsa/home.html"; 51 } 52 if (_.isEqual(model.attributes.type, "RADIOCOR")) { 53 model.attributes.imagelink = model.attributes.imagelink.replace(".jpg", "-small.jpg"); 54 model.attributes.typelink = "/borsa/notizie/radiocor/prima-pagina/archivio.html"; 55 } 56 if (length-1 === index) { 57 model.attributes.islast=true; 58 } 59 $(that.el).append(that.template(model.attributes)); 60 }); 61 return this; 62 } 63 }), 64 initialize = function () { 65 var view, feeds = new Collection(); 66 view = new View({collection: feeds}); 67 return view; 68 }; 69 return { 70 Collection: Collection, 71 View: View, 72 initialize: initialize 73 }; 74 75})(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.