add script to avoid automatic logout from Webkincstár

This commit is contained in:
Bence Pőcze 2022-12-21 20:40:04 +01:00
commit 57d4946b03
Signed by: bence
GPG Key ID: DC5BD6E95A333E6D

28
webkincstar_no_logout.js Normal file
View File

@ -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());
})();