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 4bb5a5fb76
Signed by: bence
GPG Key ID: DC5BD6E95A333E6D

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