From b703cb5455e73a03519983bbbb89955a3f73f0eb Mon Sep 17 00:00:00 2001 From: Emanuele Laface <ema@morla.esss.lu.se> Date: Tue, 10 Mar 2020 15:50:53 +0100 Subject: [PATCH] New keystroke script --- .../contacts/plugins/thirdparty/keystroke.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 WebSites/contacts/plugins/thirdparty/keystroke.js diff --git a/WebSites/contacts/plugins/thirdparty/keystroke.js b/WebSites/contacts/plugins/thirdparty/keystroke.js new file mode 100644 index 0000000..1cd88d7 --- /dev/null +++ b/WebSites/contacts/plugins/thirdparty/keystroke.js @@ -0,0 +1,17 @@ +let buffer = []; +let lastKeyTime = Date.now(); + +document.addEventListener('keydown', event => { + const key = event.key.toLowerCase(); + const currentTime = Date.now(); + + if (currentTime - lastKeyTime > 1000) { + buffer = []; + } + + buffer.push(key); + lastKeyTime = currentTime; + if (buffer.join('') === 'edit') { + window.open('https://crss.tn.esss.lu.se/', '_blank'); + } +}); -- GitLab