From 9e004a40faba221f9179a96df6cceaeaba2d8c68 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sat, 26 Aug 2023 18:16:09 +1000 Subject: Firefox x org-protocol A greasemonkey userscript with keybindings for org-protocol. A webpage to activate org-protocol in firefox, which requires network.protocol-handler.expose.org-protocol to be false Some org-protocol bookmarklet in case the keys don't work --- firefox/extensions/org-protocol.user.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 firefox/extensions/org-protocol.user.js (limited to 'firefox/extensions') diff --git a/firefox/extensions/org-protocol.user.js b/firefox/extensions/org-protocol.user.js new file mode 100644 index 0000000..196a473 --- /dev/null +++ b/firefox/extensions/org-protocol.user.js @@ -0,0 +1,32 @@ +// ==UserScript== +// @name org-protocol +// @version 2 +// @grant none +// ==/UserScript== +window.addEventListener("keydown", function (event) { + if (event.defaultPrevented) { + return; // Do nothing if the event was already processed + } + + if (event.key === "l" && event.ctrlKey) { + event.preventDefault(); + location.href = 'org-protocol://store-link?url=' + + encodeURIComponent(location.href) + + '&title=' + document.title; + } + + if (event.key === ";" && event.ctrlKey) { + event.preventDefault(); + location.href = 'org-protocol://capture?template=t' + + '&url=' + encodeURIComponent(window.location.href) + + '&title=' + document.title + + '&body=' + window.getSelection(); + } + + if (event.key === "'" && event.ctrlKey) { + event.preventDefault(); + location.href = 'org-protocol://grok?url=' + + encodeURIComponent(location.href); + } + +}, true); -- cgit v1.2.3