]> git.wh0rd.org - tt-rss.git/blobdiff - viewfeed.js
properly select next unread feed in feedlist when catching up
[tt-rss.git] / viewfeed.js
index de7f268129fa1ecaba33a240354b47b1e376a9de..489a014d6125f2bdc50e5cbb805f754a780a0238 100644 (file)
@@ -2,13 +2,6 @@ var active_post_id = false;
 var last_article_view = false;
 var active_real_feed_id = false;
 
-var _tag_active_post_id = false;
-var _tag_active_feed_id = false;
-var _tag_active_cdm = false;
-
-// FIXME: kludge, to restore scrollTop after tag editor terminates
-var _tag_cdm_scroll = false;
-
 // FIXME: kludges, needs proper implementation
 var _reload_feedlist_after_view = false;
 
@@ -177,8 +170,6 @@ function headlines_callback2(transport, feed_cur_page) {
                                                        markHeadline(ids[i]);
                                                }
 
-                                               subtoolbarSearch();
-
                                        } else {
                                                debug("no new headlines received");
                                        }
@@ -235,15 +226,6 @@ function headlines_callback2(transport, feed_cur_page) {
                        debug("not in CDM mode or watchdog disabled");
                }
        
-               if (_tag_cdm_scroll) {
-                       try {
-                               document.getElementById("headlinesInnerContainer").scrollTop = _tag_cdm_scroll;
-                               _tag_cdm_scroll = false;
-                               debug("resetting headlinesInner scrollTop");
-       
-                       } catch (e) { }
-               }
-       
                _feed_cur_page = feed_cur_page;
                _infscroll_request_sent = 0;
 
@@ -252,7 +234,7 @@ function headlines_callback2(transport, feed_cur_page) {
                remove_splash();
 
        } catch (e) {
-               exception_error("headlines_callback2", e);
+               exception_error_ext("headlines_callback2", e, transport);
        }
 }
 
@@ -860,9 +842,9 @@ function selectionRemoveLabel(id) {
                        return;
                }
 
-               var ok = confirm(__("Remove selected articles from label?"));
+//             var ok = confirm(__("Remove selected articles from label?"));
 
-               if (ok) {
+//             if (ok) {
 
                        var query = "backend.php?op=rpc&subop=removeFromLabel&ids=" +
                                param_escape(ids.toString()) + "&lid=" + param_escape(id);
@@ -877,7 +859,7 @@ function selectionRemoveLabel(id) {
                                        all_counters_callback2(transport);
                                } });
 
-               }
+//             }
 
        } catch (e) {
                exception_error("selectionAssignLabel", e);
@@ -895,9 +877,9 @@ function selectionAssignLabel(id) {
                        return;
                }
 
-               var ok = confirm(__("Assign selected articles to label?"));
+//             var ok = confirm(__("Assign selected articles to label?"));
 
-               if (ok) {
+//             if (ok) {
 
                        cache_invalidate("F:" + (-11 - id));
 
@@ -912,7 +894,7 @@ function selectionAssignLabel(id) {
                                        all_counters_callback2(transport);
                                } });
 
-               }
+//             }
 
        } catch (e) {
                exception_error("selectionAssignLabel", e);
@@ -1230,15 +1212,6 @@ function catchupSelection() {
 }
 
 function editArticleTags(id, feed_id, cdm_enabled) {
-       _tag_active_post_id = id;
-       _tag_active_feed_id = feed_id;
-       _tag_active_cdm = cdm_enabled;
-
-       cache_invalidate(id);
-
-       try {
-               _tag_cdm_scroll = document.getElementById("headlinesInnerContainer").scrollTop;
-       } catch (e) { }
        displayDlg('editArticleTags', id);
 }
 
@@ -1254,18 +1227,24 @@ function tag_saved_callback(transport) {
                        _reload_feedlist_after_view = true;
                }
 
-               if (!_tag_active_cdm) {
-                       if (active_post_id == _tag_active_post_id) {
-                               debug("reloading current article");
-                               view(_tag_active_post_id, _tag_active_feed_id);                 
+
+               if (transport.responseXML) {
+                       var tags_str = transport.responseXML.getElementsByTagName("tags-str")[0];
+                       
+                       if (tags_str) {
+                               var id = tags_str.getAttribute("id");
+
+                               if (id) {
+                                       var tags = document.getElementById("ATSTR-" + id);
+                                       if (tags) {
+                                               tags.innerHTML = tags_str.firstChild.nodeValue;
+                                       }
+                               }
                        }
-               } else {
-                       debug("reloading current feed");
-                       viewCurrentFeed();
                }
 
        } catch (e) {
-               exception_error("catchup_callback", e);
+               exception_error("tag_saved_callback", e);
        }
 }
 
@@ -1822,44 +1801,6 @@ function fixHeadlinesOrder(ids) {
        }
 }
 
-function subtoolbarSearch() {
-       try {
-
-               var q = document.getElementById("subtoolbar_search_box");
-               
-               if (!q) return;
-
-               q = q.value.toUpperCase();
-
-               var ids = false;
-               var vis_ids = new Array();
-
-               if (document.getElementById("headlinesList")) {
-                       ids = getVisibleHeadlineIds();
-               } else {
-                       ids = cdmGetVisibleArticles();
-               }
-
-               for (var i = 0; i < ids.length; i++) {
-                       var title = document.getElementById("RTITLE-" + ids[i]);
-
-                       if (title) {
-                               if (!title.innerHTML.toUpperCase().match(q)) {
-                                       Element.hide(document.getElementById("RROW-" + ids[i]));
-                               } else {
-                                       Element.show(document.getElementById("RROW-" + ids[i]));
-                                       vis_ids.push(ids[i]);
-                               }
-                       }
-               }
-
-               fixHeadlinesOrder(vis_ids);
-
-       } catch (e) {
-               exception_error("subtoolbarSearch", e);
-       } 
-}
-
 function hideReadHeadlines() {
        try {
 
@@ -2050,6 +1991,7 @@ function toggleHeadlineActions() {
                        Element.hide(e);
                }
 
+               e.scrollTop = 0;
                e.style.left = (p.offsetLeft + 1) + "px";
 //             e.style.top = (p.offsetTop + p.offsetHeight - 1) + "px";