/[refeed]/trunk/style/keyhandlers.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/style/keyhandlers.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 19 - (show annotations)
Sat Dec 16 12:28:34 2006 UTC (17 years, 5 months ago) by dpavlin
File MIME type: application/javascript
File size: 5187 byte(s)
remove flag (!) because it chash with pgup
1 // /: 47, toggle keyboard stuff
2 Refeed.App.assignKeyPressHandler( 47, function(app, event) { toggle_kb(); return false; }, true);
3
4 // ?: 63, toggle cheat sheet
5 Refeed.App.assignKeyPressHandler( 63, function(app, event) { toggle_cheatsheet(); return false; }, true);
6
7 // ,: 44, jump up one feed/item
8 Refeed.App.assignKeyPressHandler( 44, function(app, event) { return app.doScroll(-1); });
9
10 // .: 46, jump down one feed/item
11 Refeed.App.assignKeyPressHandler( 46, function(app, event) { return app.doScroll(1); });
12
13 // vi-like keybindings (like , and . but without wrapping)
14 // j: 106, jump down one feed/item
15 Refeed.App.assignKeyPressHandler(106, function(app, event) { return app.doScroll(1, 0); });
16 // k: 107, jump up one feed/item
17 Refeed.App.assignKeyPressHandler(107, function(app, event) { return app.doScroll(-1, 0); });
18
19 // r: 114, reload page
20 Refeed.App.assignKeyPressHandler(114, function(app, event) { location.reload(true); return false; });
21
22 // A: 65, archive all shown items
23 Refeed.App.assignKeyPressHandler( 65, function(app, event) { app.archiveAll(); return false; });
24
25 // f: 102, back to feed list
26 Refeed.App.assignKeyPressHandler(102, function(app, event) { location.href = app.feedsHREF; return false; });
27
28 // i: 105, new items, paged
29 Refeed.App.assignKeyPressHandler(105, function(app, event) { location.href = app.itemsHREF; return false; });
30
31
32
33 // enter: 13, open link
34 Refeed.Item.prototype.assignKeyPressHandler( 13, function(item, event) { return Refeed.App.openLink(item.link, item.newWindow); });
35 Refeed.Feed.prototype.assignKeyPressHandler( 13, function(feed, event) { return Refeed.App.openLink(feed.link, false); });
36
37 // return: 3, open link
38 Refeed.Item.prototype.assignKeyPressHandler( 3, function(item, event) { return Refeed.App.openLink(item.link, item.newWindow); });
39 Refeed.Feed.prototype.assignKeyPressHandler( 3, function(feed, event) { return Refeed.App.openLink(feed.link, false); });
40
41 // u: 117, update feed
42 Refeed.Feed.prototype.assignKeyPressHandler(117, function(feed, event) { return feed.update(); });
43
44 // a: 97
45 Refeed.Item.prototype.assignKeyPressHandler( 97, function(item, event) { if (toggle_read(item.id)) Refeed.App.doScroll(1, 0); return false; });
46 Refeed.Feed.prototype.assignKeyPressHandler( 97, function(feed, event) { archive_feed(feed.id); return false; });
47
48 // p: 112
49 Refeed.Item.prototype.assignKeyPressHandler(112, function(item, event) { toggle_published(item.id); return false; });
50
51 // v: 118, item body
52 Refeed.Item.prototype.assignKeyPressHandler(118, function(item, event) { populate_item_body(item.id, 'itemBodyHTML', 'itemTab'+item.id+'View'); return false; });
53
54 // e: 101, edit form
55 Refeed.Item.prototype.assignKeyPressHandler(101, function(item, event) { populate_item_body(item.id, 'itemEditFormHTML', 'itemTab'+item.id+'Edit'); return false; });
56
57 // c: 99, comment form
58 Refeed.Item.prototype.assignKeyPressHandler( 99, function(item, event) { populate_item_body(item.id, 'itemCommentFormHTML', 'itemTab'+item.id+'CommentTag'); return false; });
59 // t: 116, (tag) comment form
60 Refeed.Item.prototype.assignKeyPressHandler(116, function(item, event) { populate_item_body(item.id, 'itemCommentFormHTML', 'itemTab'+item.id+'CommentTag'); return false; });
61
62 // digits: 48-57
63 for(var keycode = 48; keycode <= 57; keycode += 1) {
64 Refeed.Item.prototype.assignKeyPressHandler(keycode, function(item, event) {
65
66 var keycode = Refeed.App.getKeycode(event);
67
68 if(event.altKey || event.ctrlKey) {
69 var link = get_item_link(item.id, keycode - 48);
70
71 if(link) {
72 return Refeed.App.openLink(link.href, item.newWindow);
73 }
74 } else {
75 return link_select(item.id, (keycode - 48));
76 }
77
78 return true;
79 });
80 }
81
82 // additional keyboard shortcuts
83 // !: 92, flag (star) item
84 //Refeed.Item.prototype.assignKeyPressHandler(92, function(item, event) { toggle_flagged(item.id, 'itemTab'+item.id+'FlaggedEntry', true); return false; });
85 // i: 105, show update information
86 Refeed.Item.prototype.assignKeyPressHandler(105, function(item, event) { populate_item_body(item.id, 'Update_Logger.updateLogHTML', 'itemTab'+item.id+'UpdateLog'); return false; });
87 // s: 115, similar
88 Refeed.Item.prototype.assignKeyPressHandler(115, function(item, event) { populate_item_body(item.id, 'Similar_Entries.similarEntriesHTML', 'itemTab'+item.id+'SimilarEntries'); return false; });
89 // N: 78, new items
90 Refeed.Feed.prototype.assignKeyPressHandler( 78, function(feed, event) { location.href = location.href.replace(/\/[^\/]*$/, '/view.php?how=paged&what=new') ; return false; });
91 Refeed.Item.prototype.assignKeyPressHandler( 78, function(item, event) { location.href = location.href.replace(/\/[^\/]*$/, '/view.php?how=paged&what=new') ; return false; });
92 // P: 80, published items
93 Refeed.Feed.prototype.assignKeyPressHandler( 80, function(feed, event) { location.href = location.href.replace(/\/[^\/]*$/, '/view.php?how=paged&what=published') ; return false; });
94 Refeed.Item.prototype.assignKeyPressHandler( 80, function(item, event) { location.href = location.href.replace(/\/[^\/]*$/, '/view.php?how=paged&what=published') ; return false; });

  ViewVC Help
Powered by ViewVC 1.1.26