diff --git a/classes/backend.php b/classes/backend.php
index 42dfb5474..29f18171f 100644
--- a/classes/backend.php
+++ b/classes/backend.php
@@ -18,14 +18,74 @@ class Backend extends Handler {
print_r($rv);
}
+ private function display_main_help() {
+ $info = get_hotkeys_info($this->link);
+ $imap = get_hotkeys_map($this->link);
+ $omap = array();
+
+ // :(
+ $tinycharmap = array(
+ "(9)" => "{TAB}",
+ "(191)" => "?");
+
+ foreach ($imap[1] as $sequence => $action) {
+ if (!isset($omap[$action])) {
+ $omap[$action] = isset($tinycharmap[$sequence]) ? $tinycharmap[$sequence] :
+ $sequence;
+ }
+ }
+
+ print "
";
+
+ print "".
+ __("Other interface tips are available in the Tiny Tiny RSS wiki.") .
+ "
";
+ }
+
function help() {
$topic = basename($_REQUEST["topic"]);
- if (file_exists("help/$topic.php")) {
+ switch ($topic) {
+ case "main":
+ $this->display_main_help();
+ break;
+ case "prefs":
+ //$this->display_prefs_help();
+ break;
+ default:
+ print "".__("Help topic not found.")."
";
+ }
+
+ print "";
+ print "";
+ print "
";
+
+ /* if (file_exists("help/$topic.php")) {
include("help/$topic.php");
} else {
print "".__("Help topic not found.")."
";
- }
+ } */
/* print "
"; */
diff --git a/help/main.php b/help/main.php
deleted file mode 100644
index 094b28977..000000000
--- a/help/main.php
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- s | |
- S | |
- u | |
- T | |
- D | |
- X | |
- o | |
- c n/c p | |
- N/P | |
- e | |
-
-
-
-
-
-
- [tab] | |
- c l | |
- c f | |
- c s | |
- ? | |
-
-
- |
-
-
-
-
- a a | |
- a u | |
- a U | |
- a p | |
- a i | |
- a n | |
-
-
-
-
-
- f r | |
- f a | |
- f s | |
- f e | |
- f q | |
- f x | |
- Q | |
- x | |
-
-
-
-
-
- g a | |
- g f | |
- g s | |
- g p | |
- g t | |
- g P | |
-
-
-
- |
-
-
-
-
diff --git a/help/prefs.php b/help/prefs.php
deleted file mode 100644
index 4cf3a1261..000000000
--- a/help/prefs.php
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
- g 1 | |
- g 2 | |
-
- g 3 | |
- g 4 | |
- g 5 | |
- g x | |
-
-
- |
-
-
-
-
- c s | |
- c T | |
- c c | |
- c f | |
-
-
-
-
-
-
-
-
- |
-
-Note: not all actions may be available, depending on Tiny Tiny RSS configuration and your access level.") ?>
-
-
diff --git a/include/functions.php b/include/functions.php
index 0d90e725e..5d277db96 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1963,14 +1963,70 @@
$params["num_feeds"] = (int) $num_feeds;
$params["collapsed_feedlist"] = (int) get_pref($link, "_COLLAPSED_FEEDLIST");
- $params["hotkeys"] = get_hotkeys($link);
+ $params["hotkeys"] = get_hotkeys_map($link);
$params["csrf_token"] = $_SESSION["csrf_token"];
return $params;
}
- function get_hotkeys($link) {
+ function get_hotkeys_info($link) {
+ $hotkeys = array(
+ __("Navigation") => array(
+ "next_feed" => __("Open next feed"),
+ "prev_feed" => __("Open previous feed"),
+ "next_article" => __("Open next article"),
+ "prev_article" => __("Open previous article"),
+ "search_dialog" => __("Show search dialog")),
+ __("Article") => array(
+ "toggle_mark" => __("Toggle starred"),
+ "toggle_publ" => __("Toggle published"),
+ "toggle_unread" => __("Toggle unread"),
+ "edit_tags" => __("Edit tags"),
+ "dismiss_selected" => __("Dismiss selected"),
+ "dismiss_read" => __("Dismiss read"),
+ "open_in_new_window" => __("Open in new window"),
+ "catchup_below" => __("Mark below as read"),
+ "catchup_above" => __("Mark above as read"),
+ "article_scroll_down" => __("Scroll down"),
+ "article_scroll_up" => __("Scroll up"),
+ "select_article_cursor" => __("Select article under cursor"),
+ "email_article" => __("Email article")),
+ __("Article selection") => array(
+ "select_all" => __("Select all articles"),
+ "select_unread" => __("Select unread"),
+ "select_marked" => __("Select starred"),
+ "select_published" => __("Select published"),
+ "select_invert" => __("Invert selection"),
+ "select_none" => __("Deselect everything")),
+ __("Feed") => array(
+ "feed_refresh" => __("Refresh current feed"),
+ "feed_unhide_read" => __("Un/hide read feeds"),
+ "feed_subscribe" => __("Subscribe to feed"),
+ "feed_edit" => __("Edit feed"),
+ "feed_catchup" => __("Mark as read"),
+ "feed_reverse" => __("Reverse headlines"),
+ "feed_debug_update" => __(""),
+ "catchup_all" => __("Mark all feeds as read"),
+ "cat_toggle_collapse" => __("Un/collapse current category")),
+ __("Go to") => array(
+ "goto_all" => __("All articles"),
+ "goto_fresh" => __("Fresh"),
+ "goto_marked" => __("Starred"),
+ "goto_published" => __("Published"),
+ "goto_tagcloud" => __("Tag cloud"),
+ "goto_prefs" => __("Preferences")),
+ __("Other") => array(
+ "create_label" => __("Create label"),
+ "create_filter" => __("Create filter"),
+ "collapse_sidebar" => __("Un/collapse sidebar"),
+ "help_dialog" => __("Show help dialog"))
+ );
+
+ return $hotkeys;
+ }
+
+ function get_hotkeys_map($link) {
$hotkeys = array(
// "navigation" => array(
"k" => "next_feed",
diff --git a/index.php b/index.php
index b86cd0e66..4d4048906 100644
--- a/index.php
+++ b/index.php
@@ -135,8 +135,6 @@
alt="new_version_icon"/>
-
-
diff --git a/js/functions.js b/js/functions.js
index 8776405be..ec533faae 100644
--- a/js/functions.js
+++ b/js/functions.js
@@ -1874,3 +1874,25 @@ function get_timestamp() {
var date = new Date();
return Math.round(date.getTime() / 1000);
}
+
+function helpDialog(topic) {
+ try {
+ var query = "backend.php?op=backend&method=help&topic=" + param_escape(topic);
+
+ if (dijit.byId("helpDlg"))
+ dijit.byId("helpDlg").destroyRecursive();
+
+ dialog = new dijit.Dialog({
+ id: "helpDlg",
+ title: __("Help"),
+ style: "width: 600px",
+ href: query,
+ });
+
+ dialog.show();
+
+ } catch (e) {
+ exception_error("helpDialog", e);
+ }
+}
+
diff --git a/js/prefs.js b/js/prefs.js
index 7ee88ab56..a193e1262 100644
--- a/js/prefs.js
+++ b/js/prefs.js
@@ -1009,9 +1009,9 @@ function validatePrefsReset() {
}
-
function pref_hotkey_handler(e) {
try {
+
if (e.target.nodeName == "INPUT" || e.target.nodeName == "TEXTAREA") return;
var keycode = false;
@@ -1034,151 +1034,65 @@ function pref_hotkey_handler(e) {
var keychar = String.fromCharCode(keycode);
if (keycode == 27) { // escape
- if (Element.visible("hotkey_help_overlay")) {
- Element.hide("hotkey_help_overlay");
- }
hotkey_prefix = false;
- closeInfoBox();
}
if (keycode == 16) return; // ignore lone shift
if (keycode == 17) return; // ignore lone ctrl
- if ((keycode == 67 || keycode == 71) && !hotkey_prefix) {
- hotkey_prefix = keycode;
+ if (!shift_key) keychar = keychar.toLowerCase();
+
+ var hotkeys = getInitParam("hotkeys");
+
+ if (!hotkey_prefix && hotkeys[0].indexOf(keychar) != -1) {
var date = new Date();
var ts = Math.round(date.getTime() / 1000);
+ hotkey_prefix = keychar;
hotkey_prefix_pressed = ts;
cmdline.innerHTML = keychar;
Element.show(cmdline);
- console.log("KP: PREFIX=" + keycode + " CHAR=" + keychar);
- return;
+ return true;
}
- if (Element.visible("hotkey_help_overlay")) {
- Element.hide("hotkey_help_overlay");
- }
-
- if (keycode == 13 || keycode == 27) {
- seq = "";
- } else {
- seq = seq + "" + keycode;
- }
-
- /* Global hotkeys */
-
Element.hide(cmdline);
- if (!hotkey_prefix) {
+ var hotkey = keychar.search(/[a-zA-Z0-9]/) != -1 ? keychar : "(" + keycode + ")";
+ hotkey = hotkey_prefix ? hotkey_prefix + " " + hotkey : hotkey;
+ hotkey_prefix = false;
- if ((keycode == 191 || keychar == '?') && shift_key) { // ?
- showHelp();
- return false;
- }
+ var hotkey_action = false;
+ var hotkeys = getInitParam("hotkeys");
- if (keycode == 191 || keychar == '/') { // /
- var search_boxes = new Array("label_search",
- "feed_search", "filter_search", "user_search", "feed_browser_search");
-
- for (var i = 0; i < search_boxes.length; i++) {
- var elem = $(search_boxes[i]);
- if (elem) {
- $(search_boxes[i]).focus();
- return false;
- }
- }
+ for (sequence in hotkeys[1]) {
+ if (sequence == hotkey) {
+ hotkey_action = hotkeys[1][sequence];
+ break;
}
}
- /* Prefix c */
-
- if (hotkey_prefix == 67) { // c
- hotkey_prefix = false;
-
- if (keycode == 70) { // f
- quickAddFilter();
- return false;
- }
-
- if (keycode == 83) { // s
- quickAddFeed();
- return false;
- }
-
- if (keycode == 85) { // u
- // no-op
- }
-
- if (keycode == 67) { // c
- editFeedCats();
- return false;
- }
-
- if (keycode == 84 && shift_key) { // T
- feedBrowser();
- return false;
- }
-
- }
-
- /* Prefix g */
-
- if (hotkey_prefix == 71) { // g
-
- hotkey_prefix = false;
-
- if (keycode == 49 && $("genConfigTab")) { // 1
- selectTab("genConfig");
- return false;
- }
-
- if (keycode == 50 && $("feedConfigTab")) { // 2
- selectTab("feedConfig");
- return false;
- }
-
- if (keycode == 51 && $("filterConfigTab")) { // 4
- selectTab("filterConfig");
- return false;
- }
-
- if (keycode == 52 && $("labelConfigTab")) { // 5
- selectTab("labelConfig");
- return false;
- }
-
- if (keycode == 53 && $("userConfigTab")) { // 6
- selectTab("userConfig");
- return false;
- }
-
- if (keycode == 88) { // x
- return gotoMain();
- }
-
- }
-
- if ($("piggie")) {
- if (seq.match("8073717369")) {
- seq = "";
- piggie(true);
- } else {
- piggie(false);
- }
- }
-
- if (hotkey_prefix) {
- console.log("KP: PREFIX=" + hotkey_prefix + " CODE=" + keycode + " CHAR=" + keychar);
- } else {
- console.log("KP: CODE=" + keycode + " CHAR=" + keychar);
+ switch (hotkey_action) {
+ case "feed_subscribe":
+ quickAddFeed();
+ return true;
+ case "create_label":
+ addLabel();
+ return true;
+ case "create_filter":
+ quickAddFilter();
+ return true;
+ case "help_dialog":
+ //helpDialog("prefs");
+ return false;
+ default:
+ console.log("unhandled action: " + hotkey_action + "; hotkey: " + hotkey);
}
} catch (e) {
- exception_error("pref_hotkey_handler", e);
+ exception_error("hotkey_handler", e);
}
}
@@ -1855,20 +1769,6 @@ function insertSSLserial(value) {
}
}
-function showHelp() {
- try {
- new Ajax.Request("backend.php", {
- parameters: "?op=backend&method=help&topic=prefs",
- onComplete: function(transport) {
- $("hotkey_help_overlay").innerHTML = transport.responseText;
- Effect.Appear("hotkey_help_overlay", {duration : 0.3});
- } });
-
- } catch (e) {
- exception_error("showHelp", e);
- }
-}
-
function gotoExportOpml(filename, settings) {
tmp = settings ? 1 : 0;
document.location.href = "backend.php?op=opml&method=export&filename=" + filename + "&settings=" + tmp;
diff --git a/js/tt-rss.js b/js/tt-rss.js
index 2698f152f..fb80f4899 100644
--- a/js/tt-rss.js
+++ b/js/tt-rss.js
@@ -453,12 +453,7 @@ function quickMenuGo(opid) {
}
if (opid == "qmcHKhelp") {
- new Ajax.Request("backend.php", {
- parameters: "?op=backend&method=help&topic=main",
- onComplete: function(transport) {
- $("hotkey_help_overlay").innerHTML = transport.responseText;
- Effect.Appear("hotkey_help_overlay", {duration : 0.3});
- } });
+ helpDialog("main");
}
} catch (e) {
@@ -638,9 +633,6 @@ function hotkey_handler(e) {
var keychar = String.fromCharCode(keycode);
if (keycode == 27) { // escape
- if (Element.visible("hotkey_help_overlay")) {
- Element.hide("hotkey_help_overlay");
- }
hotkey_prefix = false;
}
@@ -844,12 +836,7 @@ function hotkey_handler(e) {
collapse_feedlist();
return true;
case "help_dialog":
- new Ajax.Request("backend.php", {
- parameters: "?op=backend&method=help&topic=main",
- onComplete: function(transport) {
- $("hotkey_help_overlay").innerHTML = transport.responseText;
- Effect.Appear("hotkey_help_overlay", {duration : 0.3});
- } });
+ helpDialog("main");
return false;
default:
console.log("unhandled action: " + hotkey_action + "; hotkey: " + hotkey);
diff --git a/prefs.php b/prefs.php
index e20ac9baa..575fbbf0f 100644
--- a/prefs.php
+++ b/prefs.php
@@ -90,12 +90,10 @@
-
-
diff --git a/tt-rss.css b/tt-rss.css
index 9bcaafab6..ee52454cf 100644
--- a/tt-rss.css
+++ b/tt-rss.css
@@ -932,74 +932,6 @@ img.hlScorePic {
height : 16px;
}
-div#hotkey_help_overlay {
- position : absolute;
- left : 30px;
- right : 30px;
- top : 30px;
- z-index : 999;
- color : white;
- font-size : 15px;
- background : black;
- border-radius : 30px;
- padding : 10px;
-}
-
-div#hotkey_help_overlay h1 {
- text-align : center;
-}
-
-div#hotkey_help_overlay ul {
- list-style-type : none;
- margin : 0px;
-}
-
-div#hotkey_help_overlay a {
- color : #88b0f0;
-}
-
-div#hotkey_help_overlay a:hover {
- color : white;
-}
-
-div#hotkey_help_overlay li {
- margin : 0px;
-}
-
-div#hotkey_help_overlay p {
- text-align : center;
-}
-
-div#hotkey_help_overlay td.n {
- text-align : right;
- font-weight : bold;
- width : 6em;
- color : #a0ffa0;
- padding-right : 5px;
-}
-
-div#hotkey_help_overlay td {
- vertical-align : top;
-}
-
-div#hotkey_help_overlay h1 {
- margin : 0px;
-}
-
-div#hotkey_help_overlay h2 {
- font-size : 16px;
- border-width : 0px;
- margin : 0.3em 0px 0.3em 0px;
- text-align : center;
- color : #88b0f0;
-}
-
-div#hotkey_help_overlay table.hho td.top,
-div#hotkey_help_overlay table.hho td.bottom {
- text-align : center;
- font-size : 11px;
-}
-
div.dlgSec {
font-size : 12px;
color : gray;
@@ -1411,3 +1343,25 @@ ul#filterDlg_Matches li div.dijitCheckBox, ul#filterDlg_Actions li div.dijitChec
table.prefPluginsList td label, table.prefUserList td {
cursor : pointer;
}
+
+ul.helpKbList {
+ max-height : 300px;
+ overflow : auto;
+ list-style-type : none;
+ border : 1px solid #c0c0c0;
+ background-color : #ecf4ff;
+ margin : 0px 0px 5px 0px;
+ padding : 5px;
+}
+
+ul.helpKbList span.hksequence {
+ width : 6em;
+ margin-left : 20px;
+ color : #88b0f0;
+ font-weight : bold;
+ display : inline-block;
+}
+
+ul.helpKbList h2 {
+ margin-top : 0px;
+}