hotkey system bugfixes

This commit is contained in:
Andrew Dolgov 2008-05-18 04:44:59 +01:00
parent c177f2e648
commit eec498c3d5
2 changed files with 80 additions and 48 deletions

View File

@ -1202,7 +1202,7 @@ function editSelectedFeedCat() {
} }
function localPiggieFunction(enable) { function piggie(enable) {
if (enable) { if (enable) {
debug("I LOVEDED IT!"); debug("I LOVEDED IT!");
var piggie = document.getElementById("piggie"); var piggie = document.getElementById("piggie");
@ -1705,6 +1705,8 @@ function pref_hotkey_handler(e) {
keycode = e.which; keycode = e.which;
} }
var keychar = String.fromCharCode(keycode);
if (keycode == 27) { // escape if (keycode == 27) { // escape
if (Element.visible("hotkey_help_overlay")) { if (Element.visible("hotkey_help_overlay")) {
Element.hide("hotkey_help_overlay"); Element.hide("hotkey_help_overlay");
@ -1722,7 +1724,7 @@ function pref_hotkey_handler(e) {
if ((keycode == 67 || keycode == 71) && !hotkey_prefix) { if ((keycode == 67 || keycode == 71) && !hotkey_prefix) {
hotkey_prefix = keycode; hotkey_prefix = keycode;
debug("KP: PREFIX=" + keycode); debug("KP: PREFIX=" + keycode + " CHAR=" + keychar);
return; return;
} }
@ -1752,24 +1754,25 @@ function pref_hotkey_handler(e) {
return; return;
} }
if (keycode == 191 && shift_key) { // ? if ((keycode == 191 || keychar == '?') && shift_key) { // ?
if (!Element.visible("hotkey_help_overlay")) { if (!Element.visible("hotkey_help_overlay")) {
//Element.show("hotkey_help_overlay"); //Element.show("hotkey_help_overlay");
Effect.Appear("hotkey_help_overlay", {duration : 0.3}); Effect.Appear("hotkey_help_overlay", {duration : 0.3});
} else { } else {
Element.hide("hotkey_help_overlay"); Element.hide("hotkey_help_overlay");
} }
return; return false;
} }
if (keycode == 191) { // / if (keycode == 191 || keychar == '/') { // /
var search_boxes = new Array("label_search", var search_boxes = new Array("label_search",
"feed_search", "filter_search", "user_search"); "feed_search", "filter_search", "user_search");
for (var i = 0; i < search_boxes.length; i++) { for (var i = 0; i < search_boxes.length; i++) {
var elem = document.getElementById(search_boxes[i]); var elem = document.getElementById(search_boxes[i]);
if (elem) { if (elem) {
return focus_element(search_boxes[i]); focus_element(search_boxes[i]);
return false;
} }
} }
} }
@ -1781,15 +1784,18 @@ function pref_hotkey_handler(e) {
hotkey_prefix = false; hotkey_prefix = false;
if (keycode == 70) { // f if (keycode == 70) { // f
return displayDlg("quickAddFilter"); displayDlg("quickAddFilter");
return false;
} }
if (keycode == 83) { // s if (keycode == 83) { // s
return displayDlg("quickAddFeed"); displayDlg("quickAddFeed");
return false;
} }
if (keycode == 76) { // l if (keycode == 76) { // l
return displayDlg("quickAddLabel"); displayDlg("quickAddLabel");
return false;
} }
if (keycode == 85) { // u if (keycode == 85) { // u
@ -1797,11 +1803,13 @@ function pref_hotkey_handler(e) {
} }
if (keycode == 67) { // c if (keycode == 67) { // c
return editFeedCats(); editFeedCats();
return false;
} }
if (keycode == 84 && shift_key) { // T if (keycode == 84 && shift_key) { // T
return browseFeeds(); browseFeeds();
return false;
} }
} }
@ -1814,26 +1822,32 @@ function pref_hotkey_handler(e) {
if (keycode == 49 && document.getElementById("genConfigTab")) { // 1 if (keycode == 49 && document.getElementById("genConfigTab")) { // 1
selectTab("genConfig"); selectTab("genConfig");
return false;
} }
if (keycode == 50 && document.getElementById("feedConfigTab")) { // 2 if (keycode == 50 && document.getElementById("feedConfigTab")) { // 2
return selectTab("feedConfig"); selectTab("feedConfig");
return false;
} }
if (keycode == 51 && document.getElementById("feedBrowserTab")) { // 3 if (keycode == 51 && document.getElementById("feedBrowserTab")) { // 3
return selectTab("feedBrowser"); selectTab("feedBrowser");
return false;
} }
if (keycode == 52 && document.getElementById("filterConfigTab")) { // 4 if (keycode == 52 && document.getElementById("filterConfigTab")) { // 4
return selectTab("filterConfig"); selectTab("filterConfig");
return false;
} }
if (keycode == 53 && document.getElementById("labelConfigTab")) { // 5 if (keycode == 53 && document.getElementById("labelConfigTab")) { // 5
return selectTab("labelConfig"); selectTab("labelConfig");
return false;
} }
if (keycode == 54 && document.getElementById("userConfigTab")) { // 6 if (keycode == 54 && document.getElementById("userConfigTab")) { // 6
return selectTab("userConfig"); selectTab("userConfig");
return false;
} }
if (keycode == 88) { // x if (keycode == 88) { // x
@ -1846,16 +1860,16 @@ function pref_hotkey_handler(e) {
if (seq.match("807371717369")) { if (seq.match("807371717369")) {
seq = ""; seq = "";
localPiggieFunction(true); piggie(true);
} else { } else {
localPiggieFunction(false); piggie(false);
} }
} }
if (hotkey_prefix) { if (hotkey_prefix) {
debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode); debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode + " CHAR=" + keychar);
} else { } else {
debug("KP: CODE=" + keycode); debug("KP: CODE=" + keycode + " CHAR=" + keychar);
} }
} catch (e) { } catch (e) {

View File

@ -931,7 +931,7 @@ function hotkey_handler(e) {
keycode = e.which; keycode = e.which;
} }
keychar = String.fromCharCode(keycode); var keychar = String.fromCharCode(keycode);
if (keycode == 27) { // escape if (keycode == 27) { // escape
if (Element.visible("hotkey_help_overlay")) { if (Element.visible("hotkey_help_overlay")) {
@ -950,7 +950,7 @@ function hotkey_handler(e) {
if ((keycode == 70 || keycode == 67 || keycode == 71) && !hotkey_prefix) { if ((keycode == 70 || keycode == 67 || keycode == 71) && !hotkey_prefix) {
hotkey_prefix = keycode; hotkey_prefix = keycode;
debug("KP: PREFIX=" + keycode); debug("KP: PREFIX=" + keycode + " CHAR=" + keychar);
return; return;
} }
@ -974,27 +974,30 @@ function hotkey_handler(e) {
return; return;
} }
if (keycode == 191 && shift_key) { // ? if ((keycode == 191 || keychar == '?') && shift_key) { // ?
if (!Element.visible("hotkey_help_overlay")) { if (!Element.visible("hotkey_help_overlay")) {
//Element.show("hotkey_help_overlay"); //Element.show("hotkey_help_overlay");
Effect.Appear("hotkey_help_overlay", {duration : 0.3}); Effect.Appear("hotkey_help_overlay", {duration : 0.3});
} else { } else {
Element.hide("hotkey_help_overlay"); Element.hide("hotkey_help_overlay");
} }
return; return false;
} }
if (keycode == 191 || (is_opera() && keycode == 47)) { // / if (keycode == 191 || keychar == '/') { // /
return displayDlg("search", getActiveFeedId() + ":" + activeFeedIsCat()); displayDlg("search", getActiveFeedId() + ":" + activeFeedIsCat());
return false;
} }
if (keycode == 82 && shift_key) { // R if (keycode == 82 && shift_key) { // R
return scheduleFeedUpdate(true); scheduleFeedUpdate(true);
return false;
} }
if (keycode == 82) { // r if (keycode == 82) { // r
if (getActiveFeedId()) { if (getActiveFeedId()) {
return viewfeed(getActiveFeedId(), "ForceUpdate"); viewfeed(getActiveFeedId(), "ForceUpdate");
return false;
} }
} }
@ -1002,14 +1005,14 @@ function hotkey_handler(e) {
var feed = getActiveFeedId(); var feed = getActiveFeedId();
var new_feed = getRelativeFeedId(feedlist, feed, 'prev'); var new_feed = getRelativeFeedId(feedlist, feed, 'prev');
if (new_feed) viewfeed(new_feed, ''); if (new_feed) viewfeed(new_feed, '');
return; return false;
} }
if (keycode == 75) { // k if (keycode == 75) { // k
var feed = getActiveFeedId(); var feed = getActiveFeedId();
var new_feed = getRelativeFeedId(feedlist, feed, 'next'); var new_feed = getRelativeFeedId(feedlist, feed, 'next');
if (new_feed) viewfeed(new_feed, ''); if (new_feed) viewfeed(new_feed, '');
return; return false;
} }
if (shift_key && (keycode == 78 || keycode == 40)) { // shift - n, down if (shift_key && (keycode == 78 || keycode == 40)) { // shift - n, down
@ -1041,7 +1044,7 @@ function hotkey_handler(e) {
if (id) { if (id) {
togglePub(id); togglePub(id);
} }
return; return false;
} }
if (keycode == 83) { // s if (keycode == 83) { // s
@ -1049,7 +1052,7 @@ function hotkey_handler(e) {
if (id) { if (id) {
toggleMark(id); toggleMark(id);
} }
return; return false;
} }
@ -1058,13 +1061,14 @@ function hotkey_handler(e) {
if (id) { if (id) {
toggleUnread(id); toggleUnread(id);
} }
return; return false;
} }
if (keycode == 84 && shift_key) { // T if (keycode == 84 && shift_key) { // T
var id = getActiveArticleId(); var id = getActiveArticleId();
if (id) { if (id) {
editArticleTags(id, getActiveFeedId(), isCdmMode()); editArticleTags(id, getActiveFeedId(), isCdmMode());
return false;
} }
} }
@ -1076,15 +1080,15 @@ function hotkey_handler(e) {
if (cb) { if (cb) {
cb.checked = !cb.checked; cb.checked = !cb.checked;
toggleSelectRowById(cb, "RROW-" + id); toggleSelectRowById(cb, "RROW-" + id);
}
return false; return false;
} }
} }
}
if (keycode == 79) { // o if (keycode == 79) { // o
if (getActiveArticleId()) { if (getActiveArticleId()) {
openArticleInNewWindow(getActiveArticleId()); openArticleInNewWindow(getActiveArticleId());
return false;
} }
} }
@ -1097,36 +1101,43 @@ function hotkey_handler(e) {
hotkey_prefix = false; hotkey_prefix = false;
if (keycode == 65) { // a if (keycode == 65) { // a
return toggleDispRead(); toggleDispRead();
return false;
} }
if (keycode == 85 && shift_key) { // U if (keycode == 85 && shift_key) { // U
return scheduleFeedUpdate(true); scheduleFeedUpdate(true);
return false;
} }
if (keycode == 85) { // u if (keycode == 85) { // u
if (getActiveFeedId()) { if (getActiveFeedId()) {
return viewfeed(getActiveFeedId(), "ForceUpdate"); viewfeed(getActiveFeedId(), "ForceUpdate");
return false;
} }
} }
if (keycode == 69) { // e if (keycode == 69) { // e
return editFeedDlg(getActiveFeedId()); editFeedDlg(getActiveFeedId());
return false;
} }
if (keycode == 83) { // s if (keycode == 83) { // s
return displayDlg("quickAddFeed"); displayDlg("quickAddFeed");
return false;
} }
if (keycode == 67 && shift_key) { // C if (keycode == 67 && shift_key) { // C
if (typeof catchupAllFeeds != 'undefined') { if (typeof catchupAllFeeds != 'undefined') {
return catchupAllFeeds(); catchupAllFeeds();
return false;
} }
} }
if (keycode == 67) { // c if (keycode == 67) { // c
if (getActiveFeedId()) { if (getActiveFeedId()) {
return catchupCurrentFeed(); catchupCurrentFeed();
return false;
} }
} }
@ -1138,12 +1149,14 @@ function hotkey_handler(e) {
hotkey_prefix = false; hotkey_prefix = false;
if (keycode == 70) { // f if (keycode == 70) { // f
return displayDlg("quickAddFilter", getActiveFeedId()); displayDlg("quickAddFilter", getActiveFeedId());
return false;
} }
if (keycode == 83) { // s if (keycode == 83) { // s
if (typeof collapse_feedlist != 'undefined') { if (typeof collapse_feedlist != 'undefined') {
return collapse_feedlist(); collapse_feedlist();
return false;
} }
} }
@ -1156,23 +1169,28 @@ function hotkey_handler(e) {
hotkey_prefix = false; hotkey_prefix = false;
if (keycode == 83) { // s if (keycode == 83) { // s
return viewfeed(-1); viewfeed(-1);
return false;
} }
if (keycode == 80 && shift_key) { // P if (keycode == 80 && shift_key) { // P
return gotoPreferences(); gotoPreferences();
return false;
} }
if (keycode == 80) { // p if (keycode == 80) { // p
return viewfeed(-2); viewfeed(-2);
return false;
} }
if (keycode == 70) { // f if (keycode == 70) { // f
return viewfeed(-3); viewfeed(-3);
return false;
} }
if (keycode == 84 && shift_key) { // T if (keycode == 84 && shift_key) { // T
toggleTags(); toggleTags();
return false;
} }
} }