Bugfix: un-stucked array key handling to prevent popup spam

This commit is contained in:
Marvin Scham
2022-06-05 19:57:06 +02:00
committed by GitHub
parent 85f661f651
commit 0127fddd11

View File

@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name LinkAce Launcher // @name LinkAce Launcher
// @namespace https://marvinscham.de // @namespace https://marvinscham.de
// @version 0.2 // @version 0.3
// @description Creates a keyboard shortcut to add links to my instance of LinkAce // @description Creates a keyboard shortcut to add links to my instance of LinkAce
// @author marvinscham // @author marvinscham
// @match *://*/* // @match *://*/*
@@ -14,10 +14,11 @@ let keysPressed = {};
document.addEventListener('keydown', (event) => { document.addEventListener('keydown', (event) => {
keysPressed[event.key] = true; keysPressed[event.key] = true;
}); setTimeout(
function() {
document.addEventListener('keyup', (event) => { keysPressed[event.key] = false;
delete this.keysPressed[event.key]; }, 500
);
}); });
window.addEventListener("load", function () { window.addEventListener("load", function () {
@@ -29,4 +30,4 @@ window.addEventListener("load", function () {
window.open('https://bookmarks.xn--schmkerei-37a.de/bookmarklet/add?u=' + encodeURIComponent(url) + '&t=' + encodeURIComponent(title) + '&d=' + encodeURIComponent(description), '_blank', 'menubar=no,height=720,width=600,toolbar=no,scrollbars=yes,status=no,dialog=1'); window.open('https://bookmarks.xn--schmkerei-37a.de/bookmarklet/add?u=' + encodeURIComponent(url) + '&t=' + encodeURIComponent(title) + '&d=' + encodeURIComponent(description), '_blank', 'menubar=no,height=720,width=600,toolbar=no,scrollbars=yes,status=no,dialog=1');
} }
}); });
})(); });