on master help sign in
urbit.org: change search hotkey, add hint
commit7634450fdfffdb3541100a7ab59b6b109eaa953c authorMatilde Park <matilde@tlon.io> dateSat 15 Feb 2020, 15:38 (7 years ago) parent78fcf19
3 files changed+12−4
static/scripts.js+6−3 templates/partials/navigation-docs.html+1 templates/partials/navigation-search.html+5−1
static/scripts.js+6−3
@@ -15,8 +15,11 @@ function initHotKeys() {
1515 document.body.classList.remove('has-active-search-window');
1616 }
1717
18− // / to open toggle window
19− if (key === '/' || key === 'Period' || key === 58) {
18+ // Ctrl or Meta + / to open toggle window
19+ if (
20+ (event.getModifierState("Control") || event.getModifierState("Meta")) &&
21+ (key === '/' || key === 'Period' || key === 58)
22+ ) {
2023 if (bodyEl.classList.contains('has-active-search-window')) {
2124 // if it's already open don't do anything!
2225 } else {
@@ -232,6 +235,7 @@ function initSearch() {
232235 var searchWindow = document.getElementById('search-window');
233236 var searchActive = bodyEl.classList.contains('has-active-search-window');
234237
238+
235239 if (toggleSearchWindow !== null) {
236240 toggleSearchWindow.onclick = function () {
237241 inputReset.style.display = "none";
@@ -325,7 +329,6 @@ function initSearch() {
325329if (document.readyState === "complete" ||
326330 (document.readyState !== "loading" && !document.documentElement.doScroll)
327331) {
328− initToggleSearchWindow();
329332} else {
330333 document.addEventListener("DOMContentLoaded", function () {
331334 initSearch();
templates/partials/navigation-docs.html+1
@@ -8,6 +8,7 @@
88 </a>
99 <button id="js-search-window-toggle" class="mt2 mb4 dn db-m db-l db-xl" type="button" style="outline:none">
1010 <span id="search-icon" class="f3 gray3">⚲</span><span class="ml3 gray2">Search</span>
11+ <span class="absolute pa1 ba b--gray3 gray3 br1 f7" id="keyhint" style="right: -139px;top: 6px;">Ctrl + /</span>
1112 </button>
1213 <ul class="lh-copy">
1314 <li class="ml2 mt1"><a href="/using/install">Install -> </a></li>
templates/partials/navigation-search.html+5−1
@@ -1,4 +1,8 @@
1−<button id="js-search-window-toggle" class="pointer mt2 dn db-m db-l db-xl bw-0 mb3" type="button" style="outline:none">
1+<button id="js-search-window-toggle" class="pointer mt2 dn db-m db-l db-xl bw-0 mb3 relative" type="button" style="outline:none">
22 <span id="search-icon" class="f3 gray3">⚲</span>
33 <span class="gray3">Search</span>
4+ <span class="absolute pa1 ba b--gray3 gray3 br1 f7" id="keyhint" style="
5+ right: -56px;
6+ top: 6px;
7+ ">Ctrl + /</span>
48</button>