-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
188 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
const keyPairs = { | ||
keys :{ | ||
"b": { | ||
selector: '[class="option-icon bookmark-btn"]', | ||
description: "Bookmark article", | ||
key: "b" | ||
}, | ||
"d":{ | ||
selector: ".download-button", | ||
description: "Download the article", | ||
key: "d" | ||
}, | ||
"e": { | ||
selector: ".edit-link", | ||
description: "Edit page on Wikipedia", | ||
key: "e" | ||
}, | ||
"h": { | ||
selector: ".goHomeBtn", | ||
description: "Open home in new tab", | ||
key: "h" | ||
}, | ||
"p": { | ||
selector: ".download-button", | ||
description: "Download the article", | ||
key: "p" | ||
}, | ||
"s": { | ||
selector: ".share-go-btn", | ||
description: "Share articles", | ||
key: "s" | ||
}, | ||
"q": { | ||
selector: ".quick-jump-btn", | ||
description: "Quick Jump", | ||
key: "q" | ||
}, | ||
"w": { | ||
selector: ".wiki-link", | ||
description: "Open in Wikipedia", | ||
key: "w" | ||
}, | ||
"k": { | ||
selector: ".keyboard-btn", | ||
description: "Keyboard Shortcuts", | ||
key: "k" | ||
}, | ||
"esc": { | ||
selector: "", | ||
description: "Close pop-ups", | ||
key: "esc" | ||
}, | ||
}, | ||
links: ["e", "w", "h"] | ||
} | ||
|
||
|
||
$(document).ready(function() { | ||
|
||
hotkeys('b,s,p,w,q,e,d,h', function (event, handler){ | ||
|
||
if(keyPairs.links.includes(handler.key)){ | ||
window.open($(keyPairs.keys[handler.key].selector).attr("href")) | ||
return; | ||
} | ||
|
||
$(keyPairs.keys[handler.key].selector).trigger("click"); | ||
}); | ||
|
||
var shortCutItems = Object.values(keyPairs.keys).map(item => ` | ||
<tr class="keyboard-shortcut-item"> | ||
<td> | ||
<code class="key-code center"> | ||
${item.key} | ||
</code> | ||
</td> | ||
<td> | ||
<h6 class="key-title">${item.description}</h6> | ||
</td> | ||
</tr> | ||
`) | ||
|
||
$(".short-cuts-table").html(shortCutItems.join("")) | ||
}); | ||
|
||
$(".keyboard-btn").click(function(){ | ||
$(".keyboard-overlay").fadeIn().css("display","flex"); | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters