Skip to content

Instantly share code, notes, and snippets.

@weaming
Created April 6, 2023 13:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weaming/65eead2067b264d8156daca41962b9df to your computer and use it in GitHub Desktop.
Save weaming/65eead2067b264d8156daca41962b9df to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Shotcuts
// @namespace http://bitflow.org
// @version 0.1
// @description add shotcuts
// @match https://*/*
// @copyright 2022+, You
// ==/UserScript==
function onKey(e) {
// console.log(e, e.key);
switch (e.key) {
case 'Home':
if (e.metaKey) {
// Cmd + Home
location.href = location.origin;
}
break;
default:
break;
}
}
document.addEventListener('keydown', onKey, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment