summaryrefslogtreecommitdiff
path: root/tt-rss.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-12-04 09:26:09 +0100
committerAndrew Dolgov <[email protected]>2006-12-04 09:26:09 +0100
commit1dc8dba07c9c57016a7bac4dd8ce3804024597b9 (patch)
tree7d557c820e526c73e522ec55394e5f4d2fc23d7a /tt-rss.js
parentd4b4b9dece1ce4bb7d1bc56004c0dde318b8008f (diff)
add experimental operation history stack
Diffstat (limited to 'tt-rss.js')
-rw-r--r--tt-rss.js82
1 files changed, 82 insertions, 0 deletions
diff --git a/tt-rss.js b/tt-rss.js
index 472c90a6b..863020505 100644
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -20,6 +20,8 @@ var xmlhttp_ctr = Ajax.getTransport();
var init_params = new Object();
+var op_history = new Array();
+
function toggleTags() {
display_tags = !display_tags;
@@ -654,3 +656,83 @@ function feedEditSave() {
}
}
+function localHotkeyHandler(e) {
+
+ var keycode;
+
+ if (window.event) {
+ keycode = window.event.keyCode;
+ } else if (e) {
+ keycode = e.which;
+ }
+
+ var shift_key = false;
+
+ try {
+ shift_key = e.shiftKey;
+ } catch (e) { }
+
+ if (keycode == 66 && shift_key) { // shift-B
+
+ var op = history_pop();
+
+ if (op) {
+ var op_s = op.split(":");
+
+ var i;
+ for (i = 0; i < op_s.length; i++) {
+ if (op_s[i] == 'undefined') {
+ op_s[i] = undefined;
+ }
+
+ if (op_s[i] == 'false') {
+ op_s[i] = false;
+ }
+
+ if (op_s[i] == 'true') {
+ op_s[i] = true;
+ }
+
+ }
+
+ debug("history split: " + op_s);
+
+ if (op_s[0] == "ARTICLE") {
+ debug("history: reverting to article " + op_s[1] + "/" + op_s[2]);
+ view(op_s[1], op_s[2], true);
+ }
+
+ if (op_s[0] == "FEED") {
+ viewfeed(op_s[1], op_s[2], op_s[3], op_s[4], true);
+ }
+
+ } else {
+ notify("No operation to undo");
+ }
+
+ return false;
+
+ }
+
+ debug("LKP=" + keycode);
+}
+
+function history_push(op) {
+ debug("history_push: " + op);
+ op_history.push(op);
+
+ while (op_history.length > 30) {
+ op_history.shift();
+ }
+}
+
+function history_pop() {
+ var op = op_history.pop();
+ debug("history_pop: " + op);
+ return op;
+}
+
+function history_clear() {
+ debug("history_clear");
+ op_history.clear();
+}