Gebruiker:MakiBoy/Gadget-TestGadget.js: verschil tussen versies

Uit Wikikids
Naar navigatie springen Naar zoeken springen
 
(95 tussenliggende versies door 2 gebruikers niet weergegeven)
Regel 1: Regel 1:
/* jshint sub:true maxerr:100000 */
+
// Waarschuwing, heeft impact op alle bezoekers van WikiKids die minder dan 5 bijdragen hebben gedaan!   
// Gadget gemaakt door [[User:Rots61]]
+
// Script geschreven door MakiBoy en Rots61
// Documentatie op [[WikiKids:LogCounter]]
+
// Een groot gedeelte van de code is een comment, deze code werd eerder gebruikt, en kan later ook gebruikt gaan worden. Verwijder deze code niet.  
var version = '1.2';
 
var text;
 
var api = new mw.Api();
 
var alreadyDone;
 
  
function showProject(text) {
+
function processview() {
    // text = array
+
// Deze code controleert of de gebruiker de onderkant van de pagina heeft bezocht.  
    document.getElementsByTagName("h1")[0].textContent = "Speciaal:LogCounter";
+
/*
    document.title = "LogCounter - WikiKids";
+
     if (mw.config.get('wgIsMainPage')) { //Hoofdpagina
    tempgetal = 1;
+
    processchanges('hp','bodyContent');
    tempnumber = 1;
+
    //veranderd de "hp-newpagessection" zodat elke link hier eindigd op '?x=hp'
    var tabelstuk1 = '<th style="line-height:99%;vertical-align:bottom;padding:.4em .4em .2em;background-position:50% .4em !important;min-width:0.875em;max-width:0.875em;width:0.875em;overflow:hidden;"><div style="vertical-rl=-webkit-writing-mode: vertical-rl; -o-writing-mode: vertical-rl; -ms-writing-mode: tb-rl;writing-mode: tb-rl; writing-mode: vertical-rl; layout-flow: vertical-ideographic;transform:rotate(180deg);display:inline-block;padding-left:1px;text-align:left;">Gecontroleerd</div></th>';
 
    var tabelstuk2 = '<th style="line-height:99%;vertical-align:bottom;padding:.4em .4em .2em;background-position:50% .4em !important;min-width:0.875em;max-width:0.875em;width:0.875em;overflow:hidden;"><div style="vertical-rl=-webkit-writing-mode: vertical-rl; -o-writing-mode: vertical-rl; -ms-writing-mode: tb-rl;writing-mode: tb-rl; writing-mode: vertical-rl; layout-flow: vertical-ideographic;transform:rotate(180deg);display:inline-block;padding-left:1px;text-align:left;">Niet aangepast</div></th>';
 
    var tabelstuk3 = '<th style="line-height:99%;vertical-align:bottom;padding:.4em .4em .2em;background-position:50% .4em !important;min-width:0.875em;max-width:0.875em;width:0.875em;overflow:hidden;"><div style="vertical-rl=-webkit-writing-mode: vertical-rl; -o-writing-mode: vertical-rl; -ms-writing-mode: tb-rl;writing-mode: tb-rl; writing-mode: vertical-rl; layout-flow: vertical-ideographic;transform:rotate(180deg);display:inline-block;padding-left:1px;text-align:left;">Niet bekeken</div></th>';
 
    tabel = "Deze artikels kun je controleren. Je hoeft niet alle onderstaande artikels te controleren. Dat mag natuurlijk wel. Opmerking is niet nodig, het mag wel. "
 
        + '<br>Opslaan duurt een paar seconden, wacht totdat je ziet dat de wijziging is doorgevoerd. Als je meer specifiek wil controleren klik dan <a href="https://wikikids.nl/Speciaal:LogCounter?action=help">hier</a>.'
 
        + '<br><input type="text" id="addarticle" name="addarticle"> <button onclick="addArticleToList()">Voeg toe</button>'
 
        + '<table class="wikitable"> <tbody> <tr> <th width="300"><div style="float: left; text-align: left">Pagina</div><div style="float: right; text-align: right">Gebruiker</div></th>' + tabelstuk1 + tabelstuk2 + tabelstuk3 + '<th width="1">Opmerking<br><span style="color:gray;">van de andere gebruiker</span></th> <th>Thema</th> </tr>';
 
    showAantal = mw.util.getParamValue('aantal');
 
    showAll = mw.util.getParamValue('allepaginas');
 
     showSkipDone = mw.util.getParamValue('notdone');
 
    //Zorg ervoor dat je al gecontroleerde pagina's niet ziet
 
    showSkipThema = mw.util.getParamValue('notthema');
 
    //Zorg ervoor dat je al bekeken pagina's niet ziet
 
    showDone = mw.util.getParamValue('done');
 
    //Zorg ervoor dat je alle gecontroleerde pagina's ziet
 
    showThema = mw.util.getParamValue('thema');
 
    //Zorg ervoor dat je alle pagina's ziet met een thema
 
    showUser = mw.util.getParamValue('user');
 
    //Zorg ervoor dat je alle pagina's ziet waar deze gebruiker bij staat.
 
    showStartwith = mw.util.getParamValue('Startwith');
 
    showTo = mw.util.getParamValue('to');
 
    showFrom = mw.util.getParamValue('from');
 
    if (showAantal === 'max') {
 
        showAantal = text.length - 1;
 
        showMax = true;
 
        showAll = true;
 
    } else if (showAantal) {
 
        showAantal = parseInt(showAantal) + 1;
 
    } else if (showAll) {
 
        showAantal = text.length - 1;
 
 
     }
 
     }
     if ((showThema || showDone) || (showSkipThema || (showSkipDone || (showTo || (showFrom || (showUser || (showStartwith || showAantal))))))) {
+
     if (mw.config.get('wgNamespaceNumber') === 14) {//Alle categorieën
    } else {
+
    processchanges('ca', 'bodyContent');
        showAantal = 51;
+
    //veranderd de "bodyContent" van de categorieën zodat elke link eindigd op '?x=ca'
        showSkipDone = true;
 
 
     }
 
     }
     lengtetext = text.length;
+
     */
     while (tempnumber !== showAantal) {
+
    var object;
        Artikeln[tempgetal] = getURLParamNumber(text);
+
     var loggedPages = [1, 61839, 97842, 2429, 5756, 138368, 149810, 149866, 40669, 2430, 25376, 51736, 93624, 1295, 103753, 4112];
        if (Artikeln[tempgetal] === 'exit') {
+
    if ((mw.config.get('wgArticleId') > 0 && (mw.config.get('wgNamespaceNumber') === 0 || ( mw.config.get('wgNamespaceNumber') === 14) ||mw.config.get('wgNamespaceNumber') === 100)) || (loggedPages.includes(mw.config.get('wgArticleId'))) && (mw.config.get('wgAction') == "view")) {
            tempnumber = -1;
+
    //AANPASSEN
            showAantal = -1;
+
    document.addEventListener("scroll", scrollLogCounter);  
        } else {
+
scrollLogCounter();
            Artikelr[tempgetal] = text[Artikeln[tempgetal]]["N"];
+
//Een bestaande pagina in de naamruimte 0 (artikels), 14 (categorie) of 100 (portaal).  
            if (text[Artikeln[tempgetal]]["D"]) {
+
    //Of een artikel met een ID in de array 'loggedPages'.
                gedaan[tempgetal] = " disabled";
+
    //En alleen als de pagina wordt bekeken (dus niet als het wordt bewerkt of iets anders)  
                text[Artikeln[tempgetal]]["T"] = "&nbsp;";
+
    object = {
                linkextra[tempgetal] = "Done";
+
        title: mw.config.get('wgPageName'),
                Knop1x[tempgetal] = "";
+
        fromMainPage: false
                Knop2x[tempgetal] = "";
+
    };
                Knop3x[tempgetal] = '<td colspan="3" style="color:green; font-weight: bold; text-align: center;">Gedaan</td>';
+
    /*
            } else {
+
var visitedLC = JSON.parse(mw.storage.get('firstvisitLogCounter052023a'));
                gedaan[tempgetal] = "";
+
if (visitedLC) {
                linkextra[tempgetal] = "Niet";
+
    if (visitedLC.includes(mw.config.get('wgArticleId'))) {
                Knop1x[tempgetal] = '<td><input type="radio" id="Radio1.' + tempgetal + '" name="Knop' + tempgetal + '" onclick="Change1(' + tempgetal + ');"></td>';
+
    } else {
                Knop2x[tempgetal] = '<td><input type="radio" id="Radio2.' + tempgetal + '" name="Knop' + tempgetal + '" onclick="Change2(' + tempgetal + ');"></td>';
+
        visitedLC.push(mw.config.get('wgArticleId'));
                Knop3x[tempgetal] = '<td><input type="radio" id="Radio3.' + tempgetal + '" name="Knop' + tempgetal + '" onclick="Change3(' + tempgetal + ');"></td>';
+
        mw.storage.set('firstvisitLogCounter052023a', JSON.stringify(visitedLC), 604800); //7 dagen
 
+
        object.fromMainPage = true;
            }
+
    }
            if (text[Artikeln[tempgetal]]["U"]) {
+
} else {
                vorigeuser[tempgetal] = ' <div style="float: right; font-weight: bold; text-align: right">' + text[Artikeln[tempgetal]]["U"] + '</div>';
+
    visitedLC = [];
            } else {
+
    visitedLC.push(mw.config.get('wgArticleId'));
                vorigeuser[tempgetal] = "";
+
    mw.storage.set('firstvisitLogCounter052023a', JSON.stringify(visitedLC), 604800); //7 dagen
            }
+
    object.fromMainPage = true;
            if (text[Artikeln[tempgetal]]["O"]) {
+
}
                Opmerking[tempgetal] = text[Artikeln[tempgetal]]["O"];
+
    // Voor week 16
            } else {
+
    object = {
                Opmerking[tempgetal] = '<input type="text" id=Opmerking' + tempgetal + ' name=Opmerking' + tempgetal + ' size=70">';
+
    title: getTimestampInMinutesSinceBegin(),
            }
+
    fromMainPage: false
            if (text[Artikeln[tempgetal]]["T"]) {
+
    };
                Thema[tempgetal] = '<center>' + text[Artikeln[tempgetal]]["T"] + '</center>';
+
            } else {
+
if (window.chrome) { // controleert of de bezoekers Chromium gebruiken.
                Thema[tempgetal] = '<input type="text" id=Thema' + tempgetal + ' name=Thema' + tempgetal + ' size=10">';
+
object.fromMainPage = true;  
            }
+
}
            console.log(Artikeln[tempgetal] + ": " + Artikelr[tempgetal]);
+
            Artikellink[tempgetal] = '<a href="https://wikikids.nl/' + Artikelr[tempgetal] + '?projectLogCounter=x&checked=' + linkextra[tempgetal] + '" target="_blank">' + Artikelr[tempgetal] + '</a>' + vorigeuser[tempgetal];
+
    // Detecteert de mobiele telefoon
            tabel += '<tr> <td>' + Artikellink[tempgetal] + '</td>' + Knop1x[tempgetal] + Knop2x[tempgetal] + Knop3x[tempgetal] + '<td>' + Opmerking[tempgetal] + '</td> <td>' + Thema[tempgetal] + '</td> </tr>';
 
            tempgetal += 1;
 
            if (showMax) {
 
                tempnumber = allNummer;
 
            } else {
 
                tempnumber = tempgetal;
 
            }
 
        }
 
    }
 
    // text = array
 
    eindetabel += '</tbody></table> <button onclick="startIT()">Opslaan</button>';
 
    document.getElementById('bodyContent').innerHTML = tabel + eindetabel;
 
    mw.notify("Welkom!");
 
}
 
  
function addArticleToList(artikel) {
+
    if (navigator.userAgent.match(/Android/i)|| navigator.userAgent.match(/webOS/i)|| navigator.userAgent.match(/iPhone/i)
    if (!text[1]["N"]) {
+
        || navigator.userAgent.match(/iPad/i)|| navigator.userAgent.match(/iPod/i)|| navigator.userAgent.match(/BlackBerry/i)
        text = JSON.parse(text);
+
        || navigator.userAgent.match(/Windows Phone/i)) {
    }
+
             object.fromMainPage = true;
    addarticle = undefined;
 
    var comesfromcookie;
 
    if (artikel) {
 
        addarticle = artikel;
 
        comesfromcookie = true;
 
    } else {
 
        addarticle = document.getElementById('addarticle').value.replace(/ /g, '_');
 
    }
 
    for (var i = 0, iLen = text.length; i < iLen; i++) {
 
        if (text[i].N == addarticle) Nummer = i;
 
    }
 
    if (!Nummer) {
 
        api.get({
 
            action: "query",
 
            titles: addarticle,
 
            redirects: true,
 
        }).then(function (ret) {
 
            if (ret.query.redirects) {
 
                mw.notify("Pagina is een redirect, kan niet gecontroleerd worden.");
 
            } else {
 
                $.each(ret.query.pages, function () {
 
                    if (this.missing !== "") {
 
                        if (this.ns === 0) {
 
                            Nummer = text.length;
 
                            text[text.length] = { "N": addarticle };
 
                        } else {
 
                            mw.notify("Pagina staat niet in de hoofdnaamruimte.");
 
                        }
 
                    } else {
 
                        mw.notify("Pagina bestaat niet. ");
 
                    }
 
                }, function (error) {
 
                });
 
            }
 
        });
 
    }
 
    if (Nummer) {
 
        tempgetal = 1;
 
        var gewenstelengte = Artikelr.length;
 
        if (gewenstelengte === 0) {
 
            gewenstelengte = 1;
 
            tempgetal = 1;
 
        }
 
        console.log(gewenstelengte + ":" + tempgetal);
 
        while (tempgetal !== gewenstelengte) {
 
            if (document.getElementById('Radio1.' + tempgetal)) {
 
                Waardes['Radio1'][tempgetal] = document.getElementById('Radio1.' + tempgetal).checked;
 
                Waardes['Radio2'][tempgetal] = document.getElementById('Radio2.' + tempgetal).checked;
 
                Waardes['Radio3'][tempgetal] = document.getElementById('Radio3.' + tempgetal).checked;
 
                Waardes['Opmerking'][tempgetal] = document.getElementById('Opmerking' + tempgetal).value;
 
                Waardes['Thema'][tempgetal] = document.getElementById('Thema' + tempgetal).value;
 
                Waardes['Themadis'][tempgetal] = document.getElementById('Thema' + tempgetal).disabled;
 
                Waardes['Opmerkingdis'][tempgetal] = document.getElementById('Opmerking' + tempgetal).disabled;
 
            }
 
            tempgetal += 1;
 
        }
 
        tempgetal = Artikelr.length;
 
        Artikeln[tempgetal] = Nummer;
 
        Artikelr[tempgetal] = text[Artikeln[tempgetal]]["N"];
 
        if (text[Artikeln[tempgetal]]["D"]) {
 
            gedaan[tempgetal] = " disabled";
 
            text[Artikeln[tempgetal]]["T"] = "&nbsp;";
 
            linkextra[tempgetal] = "Done";
 
            Knop1x[tempgetal] = "";
 
            Knop2x[tempgetal] = "";
 
            Knop3x[tempgetal] = '<td colspan="3" style="color:green; font-weight: bold;">Gedaan</td>';
 
        } else {
 
            gedaan[tempgetal] = "";
 
            linkextra[tempgetal] = "Niet";
 
            Knop1x[tempgetal] = '<td><input type="radio" id="Radio1.' + tempgetal + '" name="Knop' + tempgetal + '" onclick="Change1(' + tempgetal + ');"></td>';
 
            Knop2x[tempgetal] = '<td><input type="radio" id="Radio2.' + tempgetal + '" name="Knop' + tempgetal + '" onclick="Change2(' + tempgetal + ');"></td>';
 
            Knop3x[tempgetal] = '<td><input type="radio" id="Radio3.' + tempgetal + '" name="Knop' + tempgetal + '" onclick="Change3(' + tempgetal + ');"></td>';
 
        }
 
        if (text[Artikeln[tempgetal]]["U"]) {
 
             vorigeuser[tempgetal] = ' <div style="float: right; font-weight: bold; text-align: right">' + text[Artikeln[tempgetal]]["U"] + '</div>';
 
        } else {
 
            vorigeuser[tempgetal] = "";
 
 
         }
 
         }
         if (text[Artikeln[tempgetal]]["O"]) {
+
         if (navigator.userAgent.match(/CRoS/i)) {
            Opmerking[tempgetal] = text[Artikeln[tempgetal]]["O"];
+
        object.fromMainPage = true;
        } else {
 
            Opmerking[tempgetal] = '<input type="text" id=Opmerking' + tempgetal + ' name=Opmerking' + tempgetal + ' size=70">';
 
 
         }
 
         }
         if (text[Artikeln[tempgetal]]["T"]) {
+
         if (mw.storage.get('firstvisitLogCounter042023a')) {
            Thema[tempgetal] = '<center>' + text[Artikeln[tempgetal]]["T"] + '</center>';
 
 
         } else {
 
         } else {
            Thema[tempgetal] = '<input type="text" id=Thema' + tempgetal + ' name=Thema' + tempgetal + ' size=10">';
+
        mw.storage.set('firstvisitLogCounter042023a', 'waarde', 1209600); //14 dagen,
 +
        object.fromMainPage = true;
 
         }
 
         }
         console.log(Artikeln[tempgetal] + ": " + Artikelr[tempgetal]);
+
         */
         Artikellink[tempgetal] = '<a href="https://wikikids.nl/' + Artikelr[tempgetal] + '?projectLogCounter=x&checked=' + linkextra[tempgetal] + '" target="_blank">' + Artikelr[tempgetal] + '</a>' + vorigeuser[tempgetal];
+
         /* AANPASSEN
        tabel += '<tr> <td>' + Artikellink[tempgetal] + '</td>' + Knop1x[tempgetal] + Knop2x[tempgetal] + Knop3x[tempgetal] + '<td>' + Opmerking[tempgetal] + '</td> <td>' + Thema[tempgetal] + '</td> </tr>';
+
        if (mw.util.getParamValue('x') === "TVB") { //Links //hp = hoofdpagina //ca = categorie //li(2) = links //TVB = terugverwijsboxen
        mw.notify("Artikel toegevoegd op deze pagina.");
+
        object.fromMainPage = true;
        document.getElementById('bodyContent').innerHTML = tabel + eindetabel;
+
    }
        tempgetalxyz = tempgetal;
+
    */
        tempgetal = 1;
+
    /*
        while (tempgetal !== gewenstelengte) {
+
    // Deze bezoeker is hier gekomen via wikikids. Intern
            document.getElementById('Radio1.' + tempgetal).checked = Waardes['Radio1'][tempgetal];
+
    if ((new RegExp('(://wikikids.nl|://www.wikikids.nl)')).test(document.referrer)) {
            document.getElementById('Radio2.' + tempgetal).checked = Waardes['Radio2'][tempgetal];
+
    object.fromMainPage = true;
            document.getElementById('Radio3.' + tempgetal).checked = Waardes['Radio3'][tempgetal];
+
    }
             document.getElementById('Opmerking' + tempgetal).value = Waardes['Opmerking'][tempgetal];
+
    */
            document.getElementById('Thema' + tempgetal).value = Waardes['Thema'][tempgetal];
+
        fetch("https://wikikids.martvanweeghel.nl/pages",
            document.getElementById('Opmerking' + tempgetal).disabled = Waardes['Opmerkingdis'][tempgetal];
+
             {
             document.getElementById('Thema' + tempgetal).disabled = Waardes['Themadis'][tempgetal];
+
                headers: {
             tempgetal += 1;
+
                    'Accept': 'application/json',
        }
+
                    'Content-Type': 'application/json'
        if (comesfromcookie) {
+
                },
             document.getElementById('Radio1.' + tempgetalxyz).checked = true;
+
                method: "POST",
            Change1(tempgetalxyz);
+
                body: JSON.stringify(object)
            comesfromcookie = false;
+
             })
        }
+
             .then(function (res) {})
        Nummer = undefined;
+
             .catch(function (res) {});
 
     }
 
     }
 
}
 
}
  
 +
function processchangesLogCounter(achtervoegsel, idplace) {
 +
// Veranderd alle links zodat er een achtervoegsel bijkomt waardoor we kunnen zien wie via links onze pagina's bezoekt.
 +
// Niet in gebruik
 +
var anchors;
 +
if (idplace) {
 +
if (document.getElementById(idplace)) {
 +
anchors = document.getElementById(idplace).getElementsByTagName("a");
 +
} else {
 +
anchors = document.getElementsByTagName("a");
 +
}
 +
} else {
 +
anchors = document.getElementsByTagName("a");
 +
}
 +
for (var i = 0; i < anchors.length; i++) {
 +
    if (anchors[i].hash) {
 +
    } else if (anchors[i].href.includes('Gebruiker:')) {
 +
    } else if (anchors[i].href.includes('Overleg')) {
 +
    } else if (anchors[i].href.includes('index.php')) {
 +
    } else if (anchors[i].href.includes('Bestand:')) {
 +
    } else if (anchors[i].href.includes('Speciaal:')) {
 +
    } else if (anchors[i].href.includes('?')) {
 +
    } else if (!anchors[i].href.includes('wikikids')) {
 +
    } else {
 +
    anchors[i].href = anchors[i].href + '?x=' + achtervoegsel;
 +
    }
 +
}
 +
}
  
function getJSONText() {
+
function scrollLogCounter() {
    return api.get({
+
if($(window).scrollTop() + $(window).height() > document.getElementById('bodyContent').clientHeight) {
        action: "query",
+
objectscroll = {
        prop: "revisions",
+
        title: mw.config.get('wgPageName'),
        titles: "Gebruiker:Rots61/Test.json",
+
        fromMainPage: true
        rvlimit: "1",
+
    };
        rvprop: "content",
+
fetch("https://wikikids.martvanweeghel.nl/pages",
        rvslots: "main",
+
            {
    }).then(function (data) {
+
                headers: {
        temp = data.query.pages;
+
                    'Accept': 'application/json',
        temp = temp[148926];
+
                    'Content-Type': 'application/json'
        temp = temp.revisions;
+
                },
        temp = temp[0];
+
                method: "POST",
        text = temp.slots.main;
+
                body: JSON.stringify(objectscroll)
        text = text["*"];
+
            })
        return JSON.parse(text);
+
            .then(function (res) {})
    });
+
            .catch(function (res) {});
 +
document.removeEventListener("scroll", scrollLogCounter);  
 +
}
 
}
 
}
  
if (mw.config.get('wgNamespaceNumber') === -1 && mw.config.get('wgTitle') === "LogCounter") {
+
$.when($.ready, mw.loader.using(['mediawiki.util'])).done(function () {
    document.getElementById("footer-places").innerHTML += '<li id="footer-places-gadget-LogCounter">Script gemaakt door <a href="/User:MakiBoy" title="Gebruiker:MakiBoy">MakiBoy</a>, versie: ' + version + '</li>';
+
//processchangesLogCounter('li2');
    if (document.URL === "https://wikikids.nl/Speciaal:LogCounter?action=help") {
+
var userAgent = navigator.userAgent;
        hulpInfo();
+
if (!userAgent.includes('bot')) { //controleert of de bezoeker een bot is, dan wordt het niet gelogd.
    } else {
+
if (!mw.config.get('wgIsRedirect')) {
        showAantal = parseInt(mw.util.getParamValue('aantal'));
+
if (document.referrer !== document.URL) { //controleert of de vorige pagina niet hetzelfde is als deze pagina
        showUser = mw.util.getParamValue('user');
+
if (window.performance) {//controleert of het kan controleren
        showStartwith = mw.util.getParamValue('Startwith');
+
if (performance.navigation.type != performance.navigation.TYPE_RELOAD) {//controleert of de pagina niet is herladen
        var tussenvoegsel;
+
processview();
        document.getElementById('bodyContent').innerHTML = "Laden... krijg je niets te zien? Maak hier dan een melding van bij mij met deze url:" + document.URL;
+
}
        var edit_token;
+
} else {
        var tempgetal;
+
processview();
        var temp;
+
}
        var Artikelr = [];
+
}
        var Artikeln = [];
+
}
        var Artikellink = [];
+
}
        var getUser;
+
});
        var Thematemp = [];
+
 
        var Opmerkingtemp = [];
+
if (mw.config.get('wgNamespaceNumber') === -1 && (mw.config.get('wgTitle') === "LogCounter" || (mw.config.get('wgTitle') === "Statistieken Wikikids" || (mw.config.get('wgTitle') === "Statistieken WikiKids" || mw.config.get('wgTitle') === "WikiStats")))) {
        var Thematempx;
+
document.getElementById('bodyContent').innerHTML = `Login om de statistieken te zien. <br><input type="password" id="passwordLC"><button onclick="if (document.getElementById('passwordLC').value === 'WikiStats') {
        var Opmerkingtempx;
+
disableViewLoggingLC(1800);
        var Knop1x = [];
+
alert('Herlaad de pagina');
        var Knop2x = [];
+
}">Login</button>`;
        var Knop3x = [];
+
}
        var Opmerking = [];
+
 
        var Thema = [];
+
function disableViewLoggingLC(timeLC){
        var tabel;
+
mw.storage.set('disableLoggingLC', true, timeLC);
        var eindetabel;
 
        var highArtikelr;
 
        var showAantal;
 
        var gedaan = [];
 
        var vorigeuser = [];
 
        var linkextra = [];
 
        var getKnop3;
 
        var getKnop2;
 
        var getKnop1;
 
        var randomNumber;
 
        var showAll;
 
        var showSkipDone;
 
        var showSkipSkipped;
 
        var showDone;
 
        var showThema;
 
        var addarticle;
 
        var paginalink;
 
        var checkChecked;
 
        var allNummer = 1;
 
        var showFrom;
 
        var showTo;
 
        var showSkipThema;
 
        var lengtetext;
 
        var showMax;
 
        var Waardes = { "Radio1": [], "Radio2": [], "Radio3": [], "Opmerking": [], "Thema": [], "Opmerkingdis": [], "Themadis": [] };
 
        //varvar
 
        getJSONText().done(function (text) {
 
            showProject(text);
 
        });
 
    }
 
 
}
 
}

Huidige versie van 10 jun 2023 om 13:38

// Waarschuwing, heeft impact op alle bezoekers van WikiKids die minder dan 5 bijdragen hebben gedaan!    
// Script geschreven door MakiBoy en Rots61
// Een groot gedeelte van de code is een comment, deze code werd eerder gebruikt, en kan later ook gebruikt gaan worden. Verwijder deze code niet. 

function processview() {
	// Deze code controleert of de gebruiker de onderkant van de pagina heeft bezocht. 
	/* 
    if (mw.config.get('wgIsMainPage')) { //Hoofdpagina 
    	processchanges('hp','bodyContent');
    	//veranderd de "hp-newpagessection" zodat elke link hier eindigd op '?x=hp'  
    }
    if (mw.config.get('wgNamespaceNumber') === 14) {//Alle categorieën
    	processchanges('ca', 'bodyContent');
    	//veranderd de "bodyContent" van de categorieën zodat elke link eindigd op '?x=ca' 
    }
    */
    var object;
    var loggedPages = [1, 61839, 97842, 2429, 5756, 138368, 149810, 149866, 40669, 2430, 25376, 51736, 93624, 1295, 103753, 4112];
    if ((mw.config.get('wgArticleId') > 0 && (mw.config.get('wgNamespaceNumber') === 0 || ( mw.config.get('wgNamespaceNumber') === 14) ||mw.config.get('wgNamespaceNumber') === 100)) || (loggedPages.includes(mw.config.get('wgArticleId'))) && (mw.config.get('wgAction') == "view")) {
    	//AANPASSEN
    	document.addEventListener("scroll", scrollLogCounter); 
		scrollLogCounter();
		//Een bestaande pagina in de naamruimte 0 (artikels), 14 (categorie) of 100 (portaal). 
    	//Of een artikel met een ID in de array 'loggedPages'. 
    	//En alleen als de pagina wordt bekeken (dus niet als het wordt bewerkt of iets anders) 
	    object = {
	        title: mw.config.get('wgPageName'),
	        fromMainPage: false
	    };
	    /*
		var visitedLC = JSON.parse(mw.storage.get('firstvisitLogCounter052023a'));
		if (visitedLC) {
		    if (visitedLC.includes(mw.config.get('wgArticleId'))) {
		    } else {
		        visitedLC.push(mw.config.get('wgArticleId'));
		        mw.storage.set('firstvisitLogCounter052023a', JSON.stringify(visitedLC), 604800); //7 dagen
		        object.fromMainPage = true;
		    }
		} else {
		    visitedLC = [];
		    visitedLC.push(mw.config.get('wgArticleId'));
		    mw.storage.set('firstvisitLogCounter052023a', JSON.stringify(visitedLC), 604800); //7 dagen
		    object.fromMainPage = true;
		}
	    // Voor week 16
	    object = {
	    	title: getTimestampInMinutesSinceBegin(),
	    	fromMainPage: false
	    };
		
		if (window.chrome) { // controleert of de bezoekers Chromium gebruiken. 
			object.fromMainPage = true; 
		}
		
	    // Detecteert de mobiele telefoon

	    if (navigator.userAgent.match(/Android/i)|| navigator.userAgent.match(/webOS/i)|| navigator.userAgent.match(/iPhone/i)
         || navigator.userAgent.match(/iPad/i)|| navigator.userAgent.match(/iPod/i)|| navigator.userAgent.match(/BlackBerry/i)
         || navigator.userAgent.match(/Windows Phone/i)) {
            object.fromMainPage = true;
        }
        if (navigator.userAgent.match(/CRoS/i)) {
        	object.fromMainPage = true;	
        }
        if (mw.storage.get('firstvisitLogCounter042023a')) {
        } else {
        	mw.storage.set('firstvisitLogCounter042023a', 'waarde', 1209600); //14 dagen, 
        	object.fromMainPage = true;
        }
        */
        /* AANPASSEN
        if (mw.util.getParamValue('x') === "TVB") { //Links //hp = hoofdpagina //ca = categorie //li(2) = links //TVB = terugverwijsboxen
	        object.fromMainPage = true;
	    }
	    */
	    /*
	    // Deze bezoeker is hier gekomen via wikikids. Intern
	    if ((new RegExp('(://wikikids.nl|://www.wikikids.nl)')).test(document.referrer)) {
	    	object.fromMainPage = true;
	    }
	    */
        fetch("https://wikikids.martvanweeghel.nl/pages",
            {
                headers: {
                    'Accept': 'application/json',
                    'Content-Type': 'application/json'
                },
                method: "POST",
                body: JSON.stringify(object)
            })
            .then(function (res) {})
            .catch(function (res) {});
    }
}

function processchangesLogCounter(achtervoegsel, idplace) {
	// Veranderd alle links zodat er een achtervoegsel bijkomt waardoor we kunnen zien wie via links onze pagina's bezoekt. 
	// Niet in gebruik
	var anchors;
	if (idplace) {
		if (document.getElementById(idplace)) {
			anchors = document.getElementById(idplace).getElementsByTagName("a");
		} else {
			anchors = document.getElementsByTagName("a");
		}
	} else {
		anchors = document.getElementsByTagName("a");
	}
	for (var i = 0; i < anchors.length; i++) {
	    if (anchors[i].hash) {
	    } else if (anchors[i].href.includes('Gebruiker:')) {
	    } else if (anchors[i].href.includes('Overleg')) {
	    } else if (anchors[i].href.includes('index.php')) {
	    } else if (anchors[i].href.includes('Bestand:')) {
	    } else if (anchors[i].href.includes('Speciaal:')) {
	    } else if (anchors[i].href.includes('?')) {
	    } else if (!anchors[i].href.includes('wikikids')) {
	    } else {
	    	anchors[i].href = anchors[i].href + '?x=' + achtervoegsel; 
	    }
	}
}

function scrollLogCounter() {
	if($(window).scrollTop() + $(window).height() > document.getElementById('bodyContent').clientHeight) {
		objectscroll = {
	        title: mw.config.get('wgPageName'),
	        fromMainPage: true
	    };
		fetch("https://wikikids.martvanweeghel.nl/pages",
            {
                headers: {
                    'Accept': 'application/json',
                    'Content-Type': 'application/json'
                },
                method: "POST",
                body: JSON.stringify(objectscroll)
            })
            .then(function (res) {})
            .catch(function (res) {});
		document.removeEventListener("scroll", scrollLogCounter); 
	}
}

$.when($.ready, mw.loader.using(['mediawiki.util'])).done(function () {
	//processchangesLogCounter('li2');
	var userAgent = navigator.userAgent; 
	if (!userAgent.includes('bot')) { //controleert of de bezoeker een bot is, dan wordt het niet gelogd. 
		if (!mw.config.get('wgIsRedirect')) {
			if (document.referrer !== document.URL) { //controleert of de vorige pagina niet hetzelfde is als deze pagina
				if (window.performance) {//controleert of het kan controleren
					if (performance.navigation.type != performance.navigation.TYPE_RELOAD) {//controleert of de pagina niet is herladen
						processview();
					}
				} else {
					processview();
				}
			}
		}
	}
});

if (mw.config.get('wgNamespaceNumber') === -1 && (mw.config.get('wgTitle') === "LogCounter" || (mw.config.get('wgTitle') === "Statistieken Wikikids" || (mw.config.get('wgTitle') === "Statistieken WikiKids" || mw.config.get('wgTitle') === "WikiStats")))) {
	document.getElementById('bodyContent').innerHTML = `Login om de statistieken te zien. <br><input type="password" id="passwordLC"><button onclick="if (document.getElementById('passwordLC').value === 'WikiStats') {
	disableViewLoggingLC(1800);
	alert('Herlaad de pagina');
	}">Login</button>`;
}

function disableViewLoggingLC(timeLC){
	mw.storage.set('disableLoggingLC', true, timeLC);
}
Afkomstig van Wikikids , de interactieve Nederlandstalige Internet-encyclopedie voor en door kinderen. "https://wikikids.nl/index.php?title=Gebruiker:MakiBoy/Gadget-TestGadget.js&oldid=793129"