hotkey support for prefs

master
Andrew Dolgov 16 years ago
parent 85ef21180b
commit 746dcf4299

@ -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>

@ -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;
}

@ -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);

@ -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);

@ -674,7 +674,7 @@ span.feed_error {
color : red;
}
span.insensitive, div.insensitive, li.insensitive, label.insensitive, td.insensitive {
.insensitive {
color : gray;
}

@ -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);

Loading…
Cancel
Save