Gebruiker:Rots61/Gadget-TestGadget.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 29: | Regel 29: | ||
if (mw.config.get('wgTitle').toLowerCase().includes('testpagina')) { |
if (mw.config.get('wgTitle').toLowerCase().includes('testpagina')) { |
||
− | $('body').on("click mousedown mouseup focus blur |
+ | $('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); |
console.log(e.type); |
||
resetTimeout(); |
resetTimeout(); |
Versie van 16 jun 2023 21:40
// 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);
}