1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 13:15:55 +00:00

bayes: properly reset score when going good -> ugly

article: add helper to refresh article score pic, properly set scorepic title
This commit is contained in:
Andrew Dolgov
2015-06-17 22:04:32 +03:00
parent 308c55c0f1
commit a72cd54ce1
4 changed files with 45 additions and 3 deletions

View File

@@ -2293,6 +2293,34 @@ function setSelectionScore() {
}
}
function updateScore(id) {
try {
var pic = $$("#RROW-" + id + " .hlScorePic")[0];
if (pic) {
var query = "op=article&method=getScore&id=" + param_escape(id);
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
console.log(transport.responseText);
var reply = JSON.parse(transport.responseText);
if (reply) {
pic.src = pic.src.replace(/score_.*?\.png/, reply["score_pic"]);
pic.setAttribute("score", reply["score"]);
pic.setAttribute("title", reply["score"]);
}
} });
}
} catch (e) {
exception_error("updateScore", e);
}
}
function changeScore(id, pic) {
try {
var score = pic.getAttribute("score");
@@ -2312,6 +2340,7 @@ function changeScore(id, pic) {
if (reply) {
pic.src = pic.src.replace(/score_.*?\.png/, reply["score_pic"]);
pic.setAttribute("score", new_score);
pic.setAttribute("title", new_score);
}
} });
}