]> git.wh0rd.org - tt-rss.git/blobdiff - js/viewfeed.js
hlClicked: do not set headline selected when ctrl-clicking
[tt-rss.git] / js / viewfeed.js
index abf56c185f5238b0919aa146d42311152cb0c954..23332802d6c374f874abb075211014fbb2522274 100755 (executable)
@@ -13,6 +13,7 @@ var loaded_article_ids = [];
 var _last_headlines_update = 0;
 var _headlines_scroll_offset = 0;
 var current_first_id = 0;
+var last_search_query;
 
 var _catchup_request_sent = false;
 
@@ -38,6 +39,7 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
 
                is_cat = reply['headlines']['is_cat'];
                feed_id = reply['headlines']['id'];
+               last_search_query = reply['headlines']['search_query'];
 
                if (background) {
                        var content = reply['headlines']['content'];
@@ -209,7 +211,7 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
                if (counters)
                        parse_counters(counters);
                else
-                       request_counters(true);
+                       request_counters();
 
        } else {
                console.error("Invalid object received: " + transport.responseText);
@@ -421,11 +423,9 @@ function toggleMark(id, client_only) {
 
                if (!row.hasClassName("marked")) {
                        img.src = img.src.replace("mark_unset", "mark_set");
-                       img.alt = __("Unstar article");
                        query = query + "&mark=1";
                } else {
                        img.src = img.src.replace("mark_set", "mark_unset");
-                       img.alt = __("Star article");
                        query = query + "&mark=0";
                }
        }
@@ -470,16 +470,14 @@ function togglePub(id, client_only, no_effects, note) {
                        imgs.push(fte[i]);
        }
 
-       for (i = 0; i < imgs.length; i++) {
+       for (var i = 0; i < imgs.length; i++) {
                var img = imgs[i];
 
                if (!row.hasClassName("published") || note != undefined) {
                        img.src = img.src.replace("pub_unset", "pub_set");
-                       img.alt = __("Unpublish article");
                        query = query + "&pub=1";
                } else {
                        img.src = img.src.replace("pub_set", "pub_unset");
-                       img.alt = __("Publish article");
                        query = query + "&pub=0";
                }
        }
@@ -936,7 +934,7 @@ function deleteSelection() {
                return;
        }
 
-       query = "?op=rpc&method=delete&ids=" + param_escape(rows);
+       var query = "?op=rpc&method=delete&ids=" + param_escape(rows);
 
        console.log(query);
 
@@ -980,7 +978,7 @@ function archiveSelection() {
                return;
        }
 
-       query = "?op=rpc&method="+op+"&ids=" + param_escape(rows);
+       var query = "?op=rpc&method="+op+"&ids=" + param_escape(rows);
 
        console.log(query);
 
@@ -1026,7 +1024,7 @@ function editArticleTags(id) {
        if (dijit.byId("editTagsDlg"))
                dijit.byId("editTagsDlg").destroyRecursive();
 
-       dialog = new dijit.Dialog({
+       var dialog = new dijit.Dialog({
                id: "editTagsDlg",
                title: __("Edit article Tags"),
                style: "width: 600px",
@@ -1261,7 +1259,7 @@ function catchupBatchedArticles() {
 
                                _catchup_request_sent = false;
 
-                               reply = JSON.parse(transport.responseText);
+                               var reply = JSON.parse(transport.responseText);
                                var batch = reply.ids;
 
                                batch.each(function (id) {
@@ -1479,7 +1477,7 @@ function show_labels_in_headlines(transport) {
        }
 }
 
-function cdmClicked(event, id) {
+function cdmClicked(event, id, in_body) {
        //var shift_key = event.shiftKey;
 
        if (!event.ctrlKey && !event.metaKey) {
@@ -1521,7 +1519,7 @@ function cdmClicked(event, id) {
                        return !event.shiftKey;
                }
 
-       } else if (event.target.parents(".cdmHeader").length > 0) {
+       } else if (!in_body) {
 
                toggleSelected(id, true);
 
@@ -1535,6 +1533,8 @@ function cdmClicked(event, id) {
                toggleUnread(id, 0, false);
 
                openArticleInNewWindow(id);
+       } else {
+               return true;
        }
 
        var unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length
@@ -1548,8 +1548,6 @@ function hlClicked(event, id) {
                view(id);
                return true;
        } else if (event.ctrlKey || event.metaKey) {
-               toggleSelected(id, true);
-               toggleUnread(id, 0, false);
                openArticleInNewWindow(id);
                return false;
        } else {
@@ -1734,9 +1732,9 @@ function headlinesMenuCommon(menu) {
        }));
 
 
-       var labels = dijit.byId("feedTree").model.getItemsInCategory(-2);
+       var labels = getInitParam("labels");
 
-       if (labels) {
+       if (labels && labels.length) {
 
                menu.addChild(new dijit.MenuSeparator());
 
@@ -1744,11 +1742,8 @@ function headlinesMenuCommon(menu) {
                var labelDelMenu = new dijit.Menu({ownerMenu: menu});
 
                labels.each(function (label) {
-                       var id = label.id[0];
-                       var bare_id = id.substr(id.indexOf(":") + 1);
-                       var name = label.name[0];
-
-                       bare_id = feed_to_label_id(bare_id);
+                       var bare_id = label.id;
+                       var name = label.caption;
 
                        labelAddMenu.addChild(new dijit.MenuItem({
                                label: name,