]> git.wh0rd.org Git - tt-rss.git/commitdiff
hotkey actions: toggle_expand, collapse_article: check if element exists
authorAndrew Dolgov <noreply@fakecake.org>
Sun, 26 Oct 2014 06:25:16 +0000 (10:25 +0400)
committerAndrew Dolgov <noreply@fakecake.org>
Sun, 26 Oct 2014 06:25:19 +0000 (10:25 +0400)
before acting on it (closes #815)

js/tt-rss.js

index c6414515944abf7b85afae92d1a248724312ba4d..84f2e67b1baba39b703b802ac68e6bf252bb68f8 100644 (file)
@@ -302,21 +302,27 @@ function init() {
                hotkey_actions["collapse_article"] = function() {
                                var id = getActiveArticleId();
                                var elem = $("CICD-"+id);
-                               if(elem.visible()) {
-                                       cdmCollapseArticle(null, id);
-                               }
-                               else {
-                                       cdmExpandArticle(id);
+
+                               if (elem) {
+                                       if (elem.visible()) {
+                                               cdmCollapseArticle(null, id);
+                                       }
+                                       else {
+                                               cdmExpandArticle(id);
+                                       }
                                }
                };
                hotkey_actions["toggle_expand"] = function() {
                                var id = getActiveArticleId();
                                var elem = $("CICD-"+id);
-                               if(elem.visible()) {
-                                       cdmCollapseArticle(null, id, false);
-                               }
-                               else {
-                                       cdmExpandArticle(id);
+
+                               if (elem) {
+                                       if (elem.visible()) {
+                                               cdmCollapseArticle(null, id, false);
+                                       }
+                                       else {
+                                               cdmExpandArticle(id);
+                                       }
                                }
                };
                hotkey_actions["search_dialog"] = function() {