1riot.tag2('rc-riot-item-rating', '<div class="rc-item-rating" if="{count}"> <span if="{opts.txt.rating_label !== \'\'}" class="rc-item-rating-label"> {opts.txt.rating_label}: <span class="rc-item-rating-numeric"> {displayRating} </span> </span> <div class="rc-item-rating-stars"> <div each="{n, star in stars}" class="star star-{n}"> <span if="{star.width}" class="{star.state}" riot-style="width:{star.width}%"> {n} </span> <span if="{!star.width}" class="{star.state}"> {n} </span> </div> </div> <span class="rc-item-rating-detail">( {opts.count} {opts.txt.reviews_label} )</span> </div> <div class="rc-item-rating" if="{count == 0}"> <span class="rc-item-rating-label no-reviews"> {opts.txt.no_reviews} </span> </div>', '', 'class="rc-core-item-eid-{opts.eid}"', function(opts) { 2 this.max = 5; 3 this.stars = null; 4 this.count = parseInt(opts.count); 5 if(parseFloat(opts.rating)) { 6 this.rating = opts.rating * (100 / this.max); 7 this.displayRating = opts.rating.toFixed(1); 8 this.one('update', function() { 9 var n, 10 cv, 11 pv, 12 pct, 13 st = {}, 14 self = this; 15 for(n = 1; n <= this.max; n++) { 16 cv = Math.ceil((100 / self.max) * n);
17 pv = Math.ceil((100 / self.max) * (n -1)); 18 if(self.rating < cv && self.rating > pv) { 19 pct = ((self.rating - pv) / (cv - pv)) * 100; 20 st[n] = { 21 state: 'on', 22 width: pct 23 } 24 } 25 else if(self.rating >= cv) { 26 st[n] = { 27 state: 'on', 28 width: 100 29 } 30 } 31 else { 32 st[n] = { 33 state: 'off', 34 width: null 35 } 36 } 37 } 38 self.stars = st; 39 }) 40 } 41 42});
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.