summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2008-05-16 07:05:12 +0100
committerAndrew Dolgov <[email protected]>2008-05-16 07:05:12 +0100
commit746dcf42995b4dea9da7036386a0649b38c4e095 (patch)
tree1ddec89043e09de54624d5a902ad1767fcd75370
parent85ef21180b828f383d73ae6daaa2dbb5947fafca (diff)
hotkey support for prefs
-rw-r--r--help/4.php37
-rw-r--r--modules/pref-labels.php2
-rw-r--r--prefs.js102
-rw-r--r--prefs.php6
-rw-r--r--tt-rss.css2
-rw-r--r--tt-rss.js4
6 files changed, 136 insertions, 17 deletions
diff --git a/help/4.php b/help/4.php
new file mode 100644
index 000000000..78eed93f3
--- /dev/null
+++ b/help/4.php
@@ -0,0 +1,37 @@
+<h1><?php echo __("Keyboard Shortcuts") ?></h1>
+
+<table width='100%'><tr><td width='50%' valign='top'>
+
+ <h2><?php echo __("Navigation") ?></h2>
+
+ <table>
+ <tr><td class='n'>1</td><td><?php echo __("Preferences") ?></td></tr>
+ <tr><td class='n'>2</td><td><?php echo __("My Feeds") ?></td></tr>
+ <tr><td class='n'>3</td><td><?php echo __("Other Feeds") ?></td></tr>
+ <tr><td class='n'>4</td><td><?php echo __("Content Filtering") ?></td></tr>
+ <tr><td class='n'>5</td><td><?php echo __("Label Editor") ?></td></tr>
+ <tr><td class='n'>6</td><td><?php echo __("User Manager") ?></td></tr>
+ </table>
+
+</td><td valign='top'>
+
+ <h2><?php echo __("Panel actions") ?></h2>
+
+ <table>
+ <tr><td class='n'>c s</td><td><?php echo __("Subscribe to feed") ?></td></tr>
+ <tr><td class='n'>c f</td><td><?php echo __("Create filter") ?></td></tr>
+ <tr><td class='n'>c l</td><td><?php echo __("Create label") ?></td></tr>
+ <tr><td class='n'>c u</td><td><?php echo __("Create user") ?></td></tr>
+ </table>
+
+ <h2><?php echo __("Other actions") ?></h2>
+
+ <table>
+ <tr><td class='n'>g x</td><td><?php echo __("Exit preferences") ?></td></tr>
+ </table>
+
+</td></tr></table>
+
+<p class='insensitive'><span class='small'>Note: not all actions may be available, depending on Tiny Tiny RSS configuration and your access level.</span></p>
+
+<p class="small"><?php echo __("Press any key to close this window.") ?></p>
diff --git a/modules/pref-labels.php b/modules/pref-labels.php
index 65948ce43..e9e6ee860 100644
--- a/modules/pref-labels.php
+++ b/modules/pref-labels.php
@@ -6,7 +6,7 @@
function module_pref_labels($link) {
if (!GLOBAL_ENABLE_LABELS) {
- print "<p>Sorry, labels have been administratively disabled for this installation. Please contact instance owner or edit configuration file to enable this functionality.</p>";
+ print __("Sorry, labels have been administratively disabled for this installation. Please contact instance owner or edit configuration file to enable this functionality.");
return;
}
diff --git a/prefs.js b/prefs.js
index e3449a238..308c7b7aa 100644
--- a/prefs.js
+++ b/prefs.js
@@ -10,8 +10,8 @@ var xmlhttp = Ajax.getTransport();
var init_params = new Array();
var caller_subop = false;
-
var sanity_check_done = false;
+var hotkey_prefix = false;
function infobox_callback() {
if (xmlhttp.readyState == 4) {
@@ -1654,31 +1654,111 @@ function pref_hotkey_handler(e) {
try {
var keycode;
-
- if (!hotkeys_enabled) return;
-
+ var shift_key = false;
+
+ try {
+ shift_key = e.shiftKey;
+ } catch (e) {
+
+ }
+
if (window.event) {
keycode = window.event.keyCode;
} else if (e) {
keycode = e.which;
}
-
+
+ if (keycode == 27) { // escape
+ if (Element.visible("hotkey_help_overlay")) {
+ Element.hide("hotkey_help_overlay");
+ }
+ hotkey_prefix = false;
+ closeInfoBox();
+ }
+
+ if (!hotkeys_enabled) {
+ debug("hotkeys disabled");
+ return;
+ }
+
+ if (keycode == 16) return; // ignore lone shift
+
+ if (Element.visible("hotkey_help_overlay")) {
+ Element.hide("hotkey_help_overlay");
+ }
+
if (keycode == 13 || keycode == 27) {
seq = "";
} else {
seq = seq + "" + keycode;
}
+ /* Global hotkeys */
- if (document.getElementById("piggie")) {
+ if (!hotkey_prefix) {
+
+ if (keycode == 68 && shift_key) { // d
+ if (!debug_mode_enabled) {
+ document.getElementById('debug_output').style.display = 'block';
+ debug('debug mode activated');
+ } else {
+ document.getElementById('debug_output').style.display = 'none';
+ }
- if (seq.match("807371717369")) {
- seq = "";
- localPiggieFunction(true);
+ debug_mode_enabled = !debug_mode_enabled;
+ return;
+ }
+
+ if (keycode == 191 && shift_key) { // ?
+ if (!Element.visible("hotkey_help_overlay")) {
+ Element.show("hotkey_help_overlay");
+ } else {
+ Element.hide("hotkey_help_overlay");
+ }
+ return;
+ }
+
+ if (keycode == 49) { // 1
+ selectTab("genConfig");
+ }
+
+ if (keycode == 50 && document.getElementById("feedConfigTab")) { // 2
+ return selectTab("feedConfig");
+ }
+
+ if (keycode == 51 && document.getElementById("feedBrowserTab")) { // 3
+ return selectTab("feedBrowser");
+ }
+
+ if (keycode == 52 && document.getElementById("filterConfigTab")) { // 4
+ return selectTab("filterConfig");
+ }
+
+ if (keycode == 53 && document.getElementById("labelConfigTab")) { // 5
+ return selectTab("labelConfig");
+ }
+
+ if (keycode == 54 && document.getElementById("userConfigTab")) { // 6
+ return selectTab("userConfig");
+ }
+
+ }
+
+ if (document.getElementById("piggie")) {
+
+ if (seq.match("807371717369")) {
+ seq = "";
+ localPiggieFunction(true);
+ } else {
+ localPiggieFunction(false);
+ }
+ }
+
+ if (hotkey_prefix) {
+ debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode);
} else {
- localPiggieFunction(false);
+ debug("KP: CODE=" + keycode);
}
- }
} catch (e) {
exception_error("pref_hotkey_handler", e);
diff --git a/prefs.php b/prefs.php
index bf58aa3bd..908f66f2c 100644
--- a/prefs.php
+++ b/prefs.php
@@ -69,12 +69,14 @@
<body>
-<img id="piggie" src="images/piggie.png" style="display : none" alt="piggie">
-
<div id="hotkey_help_overlay" style="display : none" onclick="Element.hide(this)">
+ <?php rounded_table_start("hho"); ?>
<?php include "help/4.php" ?>
+ <?php rounded_table_end(); ?>
</div>
+<img id="piggie" src="images/piggie.png" style="display : none" alt="piggie">
+
<script type="text/javascript">
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", init, null);
diff --git a/tt-rss.css b/tt-rss.css
index 32ccfde3b..f47e43634 100644
--- a/tt-rss.css
+++ b/tt-rss.css
@@ -674,7 +674,7 @@ span.feed_error {
color : red;
}
-span.insensitive, div.insensitive, li.insensitive, label.insensitive, td.insensitive {
+.insensitive {
color : gray;
}
diff --git a/tt-rss.js b/tt-rss.js
index 2a0fc8626..47b2a14cb 100644
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -1302,7 +1302,7 @@ function hotkey_handler(e) {
if (Element.visible("hotkey_help_overlay")) {
Element.hide("hotkey_help_overlay");
}
- } */
+ }
if (typeof localHotkeyHandler != 'undefined') {
try {
@@ -1310,7 +1310,7 @@ function hotkey_handler(e) {
} catch (e) {
exception_error("hotkey_handler, local:", e);
}
- }
+ } */
if (hotkey_prefix) {
debug("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode);