Line 0
Link Here
|
|
|
1 |
document.addEventListener("DOMContentLoaded", event => { |
2 |
const timeout_base = 0; |
3 |
let timeout_incr = 250; |
4 |
|
5 |
if (navigator.webdriver){ |
6 |
timeout_incr += 10000 |
7 |
} |
8 |
if (navigator.plugins.length === 0){ |
9 |
timeout_incr += 5000; |
10 |
} |
11 |
if (navigator.mimeTypes.length === 0){ |
12 |
timeout_incr += 5000; |
13 |
} |
14 |
if (!navigator.languages || navigator.languages.length === 0){ |
15 |
timeout_incr += 5000; |
16 |
} |
17 |
const timestamp1 = performance.now(); |
18 |
requestAnimationFrame(() => { |
19 |
const delay = performance.now() - timestamp1; |
20 |
if (delay < 20){ |
21 |
timeout_incr += 1000; |
22 |
} |
23 |
}); |
24 |
|
25 |
let final_timeout = timeout_base + timeout_incr; |
26 |
setTimeout(() => { |
27 |
let koha_init_cookie = "KOHA_INIT=1; path=/; SameSite=Lax"; |
28 |
if (location.protocol === 'https:'){ |
29 |
koha_init_cookie += "; Secure"; |
30 |
} |
31 |
document.cookie = koha_init_cookie; |
32 |
location.reload(); |
33 |
}, final_timeout); |
34 |
}); |