]> git.wh0rd.org - tt-rss.git/blobdiff - js/viewfeed.js
queryFeedHeadlines: move to array-based arguments, optionally check if first element...
[tt-rss.git] / js / viewfeed.js
index f236e1f7ce37e74b405eb1bac48cdf637d8eb753..8bc42aadc802955e88f85be834619a457636489f 100644 (file)
@@ -13,6 +13,7 @@ var catchup_timeout_id = false;
 var cids_requested = [];
 var loaded_article_ids = [];
 var _last_headlines_update = 0;
+var current_top_article_id = false;
 
 var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
 
@@ -83,6 +84,7 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
 
                        if (infscroll_req == false) {
                                loaded_article_ids = [];
+                               current_top_article_id = false;
 
                                dijit.byId("headlines-frame").attr('content',
                                        reply['headlines']['content']);
@@ -102,6 +104,10 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
                                        }
                                });
 
+                               if (loaded_article_ids.size() > 0) {
+                                       current_top_article_id = parseInt(loaded_article_ids[0].replace("RROW-", ""));
+                               }
+
                                var hsp = $("headlines-spacer");
                                if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
                                dijit.byId('headlines-frame').domNode.appendChild(hsp);
@@ -2293,6 +2299,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 +2346,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);
                                        }
                                } });
                }
@@ -2418,3 +2453,7 @@ function updateFloatingTitle(unread_only) {
                exception_error("updateFloatingTitle", e);
        }
 }
+
+function cdmFooterClick(event) {
+       event.stopPropagation();
+}
\ No newline at end of file