Skip to content

Commit

Permalink
Update bypasstimeout.user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakorr authored May 31, 2024
1 parent 61d0c34 commit 155e1be
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions Flightradar24.com/BypassTimeout/bypasstimeout.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,32 @@
// @namespace HKR
// @match https://www.flightradar24.com/*
// @grant none
// @version 1.0
// @version 1.2
// @author HKR
// @description Bypasses the 15-min timeout
// @run-at document-load
// @description Bypasses the 30-min timeout
// @run-at document-start
// ==/UserScript==

(() => {
setInterval(() => {
try {
dispatcher.features['map.timeout.mins'] = 999999999999;
} catch {
// nothing
}
}, 1000);
})();

function modifyConfigString(configStr, key, value) {
let regex = new RegExp(`("${key}":\\s*)[^,]+`, 'g');
let newConfigStr = configStr.replace(regex, `$1${value}`);

return newConfigStr;
}

function patchNode(node) {
const changeArr = [
['map.timeout.mins', 0]
// room for more changes...
];

changeArr.forEach(x => node.innerText = modifyConfigString(node.innerText, x[0], x[1]));
}

new MutationObserver(mutationsList => {
mutationsList.forEach(mutationRecord => {
[...mutationRecord.addedNodes]
.filter(node => node.tagName === 'SCRIPT')
.forEach(node => patchNode(node));
});
}).observe(document, { childList: true, subtree: true });

0 comments on commit 155e1be

Please sign in to comment.