summaryrefslogtreecommitdiff
path: root/js/viewfeed.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2015-06-17 22:04:32 +0300
committerAndrew Dolgov <[email protected]>2015-06-17 22:04:32 +0300
commita72cd54ce142425e6dd36bf7c6c0badb61b96a3f (patch)
treeaa1bb26ed763ac858b1eb42443611cff3ef27dff /js/viewfeed.js
parent308c55c0f1671525c804291bad7d0d853e0eb998 (diff)
bayes: properly reset score when going good -> ugly
article: add helper to refresh article score pic, properly set scorepic title
Diffstat (limited to 'js/viewfeed.js')
-rw-r--r--js/viewfeed.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/viewfeed.js b/js/viewfeed.js
index f236e1f7c..ea8150070 100644
--- a/js/viewfeed.js
+++ b/js/viewfeed.js
@@ -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);
}
} });
}