From 57d4946b033505e957394dae5dbba597b03c616d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Wed, 21 Dec 2022 20:40:04 +0100 Subject: [PATCH] =?UTF-8?q?add=20script=20to=20avoid=20automatic=20logout?= =?UTF-8?q?=20from=20Webkincst=C3=A1r?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webkincstar_no_logout.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 webkincstar_no_logout.js diff --git a/webkincstar_no_logout.js b/webkincstar_no_logout.js new file mode 100644 index 0000000..5edc10a --- /dev/null +++ b/webkincstar_no_logout.js @@ -0,0 +1,28 @@ +// ==UserScript== +// @name Webkincstár No Logout +// @namespace https://esoko.eu/ +// @version 0.1 +// @description Avoid automatic logout from Webkincstár +// @author Bence Pőcze +// @match https://webkincstar.allamkincstar.gov.hu/* +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + + function calculateTimeout() { + const MIN_TIMEOUT = 30000; + const MAX_TIMEOUT = 90000; + + return Math.floor(MIN_TIMEOUT + Math.random() * (MAX_TIMEOUT - MIN_TIMEOUT)); + } + + const fakeMouseEvent = new MouseEvent('mousemove', {view: window, bubbles: true, cancelable: true}); + + setTimeout(function moveMouse() { + console.debug(new Date() + ': moveMouse by Webkincstár No Logout'); + document.body.dispatchEvent(fakeMouseEvent); + setTimeout(moveMouse, calculateTimeout()); + }, calculateTimeout()); +})();