From 677e6ed6035b12a3ccb6becc9c9f6ea3d74ce37b Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Wed, 18 Jun 2014 11:25:04 -0700 Subject: [PATCH] (doc) Properly doc hotkeys in generated docs. Updated search bar to match help text. Used correct, normalized hotkeys in search. Updated shortcut menu with working shortcuts (tabs). Changed height of search help. --- src/librustdoc/html/layout.rs | 6 +++--- src/librustdoc/html/static/main.css | 2 +- src/librustdoc/html/static/main.js | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 0304a1d690e..61a2d3c5d9c 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -63,7 +63,7 @@ r##"
@@ -82,9 +82,9 @@ r##"
Show this help dialog
S
Focus the search field
-
+
Move up in search results
-
+
Move down in search results
Go to active search result
diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css index a7bd082ec17..a88992f6c4c 100644 --- a/src/librustdoc/html/static/main.css +++ b/src/librustdoc/html/static/main.css @@ -347,7 +347,7 @@ p a:hover { text-decoration: underline; } margin-top: -125px; margin-left: -275px; width: 550px; - height: 250px; + height: 300px; border: 1px solid #bfbfbf; } diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 697199e9abf..fc1e480f6af 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -71,10 +71,10 @@ return; } - if (e.keyCode === 188 && $('#help').hasClass('hidden')) { // question mark + if (e.which === 191 && $('#help').hasClass('hidden')) { // question mark e.preventDefault(); $('#help').removeClass('hidden'); - } else if (e.keyCode === 27) { // esc + } else if (e.which === 27) { // esc if (!$('#help').hasClass('hidden')) { e.preventDefault(); $('#help').addClass('hidden'); @@ -83,7 +83,7 @@ $('#search').addClass('hidden'); $('#main').removeClass('hidden'); } - } else if (e.keyCode === 83) { // S + } else if (e.which === 83) { // S e.preventDefault(); $('.search-input').focus(); } @@ -361,7 +361,7 @@ $(document).on('keypress.searchnav', function(e) { var $active = $results.filter('.highlighted'); - if (e.keyCode === 38) { // up + if (e.which === 38) { // up e.preventDefault(); if (!$active.length || !$active.prev()) { return; @@ -369,7 +369,7 @@ $active.prev().addClass('highlighted'); $active.removeClass('highlighted'); - } else if (e.keyCode === 40) { // down + } else if (e.which === 40) { // down e.preventDefault(); if (!$active.length) { $results.first().addClass('highlighted'); @@ -377,7 +377,7 @@ $active.next().addClass('highlighted'); $active.removeClass('highlighted'); } - } else if (e.keyCode === 13) { // return + } else if (e.which === 13) { // return e.preventDefault(); if ($active.length) { document.location.href = $active.find('a').prop('href');