app.ratingTooltipTpl = function (e) {
var res = "<div id='set-rating" + e.chainId + "'>";
var rate = e.rating;
var spanArr = [];
for (var i = 1; i <= 5; ++i) {
spanArr.push("<span rate=" + i + " chainId=" + e.chainId + " class='action-tooltip rating-empty' onclick='setRating(this)'></span>");
}
var a = "empty", b = "yellow-star"
switch (rate) {
case 1:
spanArr[0].replace(a, b);
break;
case 2:
spanArr[0].replace(a, b);
spanArr[1].replace(a, b);
break;
case 3:
spanArr[0].replace(a, b);
spanArr[1].replace(a, b);
spanArr[2].replace(a, b);
break;
case 4:
spanArr[0].replace(a, b);
spanArr[1].replace(a, b);
spanArr[2].replace(a, b);
spanArr[3].replace(a, b);
break;
case 5:
spanArr[0].replace(a, b);
spanArr[1].replace(a, b);
spanArr[2].replace(a, b);
spanArr[3].replace(a, b);
spanArr[4].replace(a, b);
break;
}
var spans = spanArr.join();
res += spans;
res = res + "</div></br>Баллы:<span id='rating-rate" + e.chainId + "'>"+rate+"</span>";
return res;
};
смотри сколько буков я тебе сократил!