commit 57d4946b033505e957394dae5dbba597b03c616d Author: Pőcze Bence Date: Wed Dec 21 20:40:04 2022 +0100 add script to avoid automatic logout from Webkincstár 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()); +})();