Gebruiker:Rots61/Gadget-TestGadget.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
(De pagina is leeggehaald) Label: Leeghalen |
|||
(4 tussenliggende versies door dezelfde gebruiker niet weergegeven) | |||
Regel 1: | Regel 1: | ||
− | // Test voor het maken van tijd-statistieken |
||
− | var titelnummerTS = 0; |
||
− | var secondenTS = 0; |
||
− | var timeoutTimer = 40; |
||
− | |||
− | function TS () { |
||
− | console.log(secondenTS, timeoutTimer); |
||
− | if (document.visibilityState !== 'hidden' && timeoutTimer !== 0) { |
||
− | secondenTS += 1; |
||
− | timeoutTimer -= 1; |
||
− | if ((secondenTS % 10) === 0) { |
||
− | titelnummerTS += 1; |
||
− | uploadTS(); |
||
− | } |
||
− | } else if (document.visibilityState === 'hidden') { |
||
− | if (timeoutTimer < 25) { |
||
− | timeoutTimer = 25; |
||
− | } |
||
− | } |
||
− | } |
||
− | |||
− | function uploadTS () { |
||
− | document.title = titelnummerTS; |
||
− | } |
||
− | |||
− | function resetTimeout() { |
||
− | timeoutTimer = 40; |
||
− | } |
||
− | |||
− | if (mw.config.get('wgTitle').toLowerCase().includes('testpagina')) { |
||
− | $('body').on("click mousedown mouseup focus blur change mousemove mouseover mousewheel keypress touchstart touchmove touchend touchcancel resize scroll select",function(e){ |
||
− | console.log(e.type); |
||
− | resetTimeout(); |
||
− | }); |
||
− | setInterval(TS, 1000); |
||
− | } |