properly return out of handled hotkey events

This commit is contained in:
Andrew Dolgov 2012-12-28 15:46:49 +04:00
parent 0b2f8843e5
commit 4ba1f8bbdb
2 changed files with 44 additions and 44 deletions

View File

@ -1077,13 +1077,13 @@ function pref_hotkey_handler(e) {
switch (hotkey_action) { switch (hotkey_action) {
case "feed_subscribe": case "feed_subscribe":
quickAddFeed(); quickAddFeed();
return true; return false;
case "create_label": case "create_label":
addLabel(); addLabel();
return true; return false;
case "create_filter": case "create_filter":
quickAddFilter(); quickAddFilter();
return true; return false;
case "help_dialog": case "help_dialog":
//helpDialog("prefs"); //helpDialog("prefs");
return false; return false;

View File

@ -679,146 +679,146 @@ function hotkey_handler(e) {
getActiveFeedId(), activeFeedIsCat()); getActiveFeedId(), activeFeedIsCat());
if (rv) viewfeed(rv[0], '', rv[1]); if (rv) viewfeed(rv[0], '', rv[1]);
return true; return false;
case "prev_feed": case "prev_feed":
var rv = dijit.byId("feedTree").getPreviousFeed( var rv = dijit.byId("feedTree").getPreviousFeed(
getActiveFeedId(), activeFeedIsCat()); getActiveFeedId(), activeFeedIsCat());
if (rv) viewfeed(rv[0], '', rv[1]); if (rv) viewfeed(rv[0], '', rv[1]);
return true; return false;
case "next_article": case "next_article":
moveToPost('next'); moveToPost('next');
return true; return false;
case "prev_article": case "prev_article":
moveToPost('prev'); moveToPost('prev');
return true; return false;
case "search_dialog": case "search_dialog":
search(); search();
return ; return ;
case "toggle_mark": case "toggle_mark":
selectionToggleMarked(undefined, false, true); selectionToggleMarked(undefined, false, true);
return true; return false;
case "toggle_publ": case "toggle_publ":
selectionTogglePublished(undefined, false, true); selectionTogglePublished(undefined, false, true);
return true; return false;
case "toggle_unread": case "toggle_unread":
selectionToggleUnread(undefined, false, true); selectionToggleUnread(undefined, false, true);
return true; return false;
case "edit_tags": case "edit_tags":
var id = getActiveArticleId(); var id = getActiveArticleId();
if (id) { if (id) {
editArticleTags(id, getActiveFeedId(), isCdmMode()); editArticleTags(id, getActiveFeedId(), isCdmMode());
return; return;
} }
return true; return false;
case "dismiss_selected": case "dismiss_selected":
dismissSelectedArticles(); dismissSelectedArticles();
return true; return false;
case "dismiss_read": case "dismiss_read":
return true; return false;
case "open_in_new_window": case "open_in_new_window":
if (getActiveArticleId()) { if (getActiveArticleId()) {
openArticleInNewWindow(getActiveArticleId()); openArticleInNewWindow(getActiveArticleId());
return; return;
} }
return true; return false;
case "catchup_below": case "catchup_below":
catchupRelativeToArticle(1); catchupRelativeToArticle(1);
return true; return false;
case "catchup_above": case "catchup_above":
catchupRelativeToArticle(0); catchupRelativeToArticle(0);
return true; return false;
case "article_scroll_down": case "article_scroll_down":
scrollArticle(50); scrollArticle(50);
return true; return false;
case "article_scroll_up": case "article_scroll_up":
scrollArticle(-50); scrollArticle(-50);
return true; return false;
case "email_article": case "email_article":
if (typeof emailArticle != "undefined") { if (typeof emailArticle != "undefined") {
emailArticle(); emailArticle();
} else { } else {
alert(__("Please enable mail plugin first.")); alert(__("Please enable mail plugin first."));
} }
return true; return false;
case "select_all": case "select_all":
selectArticles('all'); selectArticles('all');
return true; return false;
case "select_unread": case "select_unread":
selectArticles('unread'); selectArticles('unread');
return true; return false;
case "select_marked": case "select_marked":
selectArticles('marked'); selectArticles('marked');
return true; return false;
case "select_published": case "select_published":
selectArticles('published'); selectArticles('published');
return true; return false;
case "select_invert": case "select_invert":
selectArticles('invert'); selectArticles('invert');
return true; return false;
case "select_none": case "select_none":
selectArticles('none'); selectArticles('none');
return true; return false;
case "feed_refresh": case "feed_refresh":
if (getActiveFeedId() != undefined) { if (getActiveFeedId() != undefined) {
viewfeed(getActiveFeedId(), '', activeFeedIsCat()); viewfeed(getActiveFeedId(), '', activeFeedIsCat());
return; return;
} }
return true; return false;
case "feed_unhide_read": case "feed_unhide_read":
toggleDispRead(); toggleDispRead();
return true; return false;
case "feed_subscribe": case "feed_subscribe":
quickAddFeed(); quickAddFeed();
return true; return false;
case "feed_debug_update": case "feed_debug_update":
window.open("backend.php?op=feeds&method=view&feed=" + getActiveFeedId() + window.open("backend.php?op=feeds&method=view&feed=" + getActiveFeedId() +
"&view_mode=adaptive&order_by=default&update=&m=ForceUpdate&cat=" + "&view_mode=adaptive&order_by=default&update=&m=ForceUpdate&cat=" +
activeFeedIsCat() + "&DevForceUpdate=1&debug=2&xdebug=2&csrf_token=" + activeFeedIsCat() + "&DevForceUpdate=1&debug=2&xdebug=2&csrf_token=" +
getInitParam("csrf_token")); getInitParam("csrf_token"));
return true; return false;
case "feed_edit": case "feed_edit":
if (activeFeedIsCat()) if (activeFeedIsCat())
alert(__("You can't edit this kind of feed.")); alert(__("You can't edit this kind of feed."));
else else
editFeed(getActiveFeedId()); editFeed(getActiveFeedId());
return true; return false;
case "feed_catchup": case "feed_catchup":
if (getActiveFeedId() != undefined) { if (getActiveFeedId() != undefined) {
catchupCurrentFeed(); catchupCurrentFeed();
return; return;
} }
return true; return false;
case "feed_reverse": case "feed_reverse":
reverseHeadlineOrder(); reverseHeadlineOrder();
return true; return false;
case "catchup_all": case "catchup_all":
catchupAllFeeds(); catchupAllFeeds();
return true; return false;
case "cat_toggle_collapse": case "cat_toggle_collapse":
if (activeFeedIsCat()) { if (activeFeedIsCat()) {
dijit.byId("feedTree").collapseCat(getActiveFeedId()); dijit.byId("feedTree").collapseCat(getActiveFeedId());
return; return;
} }
return true; return false;
case "goto_all": case "goto_all":
viewfeed(-4); viewfeed(-4);
return true; return false;
case "goto_fresh": case "goto_fresh":
viewfeed(-3); viewfeed(-3);
return true; return false;
case "goto_marked": case "goto_marked":
viewfeed(-1); viewfeed(-1);
return true; return false;
case "goto_published": case "goto_published":
viewfeed(-2); viewfeed(-2);
return true; return false;
case "goto_tagcloud": case "goto_tagcloud":
displayDlg("printTagCloud"); displayDlg("printTagCloud");
return true; return false;
case "goto_prefs": case "goto_prefs":
gotoPreferences(); gotoPreferences();
return true; return false;
case "select_article_cursor": case "select_article_cursor":
var id = getArticleUnderPointer(); var id = getArticleUnderPointer();
if (id) { if (id) {
@ -829,16 +829,16 @@ function hotkey_handler(e) {
return false; return false;
} }
} }
return true; return false;
case "create_label": case "create_label":
addLabel(); addLabel();
return true; return false;
case "create_filter": case "create_filter":
quickAddFilter(); quickAddFilter();
return true; return false;
case "collapse_sidebar": case "collapse_sidebar":
collapse_feedlist(); collapse_feedlist();
return true; return false;
case "help_dialog": case "help_dialog":
helpDialog("main"); helpDialog("main");
return false; return false;