From b121718b93525a162aad324d3bafe83a51680099 Mon Sep 17 00:00:00 2001 From: Marvin Scham <67930021+marvinscham@users.noreply.github.com> Date: Wed, 25 May 2022 02:38:02 +0200 Subject: [PATCH] Create Linkace Launcher.js --- Linkace Launcher.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Linkace Launcher.js diff --git a/Linkace Launcher.js b/Linkace Launcher.js new file mode 100644 index 0000000..0c4c2c1 --- /dev/null +++ b/Linkace Launcher.js @@ -0,0 +1,32 @@ +// ==UserScript== +// @name LinkAce Launcher +// @namespace https://marvinscham.de +// @version 0.2 +// @description Creates a keyboard shortcut to add links to my instance of LinkAce +// @author marvinscham +// @match *://*/* +// @exclude https://bookmarks.xn--schmkerei-37a.de/* +// @icon https://bookmarks.xn--schmkerei-37a.de/favicon-32x32.png +// @grant none +// ==/UserScript== + +let keysPressed = {}; + +document.addEventListener('keydown', (event) => { + keysPressed[event.key] = true; +}); + +document.addEventListener('keyup', (event) => { + delete this.keysPressed[event.key]; +}); + +window.addEventListener("load", function () { + window.addEventListener('keydown', function () { + if (keysPressed["Control"] && keysPressed[">"]) { + var url = location.href; + var description = document.getSelection() || ''; + var title = document.title || url; + 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'); + } + }); +})();