Is there any way around having to click a bookmarklet on the bookmarks toolbar?
I do not keep a bookmarks toolbar active, and also prefer to do things on the keyboard whenever possible.
I do not keep a bookmarks toolbar active, and also prefer to do things on the keyboard whenever possible.
The bones of it:
// ==UserScript==
// @name Personal jmapui tweaks
// @version 1
// @grant none
// ==/UserScript==
addEventListener("keypress", event => {
if (event.target …) { return; }
if (event.key == 'x' && event.ctrlKey && !event.metaKey …) {
window.eval('…');
}
});
You’ll want to do things like skip events targeted at form elements or within a contenteditable, perhaps unless you use a suitable modifier.It may be helpful to flatten the modifiers and key into a single string, like "Ctrl-Meta-Shift-S", and match on that.
The security interactions between your user script code and document code are fiddly and troublesome, and debugging is distressingly limited. I find using window.eval(`…`) to be a good technique for executing arbitrary code in the security context of the page itself.
https://chrome.google.com/webstore/detail/speed-dial-for-goo...
There are other more powerful ones i am playing with