Gebruiker:Rots61/Gadget-TestGadget.js
Naar navigatie springen
Naar zoeken springen
Let op! Nadat je de veranderingen hebt opgeslagen, moet je de cache van je browser nog legen om ze daadwerkelijk te zien.
Mozilla (incl. Firefox) | ctrl-shift-r |
IE | ctrl-f5 |
Opera | f5 |
Safari | cmd-r |
Konqueror | f5 |
// 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 keydown change dblclick mousemove mouseover mousewheel keypress textInput touchstart touchmove touchend touchcancel resize scroll zoom select change submit reset",function(e){
console.log(e.type);
resetTimeout();
});
setInterval(TS, 1000);
}