From: Andrew Dolgov Date: Sun, 26 Oct 2014 06:25:16 +0000 (+0400) Subject: hotkey actions: toggle_expand, collapse_article: check if element exists X-Git-Tag: 1.15~24 X-Git-Url: https://git.wh0rd.org/?p=tt-rss.git;a=commitdiff_plain;h=98cbae8dfa9e9d30fe2e843c7058d99671a830ba hotkey actions: toggle_expand, collapse_article: check if element exists before acting on it (closes #815) --- diff --git a/js/tt-rss.js b/js/tt-rss.js index c6414515..84f2e67b 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -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() {