hotkey actions: toggle_expand, collapse_article: check if element exists

before acting on it (closes #815)
This commit is contained in:
Andrew Dolgov 2014-10-26 10:25:16 +04:00
parent 110ce72a72
commit 98cbae8dfa
1 changed files with 16 additions and 10 deletions

View 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() {