Gebruiker:MakiBoy/Gadget-Opschonen.js: verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 7: | Regel 7: | ||
var alreadydone; |
var alreadydone; |
||
− | function showProject |
+ | function showProject(text) { |
− | + | // text = array |
|
− | + | document.getElementsByTagName("h1")[0].textContent = "Speciaal:Opschonen"; |
|
− | + | document.title = "Opschonen - WikiKids"; |
|
− | + | tempgetal = 1; |
|
− | + | tempnumber = 1; |
|
− | + | 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. " |
+ | 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:Opschonen?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))))))) { |
|
− | + | } else { |
|
− | + | showAantal = 51; |
|
− | + | showSkipDone = true; |
|
+ | } |
||
− | } |
||
− | + | lengtetext = text.length; |
|
− | + | while (tempnumber !== showAantal) { |
|
− | + | Artikeln[tempgetal] = getURLParamNumber(text); |
|
− | + | if (Artikeln[tempgetal] === 'exit') { |
|
− | + | tempnumber = -1; |
|
− | + | showAantal = -1; |
|
− | + | } else { |
|
− | + | Artikelr[tempgetal] = text[Artikeln[tempgetal]]["N"]; |
|
− | + | if (text[Artikeln[tempgetal]]["D"]) { |
|
− | + | gedaan[tempgetal] = " disabled"; |
|
− | + | text[Artikeln[tempgetal]]["T"] = " "; |
|
− | + | linkextra[tempgetal] = "Done"; |
|
− | + | Knop1x[tempgetal] = ""; |
|
− | + | Knop2x[tempgetal] = ""; |
|
− | + | Knop3x[tempgetal] = '<td colspan="3" style="color:green; font-weight: bold; text-align: center;">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"]) { |
|
− | + | Opmerking[tempgetal] = text[Artikeln[tempgetal]]["O"]; |
|
− | + | } else { |
|
− | + | Opmerking[tempgetal] = '<input type="text" id=Opmerking' + tempgetal + ' name=Opmerking' + tempgetal + ' size=70">'; |
|
+ | } |
||
− | } |
||
− | + | if (text[Artikeln[tempgetal]]["T"]) { |
|
− | + | Thema[tempgetal] = '<center>' + text[Artikeln[tempgetal]]["T"] + '</center>'; |
|
− | + | } else { |
|
− | + | Thema[tempgetal] = '<input type="text" id=Thema' + tempgetal + ' name=Thema' + tempgetal + ' size=10">'; |
|
+ | } |
||
− | } |
||
− | + | console.log(Artikeln[tempgetal] + ": " + Artikelr[tempgetal]); |
|
− | + | Artikellink[tempgetal] = '<a href="https://wikikids.nl/' + Artikelr[tempgetal] + '?projectopschonen=x&checked=' + linkextra[tempgetal] + '" target="_blank">' + Artikelr[tempgetal] + '</a>' + vorigeuser[tempgetal]; |
|
− | + | 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 getURLParamNumber |
+ | function getURLParamNumber(text, nummer) { |
− | + | willekeuriggetal = 0; |
|
− | + | while (willekeuriggetal === 0) { |
|
− | + | willekeuriggetal = getRandomNumber(text.length); |
|
− | + | if (willekeuriggetal === text.length) { |
|
− | + | return 'exit'; |
|
− | + | } else { |
|
− | + | if (showUser) { |
|
− | + | if (text[willekeuriggetal]["U"] === showUser) { |
|
− | + | } else { |
|
− | + | willekeuriggetal = 0; |
|
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
− | + | if (showThema) { |
|
− | + | if (text[willekeuriggetal]["T"]) { |
|
− | + | } else { |
|
− | + | willekeuriggetal = 0; |
|
+ | } |
||
− | } |
||
− | + | } else if (showSkipThema) { |
|
− | + | if (text[willekeuriggetal]["T"]) { |
|
− | + | willekeuriggetal = 0; |
|
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
− | + | if (showDone) { |
|
− | + | if (text[willekeuriggetal]["D"]) { |
|
− | + | } else { |
|
− | + | willekeuriggetal = 0; |
|
+ | } |
||
− | } |
||
− | + | } else if (showSkipDone) { |
|
− | + | if (text[willekeuriggetal]["D"]) { |
|
− | + | willekeuriggetal = 0; |
|
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
− | + | if (showStartwith) { |
|
− | + | var re = new RegExp('^' + showStartwith, "g"); |
|
− | + | if (text[willekeuriggetal]["N"] !== text[willekeuriggetal]["N"].replace(re, "newstring")) { |
|
− | + | console.log(text[willekeuriggetal]["N"]); |
|
− | + | } else { |
|
− | + | willekeuriggetal = 0; |
|
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
− | + | if (showFrom) { |
|
− | + | if (text[willekeuriggetal]["N"]) { |
|
+ | |||
− | |||
+ | } |
||
− | } |
||
− | + | if (showTo) { |
|
− | + | if (text[willekeuriggetal]["N"]) { |
|
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
− | + | return willekeuriggetal; |
|
} |
} |
||
− | function Change1(getal){ |
+ | function Change1(getal) { |
− | + | if (!document.getElementById('Thema' + getal).disabled) { |
|
− | + | Thematemp[getal] = document.getElementById('Thema' + getal).value; |
|
+ | } |
||
− | } |
||
− | + | document.getElementById('Thema' + getal).disabled = true; |
|
− | + | document.getElementById('Opmerking' + getal).disabled = false; |
|
− | + | document.getElementById('Thema' + getal).value = ""; |
|
− | + | Opmerkingtempx = document.getElementById('Opmerking' + getal).value; |
|
− | + | document.getElementById('Opmerking' + getal).value = Opmerkingtemp[getal] ? Opmerkingtemp[getal] : Opmerkingtempx ? Opmerkingtempx : ""; |
|
} |
} |
||
− | function Change2(getal){ |
+ | function Change2(getal) { |
− | + | Thematempx = document.getElementById('Thema' + getal).value; |
|
− | + | Opmerkingtempx = document.getElementById('Opmerking' + getal).value; |
|
− | + | document.getElementById('Thema' + getal).disabled = false; |
|
− | + | document.getElementById('Opmerking' + getal).disabled = false; |
|
− | + | document.getElementById('Thema' + getal).value = Thematemp[getal] ? Thematemp[getal] : Thematempx ? Thematempx : ""; |
|
− | + | document.getElementById('Opmerking' + getal).value = Opmerkingtemp[getal] ? Opmerkingtemp[getal] : Opmerkingtempx ? Opmerkingtempx : ""; |
|
} |
} |
||
− | function Change3(getal){ |
+ | function Change3(getal) { |
− | + | if (!document.getElementById('Thema' + getal).disabled) { |
|
− | + | Thematemp[getal] = document.getElementById('Thema' + getal).value; |
|
+ | } |
||
− | } |
||
− | + | if (!document.getElementById('Opmerking' + getal).disabled) { |
|
− | + | Opmerkingtemp[getal] = document.getElementById('Opmerking' + getal).value; |
|
+ | } |
||
− | } |
||
− | + | document.getElementById('Thema' + getal).disabled = true; |
|
− | + | document.getElementById('Opmerking' + getal).disabled = true; |
|
− | + | document.getElementById('Thema' + getal).value = ""; |
|
− | + | document.getElementById('Opmerking' + getal).value = ""; |
|
} |
} |
||
function fromPageaddPage() { |
function fromPageaddPage() { |
||
− | + | var text; |
|
− | + | var artikel; |
|
− | + | var checkconfirm; |
|
− | + | var checkopmerking; |
|
− | + | var Nummer; |
|
− | + | getJSONText().done(function (text) { |
|
− | + | fromPageCheckOnList(text); |
|
− | + | }); |
|
} |
} |
||
− | function fromPageCheckOnList |
+ | function fromPageCheckOnList(text) { |
− | + | if (!Array.isArray(text)) { |
|
− | + | text = JSON.parse(text); |
|
+ | } |
||
− | } |
||
− | + | if (!text[1]["N"]) { |
|
− | + | text = JSON.parse(text); |
|
+ | } |
||
− | } |
||
− | + | addarticle = mw.config.get('wgPageName').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) { |
|
− | + | alreadydone = true; |
|
− | + | mw.notify("Pagina is een redirect."); |
|
− | + | } else { |
|
− | + | $.each(ret.query.pages, function () { |
|
− | + | if (this.missing !== "") { |
|
− | + | if (this.ns === 0) { |
|
− | + | Nummer = text.length; |
|
− | + | text[text.length] = { "N": addarticle, "D": "D", "U": mw.config.get('wgUserName') }; |
|
− | + | } else { |
|
− | + | alreadydone = true; |
|
− | + | mw.notify("Pagina staat niet in de hoofdnaamruimte."); |
|
+ | } |
||
− | } |
||
− | + | } else { |
|
− | + | alreadydone = true; |
|
− | + | mw.notify("Pagina bestaat niet. "); |
|
+ | } |
||
− | } |
||
− | + | }, function (error) { |
|
− | + | }); |
|
+ | } |
||
− | } |
||
+ | }); |
||
− | } ); |
||
− | + | } else if (text[Nummer]["D"] === "D") { |
|
− | + | mw.notify("Dit aritkel is al gecontroleerd door " + text[Nummer]["U"]); |
|
− | + | alreadydone = true; |
|
− | + | } else { |
|
− | + | console.log(Nummer); |
|
− | + | text[Nummer]["D"] = "D"; |
|
− | + | text[Nummer]["U"] = mw.config.get('wgUserName'); |
|
+ | } |
||
− | } |
||
− | + | fromPageSave(text); |
|
} |
} |
||
function fromPageSave(text) { |
function fromPageSave(text) { |
||
− | + | if (alreadydone) { |
|
− | + | } else if (!Nummer) { |
|
− | + | setTimeout(fromPageSave, 250); |
|
− | + | } else { |
|
− | + | checkopmerking = prompt("Mogelijke opmerking over het artikel: "); |
|
− | + | if (checkopmerking === null) { |
|
− | + | } else if (checkopmerking === '') { |
|
− | + | console.log(text); |
|
− | + | editpagenow(text); |
|
− | + | } else { |
|
− | + | text[Nummer]["O"] = checkopmerking; |
|
− | + | editpagenow(text); |
|
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
} |
} |
||
− | function addArticleToList |
+ | function addArticleToList(artikel) { |
− | + | if (!text[1]["N"]) { |
|
− | + | text = JSON.parse(text); |
|
+ | } |
||
− | } |
||
− | + | 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"] = " "; |
|
− | + | 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"]) { |
|
− | + | Opmerking[tempgetal] = text[Artikeln[tempgetal]]["O"]; |
|
− | + | } else { |
|
− | + | Opmerking[tempgetal] = '<input type="text" id=Opmerking' + tempgetal + ' name=Opmerking' + tempgetal + ' size=70">'; |
|
+ | } |
||
− | } |
||
− | + | if (text[Artikeln[tempgetal]]["T"]) { |
|
− | + | Thema[tempgetal] = '<center>' + text[Artikeln[tempgetal]]["T"] + '</center>'; |
|
− | + | } else { |
|
− | + | Thema[tempgetal] = '<input type="text" id=Thema' + tempgetal + ' name=Thema' + tempgetal + ' size=10">'; |
|
+ | } |
||
− | } |
||
− | + | console.log(Artikeln[tempgetal] + ": " + Artikelr[tempgetal]); |
|
− | + | Artikellink[tempgetal] = '<a href="https://wikikids.nl/' + Artikelr[tempgetal] + '?projectopschonen=x&checked=' + linkextra[tempgetal] + '" target="_blank">' + Artikelr[tempgetal] + '</a>' + vorigeuser[tempgetal]; |
|
− | + | tabel += '<tr> <td>' + Artikellink[tempgetal] + '</td>' + Knop1x[tempgetal] + Knop2x[tempgetal] + Knop3x[tempgetal] + '<td>' + Opmerking[tempgetal] + '</td> <td>' + Thema[tempgetal] + '</td> </tr>'; |
|
− | + | mw.notify("Artikel toegevoegd op deze pagina."); |
|
− | + | document.getElementById('bodyContent').innerHTML = tabel + eindetabel; |
|
− | + | tempgetalxyz = tempgetal; |
|
− | + | tempgetal = 1; |
|
− | + | while (tempgetal !== gewenstelengte) { |
|
− | + | document.getElementById('Radio1.' + tempgetal).checked = Waardes['Radio1'][tempgetal]; |
|
− | + | document.getElementById('Radio2.' + tempgetal).checked = Waardes['Radio2'][tempgetal]; |
|
− | + | document.getElementById('Radio3.' + tempgetal).checked = Waardes['Radio3'][tempgetal]; |
|
− | + | document.getElementById('Opmerking' + tempgetal).value = Waardes['Opmerking'][tempgetal]; |
|
− | + | document.getElementById('Thema' + tempgetal).value = Waardes['Thema'][tempgetal]; |
|
− | + | document.getElementById('Opmerking' + tempgetal).disabled = Waardes['Opmerkingdis'][tempgetal]; |
|
− | + | document.getElementById('Thema' + tempgetal).disabled = Waardes['Themadis'][tempgetal]; |
|
− | + | tempgetal += 1; |
|
+ | } |
||
− | } |
||
− | + | if (comesfromcookie) { |
|
− | + | document.getElementById('Radio1.' + tempgetalxyz).checked = true; |
|
− | + | Change1(tempgetalxyz); |
|
− | + | comesfromcookie = false; |
|
+ | } |
||
− | } |
||
− | + | Nummer = undefined; |
|
+ | } |
||
− | } |
||
} |
} |
||
function editpagenow(textx) { |
function editpagenow(textx) { |
||
− | + | console.log("Welkom!"); |
|
− | + | while (textx) { |
|
− | + | text = textx; |
|
− | + | textx = false; |
|
− | + | console.log("TRALALLAA"); |
|
+ | } |
||
− | } |
||
− | + | if (!Array.isArray(text)) { |
|
− | + | console.log(text); |
|
− | + | } else { |
|
− | + | console.log("X"); |
|
− | + | text = JSON.stringify(text); |
|
+ | } |
||
− | } |
||
− | + | console.log("Dit is een willekeurige regel.... .asdflk jlfkj lsdjfl a"); |
|
− | + | api.get({ |
|
− | + | action: 'query', |
|
− | + | prop: 'info', |
|
− | + | intoken: 'edit', |
|
− | + | titles: 'kaslv', //Pagina moet niet bestaan. |
|
− | + | }).done( |
|
− | + | function (data) { |
|
− | + | edit_token = data.query.pages['-1'].edittoken; |
|
− | + | }).done(function (data) { |
|
− | + | api.post({ |
|
− | + | 'action': 'edit', |
|
− | + | 'title': "Gebruiker:Rots61/Test.json", |
|
− | + | 'text': text, |
|
− | + | 'summary': "Pagina's als gecontroleerd gemarkeerd. [[WikiKids:Opschonen|(bewerking gedaan met 'Opschonen')]]", |
|
− | + | 'tags': 'Opschonen', |
|
− | + | 'bot': true, |
|
− | + | 'token': edit_token, |
|
− | + | }).done( |
|
− | + | function (data) { |
|
− | + | if (data.edit.result == "Success") { |
|
− | + | mw.notify("Opgeslagen!", { autoHide: false }); |
|
− | + | } else { |
|
− | + | mw.notify("Mislukt, meldt dit bij mij", { autoHide: false }); |
|
+ | } |
||
− | } |
||
− | + | console.log(data.edit); |
|
− | + | document.getElementById('bodyContent').innerHTML = "Opslaan gelukt. Herlaad de pagina om hem opnieuw te gebruiken. "; |
|
+ | }); |
||
− | }); |
||
− | + | }); |
|
} |
} |
||
function startIT() { |
function startIT() { |
||
− | + | if (!Array.isArray(text)) { |
|
− | + | text = JSON.parse(text); |
|
+ | } |
||
− | } |
||
− | + | tempgetal = 1; |
|
− | + | highArtikelr = Artikelr.length; |
|
− | + | while (tempgetal !== highArtikelr) { |
|
− | + | if (text[Artikeln[tempgetal]]["D"]) { |
|
− | + | } else { |
|
− | + | console.log(text[Artikeln[tempgetal]]["N"]); |
|
− | + | console.log(text[Artikeln[tempgetal]]); |
|
− | + | getKnop3 = document.getElementById("Radio3." + tempgetal); |
|
− | + | if (getKnop3 && getKnop3.checked) { |
|
− | + | } else { |
|
− | + | var getonderwerp = document.getElementById("Thema" + tempgetal); |
|
− | + | if (getonderwerp && getonderwerp.value) { |
|
− | + | getonderwerp = getonderwerp.value; |
|
− | + | } else { |
|
− | + | getonderwerp = ""; |
|
+ | } |
||
− | } |
||
− | + | var getopmerking = document.getElementById("Opmerking" + tempgetal); |
|
− | + | if (getopmerking && getopmerking.value) { |
|
− | + | getopmerking = getopmerking.value; |
|
− | + | } else { |
|
− | + | getopmerking = ""; |
|
+ | } |
||
− | } |
||
− | + | getKnop1 = document.getElementById("Radio1." + tempgetal); |
|
− | + | getKnop2 = document.getElementById("Radio2." + tempgetal); |
|
− | + | if (getKnop1 && getKnop1.checked) { |
|
− | + | if (getopmerking) { |
|
− | + | text[Artikeln[tempgetal]]["U"] = mw.config.get('wgUserName'); |
|
− | + | text[Artikeln[tempgetal]]["O"] = getopmerking; |
|
− | + | text[Artikeln[tempgetal]]["D"] = "D"; |
|
− | + | } else { |
|
− | + | text[Artikeln[tempgetal]]["D"] = "D"; |
|
− | + | text[Artikeln[tempgetal]]["U"] = mw.config.get('wgUserName'); |
|
+ | } |
||
− | } |
||
− | + | } else if ((getKnop2 && getKnop2.checked) || getopmerking || getonderwerp) { |
|
− | + | text[Artikeln[tempgetal]]["U"] = mw.config.get('wgUserName'); |
|
− | + | text[Artikeln[tempgetal]]["O"] = getopmerking; |
|
− | + | text[Artikeln[tempgetal]]["T"] = getonderwerp; |
|
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
− | + | tempgetal += 1; |
|
+ | } |
||
− | } |
||
− | + | console.log(text); |
|
− | + | editpagenow(text); |
|
− | + | console.log("Is uitgevoerd?"); |
|
} |
} |
||
function getJSONText() { |
function getJSONText() { |
||
− | + | return api.get({ |
|
− | + | action: "query", |
|
− | + | prop: "revisions", |
|
− | + | titles: "Gebruiker:Rots61/Test.json", |
|
− | + | rvlimit: "1", |
|
− | + | rvprop: "content", |
|
− | + | rvslots: "main", |
|
− | + | }).then(function (data) { |
|
− | + | temp = data.query.pages; |
|
− | + | temp = temp[148926]; |
|
− | + | temp = temp.revisions; |
|
− | + | temp = temp[0]; |
|
− | + | text = temp.slots.main; |
|
− | + | text = text["*"]; |
|
− | + | return JSON.parse(text); |
|
− | + | }); |
|
} |
} |
||
− | function getRandomNumber |
+ | function getRandomNumber(lengtetext) { |
− | + | if (showAll) { |
|
− | + | allNummer += 1; |
|
− | + | return allNummer; |
|
+ | } |
||
− | } |
||
− | + | return Math.floor(Math.random() * lengtetext); |
|
} |
} |
||
− | function startHints(){ |
+ | function startHints() { |
− | + | htmltext = document.getElementById('mw-content-text').innerHTML; |
|
− | + | paginalink = 'https://wikikids.nl/Wikikids:Wikiproject/Opschonen#'; |
|
− | + | document.getElementById('mw-content-text').innerHTML = '<div id="gadget-ophalen">Hints ophalen</div>' |
|
− | + | + '<div id="gadget-hint-http" style="color:red; display:none;">Er is een link die begint met http. (<a href="' + paginalink + 'HTTP_links">Wat moet ik doen?</a>)</div>' |
|
− | + | + '<div id="gadget-hint-vreemdelink" style="color:red; display:none;">Er klopt iets niet met een link. (<a href="' + paginalink + 'Link_klopt_niet">Wat moet ik doen?</a>)</div>' |
|
− | + | + '<div id="gadget-hint-dp" style="color:red; display:none;">Er staat een link naar een doorverwijspagina op dit artikel. (<a href="' + paginalink + 'Doorverwijspagina">Wat moet ik doen?</a>)</div>' |
|
− | + | + '<span id="gadget-hint-geenlinks" style="color:red; display:none;">Er verwijzen geen andere artikels naar dit artikel. <span id="gadget-hint-welportaal" style="color:green; display:none;">(Wel een portaal) </span>(<a href="' + paginalink + 'Geen_links">Wat moet ik doen?</a>)</span>' |
|
− | + | + '<div id="gadget-hint-grootbeg" style="color:red; display:none;">Dit artikel is wel groot voor een beginnetje. (<a href="' + paginalink + 'Groot_beginnetje">Wat moet ik doen?</a>)</div>' |
|
− | + | + '<div id="gadget-hint-geencat" style="color:red; font-weight:bold; display:none;">Er staat geen categorie op dit artikel. (<a href="' + paginalink + 'Geen_categorie">Wat moet ik doen?</a>)</div>' |
|
− | + | + '<div id="gadget-hint-weiniglinks" style="color:red; display:none;">Er staan te weinig links op dit artikel. (<a href="' + paginalink + 'Te_weinig_links_op_pagina">Wat moet ik doen?</a>)</div>' |
|
− | + | + '<div id="gadget-hint-woordenschat" style="display:none;">Ter informatie: Woordenschatartikel</div>' |
|
− | + | + '<div id="gadget-hint-extlink" style="display:none;">Er staan externe links op deze pagina. (<a href="' + paginalink + 'Externe_links">Wat moet ik doen?</a>)</div>' |
|
− | + | + '<div id="gadget-hint-gebruiker" style="color:green; font-weight:bold; display:none;">Artikel is geschreven door Hanssain. (<a href="' + paginalink + 'Artikel_gemaakt_door_gebruiker">Wat moet ik doen?</a>)</div>' |
|
− | + | + '<div id="gadget-hint-gecontroleerd" style="color:green; font-weight:bold; display:none;">Artikel is al gecontroleerd. (<a href="' + paginalink + 'Artikel_al_gecontroleerd">Wat moet ik doen?</a>)</div>' |
|
− | + | + '<hr id="gadget-ophalenlijn>' |
|
− | + | + document.getElementById('mw-content-text').innerHTML; |
|
− | + | getFirstAuteur(); |
|
− | + | getCategories(); |
|
− | + | getLinksIn(); |
|
− | + | getTextLength(); |
|
− | + | getBeg(); |
|
− | + | getLinksOut(); |
|
− | + | checkIfChecked(); |
|
− | + | getWoordenschat(); |
|
− | + | getExterneLinks(); |
|
− | + | setTimeout(removeloading, 1500); |
|
− | + | // Gecontroleerd, gebruiker, extlink, vreemde link, http, geencat, geenlinks |
|
− | + | //Moet nog: weiniglinks, grootkopje, dp |
|
} |
} |
||
− | function removeloading |
+ | function removeloading() { |
− | + | if (!woordenschat) { |
|
− | + | if (articlesize > 2000) { |
|
− | + | if (beg) { |
|
− | + | document.getElementById('gadget-hint-grootbeg').style.display = ""; |
|
+ | } |
||
− | } |
||
− | + | if (linksopartikel < 5) { |
|
− | + | document.getElementById('gadget-hint-weiniglinks').style.display = ""; |
|
+ | } |
||
− | } |
||
− | + | } else if (linksopartikel < 2) { |
|
− | + | document.getElementById('gadget-hint-weiniglinks').style.display = ""; |
|
+ | } |
||
− | } |
||
+ | } |
||
− | } |
||
− | api.get( |
+ | api.get({ |
action: "query", |
action: "query", |
||
prop: "linkshere", |
prop: "linkshere", |
||
− | titles: articletitle, |
+ | titles: articletitle, |
lhnamespace: "100", |
lhnamespace: "100", |
||
lhlimit: "50", |
lhlimit: "50", |
||
lhshow: "!redirect", |
lhshow: "!redirect", |
||
− | } |
+ | }).then(function (data) { |
− | + | temp = data.query.pages[articleId]; |
|
− | + | if (typeof temp.linkshere === 'undefined') { |
|
− | + | } else { |
|
− | + | document.getElementById('gadget-hint-welportaal').style.display = ""; |
|
− | + | document.getElementById('gadget-hint-geenlinks').style.color = ""; |
|
− | + | } |
|
}); |
}); |
||
− | + | document.getElementById("gadget-ophalen").innerHTML = ""; |
|
} |
} |
||
− | function getTextLength |
+ | function getTextLength() { |
− | + | return api.get({ |
|
− | + | action: "query", |
|
− | + | prop: "revisions", |
|
− | + | titles: articletitle, |
|
− | + | rvlimit: "1", |
|
− | + | rvprop: "content|size", |
|
− | + | rvslots: "main", |
|
− | + | }).then(function (data) { |
|
− | + | temp = data.query.pages; |
|
− | + | temp = temp[articleId].revisions["0"].size; |
|
− | + | articlesize = temp; |
|
− | + | return temp; |
|
− | + | }); |
|
} |
} |
||
− | function getCategories |
+ | function getCategories() { |
− | + | return api.get({ |
|
− | + | action: "query", |
|
− | + | prop: "categories", |
|
− | + | titles: articletitle, |
|
− | + | clshow: "!hidden", |
|
− | + | }).then(function (data) { |
|
− | + | temp = data.query.pages[articleId].categories; |
|
− | + | if (!temp) { |
|
− | + | document.getElementById("gadget-hint-geencat").style.display = ""; |
|
+ | } |
||
− | } |
||
− | + | }); |
|
} |
} |
||
− | function getFirstAuteur |
+ | function getFirstAuteur() { |
− | + | return api.get({ |
|
− | + | action: "query", |
|
− | + | prop: "revisions", |
|
− | + | titles: articletitle, |
|
− | + | rvlimit: "1", |
|
− | + | rvprop: "user", |
|
− | + | rvdir: "newer", |
|
− | + | rvslots: "main", |
|
− | + | }).then(function (data) { |
|
− | + | temp = data.query.pages[articleId].revisions[0].user; |
|
− | + | if (temp === "Hanssain") { |
|
− | + | document.getElementById("gadget-hint-gebruiker").style.display = ""; |
|
+ | } |
||
− | } |
||
− | + | }); |
|
} |
} |
||
− | function getWoordenschat |
+ | function getWoordenschat() { |
− | return api.get( |
+ | return api.get({ |
action: "query", |
action: "query", |
||
prop: "categories", |
prop: "categories", |
||
clcategories: "Category:Woordenschat", |
clcategories: "Category:Woordenschat", |
||
− | titles: articletitle, |
+ | titles: articletitle, |
− | } |
+ | }).then(function (data) { |
− | + | temp = data.query.pages; |
|
− | + | temp = temp[articleId]; |
|
− | + | if (typeof temp.categories !== 'undefined') { |
|
− | + | woordenschat = true; |
|
− | + | document.getElementById('gadget-hint-woordenschat').style.display = ""; |
|
− | + | } |
|
}); |
}); |
||
} |
} |
||
− | function getBeg |
+ | function getBeg() { |
− | return api.get( |
+ | return api.get({ |
action: "query", |
action: "query", |
||
prop: "categories", |
prop: "categories", |
||
clcategories: "Category:WikiKids:Beginnetje", |
clcategories: "Category:WikiKids:Beginnetje", |
||
− | titles: articletitle, |
+ | titles: articletitle, |
− | } |
+ | }).then(function (data) { |
− | + | temp = data.query.pages; |
|
− | + | temp = temp[articleId]; |
|
− | + | if (typeof temp.categories !== 'undefined') { |
|
− | + | beg = true; |
|
− | + | } |
|
}); |
}); |
||
} |
} |
||
− | function getLinksOut() { |
+ | function getLinksOut() { |
− | return api.get( |
+ | return api.get({ |
action: "query", |
action: "query", |
||
prop: "links", |
prop: "links", |
||
− | titles: articletitle, |
+ | titles: articletitle, |
pllimit: "5000", |
pllimit: "5000", |
||
− | } |
+ | }).then(function (data) { |
− | + | temp = data.query.pages; |
|
− | + | temp = temp[articleId]; |
|
− | + | if (typeof temp.links !== 'undefined') { |
|
− | + | linksopartikel = temp.links.length; |
|
− | + | getDP(); |
|
− | + | } else { |
|
− | + | linksopartikel = 0; |
|
− | + | } |
|
− | } |
+ | }); |
} |
} |
||
function getLinksIn() { |
function getLinksIn() { |
||
− | api.get( |
+ | api.get({ |
action: "query", |
action: "query", |
||
prop: "linkshere", |
prop: "linkshere", |
||
− | titles: articletitle, |
+ | titles: articletitle, |
lhnamespace: "0", |
lhnamespace: "0", |
||
lhlimit: "50", |
lhlimit: "50", |
||
lhshow: "!redirect", |
lhshow: "!redirect", |
||
− | } |
+ | }).then(function (data) { |
− | + | temp = data.query.pages[articleId]; |
|
− | + | if (typeof temp.linkshere === 'undefined') { |
|
− | + | document.getElementById("gadget-hint-geenlinks").style.display = ""; |
|
+ | |||
− | |||
− | + | } |
|
− | } |
+ | }); |
} |
} |
||
− | function checkIfChecked |
+ | function checkIfChecked() { |
− | + | valuechecked = mw.util.getParamValue('checked'); |
|
− | + | if (valuechecked === "Done") { |
|
− | + | document.getElementById("gadget-hint-gecontroleerd").style.display = ""; |
|
− | + | } else { |
|
− | + | getJSONText().done(function (text) { |
|
− | + | for (var i = 0, iLen = text.length; i < iLen; i++) { |
|
− | + | if (text[i].N == articletitle) checkChecked = text[i]["D"]; |
|
+ | } |
||
− | } |
||
− | + | if (checkChecked === "D") { |
|
− | + | document.getElementById("gadget-hint-gecontroleerd").style.display = ""; |
|
+ | } |
||
− | } |
||
− | + | }); |
|
+ | } |
||
− | } |
||
} |
} |
||
− | function getDP |
+ | function getDP() { |
− | + | api.get({ |
|
action: "query", |
action: "query", |
||
generator: "links", |
generator: "links", |
||
prop: "categories", |
prop: "categories", |
||
− | titles: articletitle, |
+ | titles: articletitle, |
gpllimit: "5000", |
gpllimit: "5000", |
||
cllimit: "5000", |
cllimit: "5000", |
||
clcategories: "Categorie:Wikikids:Doorverwijspagina", |
clcategories: "Categorie:Wikikids:Doorverwijspagina", |
||
− | } |
+ | }).then(function (data) { |
− | + | temp = data.query.pages; |
|
− | + | for (const property in temp) { |
|
− | + | if (temp[property].categories) { |
|
− | + | console.log(temp[property].title); |
|
− | + | document.getElementById("gadget-hint-dp").style.display = ""; |
|
− | + | } |
|
+ | } |
||
− | } |
||
− | + | }); |
|
} |
} |
||
− | function getExterneLinks() { |
+ | function getExterneLinks() { |
− | api.get( |
+ | api.get({ |
action: "query", |
action: "query", |
||
prop: "extlinks|categories", |
prop: "extlinks|categories", |
||
− | titles: articletitle, |
+ | titles: articletitle, |
ellimit: "5000", |
ellimit: "5000", |
||
− | } |
+ | }).then(function (data) { |
− | + | temp = data.query.pages; |
|
− | + | temp = temp[articleId].extlinks; |
|
− | + | if (typeof temp === 'undefined') { |
|
− | + | } else { |
|
− | + | var tempgetal = 0; |
|
− | + | while (typeof temp[tempgetal] !== 'undefined') { |
|
− | + | if (temp[tempgetal]["*"].startsWith("http:")) { |
|
− | + | document.getElementById("gadget-hint-http").style.display = ""; |
|
− | + | } else if (temp[tempgetal]["*"].startsWith("https:")) { |
|
− | + | if (beg === true) { |
|
− | + | if (temp[tempgetal]["*"] == "https://schooltv.nl/zoekresultaten/?q=" + articletitle) { |
|
− | + | } else if (temp[tempgetal]["*"] == "https://www.youtube.com/results?search_query=" + articletitle) { |
|
− | + | } else if (temp[tempgetal]["*"] == "https://commons.wikimedia.org/w/index.php?title=Special:Search&search=" + articletitle + "&ns0=1&ns6=1&ns12=1&ns14=1&ns100=1&ns106=1") { |
|
− | + | } else if (temp[tempgetal]["*"] == "https://commons.wikimedia.org/w/index.php?search=" + articletitle + "&title=Special:MediaSearch&go=Go&type=image") { |
|
− | + | } else if (temp[tempgetal]["*"] == "https://www.google.nl/search?q=" + articletitle) { |
|
− | + | } else if (temp[tempgetal]["*"] == "https://nl.wikipedia.org/wiki/" + articletitle) { |
|
− | + | } else if (temp[tempgetal]["*"] == "https://wikikids.nl/Wikikids:Beeldbank") { |
|
− | + | } else { |
|
+ | document.getElementById("gadget-hint-extlink").style.display = ""; |
||
− | } |
||
− | + | } |
|
+ | } else { |
||
− | document.getElementById("gadget-hint-extlink").style.display=""; |
||
+ | document.getElementById("gadget-hint-extlink").style.display = ""; |
||
− | } |
||
− | + | } |
|
+ | } else { |
||
− | document.getElementById("gadget-hint-vreemdelink").style.display=""; |
||
+ | document.getElementById("gadget-hint-vreemdelink").style.display = ""; |
||
− | } |
||
− | + | } |
|
− | + | tempgetal += 1; |
|
} |
} |
||
− | + | } |
|
+ | }); |
||
} |
} |
||
function changeInstellingen() { |
function changeInstellingen() { |
||
− | + | var instelling = document.getElementById("instellingen").style.display; |
|
− | + | if (instelling === 'none') { |
|
− | + | document.getElementById("instellingen").style.display = ""; |
|
− | + | document.getElementById("maxoption").disabled = false; |
|
− | + | } else { |
|
− | + | document.getElementById("instellingen").style.display = 'none'; |
|
− | + | document.getElementById("maxoption").disabled = true; |
|
− | + | document.getElementById("user").value = ""; |
|
− | + | document.getElementById("startwith").value = ""; |
|
+ | } |
||
− | } |
||
} |
} |
||
function hulpInfo() { |
function hulpInfo() { |
||
− | + | document.getElementsByTagName("h1")[0].textContent = "Speciaal:Opschonen"; |
|
− | + | document.title = "Help - Opschonen - WikiKids"; |
|
− | + | infotext = '<input type="checkbox" id="allepaginas" onclick="changeInstellingen();">Krijg willekeurige pagina\'s. <br>' |
|
− | + | + '<div id="instellingen">' |
|
− | + | + 'Gebruiker: <input type="text" id="user"><br>' |
|
− | + | + 'Alleen artikels die starten met: <input type="text" id="startwith"><br></div>' |
|
− | + | + 'Gecontroleerd: <select name="done" id="done">' |
|
− | + | + '<option value="notdone">Niet</option>' |
|
− | + | + '<option value="xdone" selected>Maakt niet uit</option>' |
|
− | + | + '<option value="done">Wel</option>' |
|
− | + | + '</select><br>' |
|
− | + | + 'Thema: <select name="thema" id="thema">' |
|
− | + | + '<option value="notthema">Geen</option>' |
|
− | + | + '<option value="xthema" selected>Maakt niet uit</option>' |
|
− | + | + '<option value="thema">Wel</option>' |
|
− | + | + '</select><br>' |
|
− | + | + 'Aantal: <select name="aantal" id="aantal">' |
|
− | + | + '<option value="100">100</option>' |
|
− | + | + '<option value="50" selected>50</option>' |
|
− | + | + '<option value="10">10</option>' |
|
− | + | + '<option value="0">0</option>' |
|
− | + | + '<option value="max" id="maxoption">Max</option>' |
|
− | + | + '</select><br>' |
|
− | + | + '<br><button onclick="getsettings()">Bekijk pagina\'s</button>' |
|
− | + | + 'Vragen hierover? Laat het me weten'; |
|
− | + | document.getElementById('bodyContent').innerHTML = infotext; |
|
} |
} |
||
− | function getsettings |
+ | function getsettings() { |
− | + | var allepaginasl = document.getElementById('allepaginas').checked; |
|
− | + | var startwithl = document.getElementById('startwith').value; |
|
− | + | var themal = document.getElementById('thema').value; |
|
− | + | var userl = document.getElementById('user').value; |
|
− | + | var aantall = document.getElementById('aantal').value; |
|
− | + | var donel = document.getElementById('done').value; |
|
− | + | var url = 'https://wikikids.nl/Speciaal:Opschonen?'; |
|
− | + | if (allepaginasl) { |
|
− | + | } else { |
|
− | + | url += 'allepaginas=x&'; |
|
+ | } |
||
− | } |
||
− | + | if (themal === "thema") { |
|
− | + | url += 'thema=x&'; |
|
− | + | } else if (themal === "notthema") { |
|
− | + | url += 'notthema=x&'; |
|
+ | } |
||
− | } |
||
− | + | if (donel === "done") { |
|
− | + | url += 'done=x&'; |
|
− | + | } else if (donel === "notdone") { |
|
− | + | url += 'notdone=x&'; |
|
+ | } |
||
− | } |
||
− | + | if (userl) { |
|
− | + | url += 'user=' + userl + '&'; |
|
+ | } |
||
− | } |
||
− | + | url += 'aantal=' + aantall; |
|
− | + | window.location.href = url; |
|
} |
} |
||
− | if (mw.config.get('wgNamespaceNumber') === -1 && mw.config.get('wgTitle') === "Opschonen") { |
+ | if (mw.config.get('wgNamespaceNumber') === -1 && mw.config.get('wgTitle') === "Opschonen") { |
− | + | document.getElementById("footer-places").innerHTML += '<li id="footer-places-gadget-opschonen">Script gemaakt door <a href="/User:Rots61" title="Gebruiker:Rots61">Rots61</a>, versie: ' + opschoonversion + '</li>'; |
|
− | + | if (document.URL === "https://wikikids.nl/Speciaal:Opschonen?action=help") { |
|
− | + | var infotext; |
|
− | + | hulpInfo(); |
|
− | + | } else { |
|
− | + | showAantal = parseInt(mw.util.getParamValue('aantal')); |
|
− | + | showUser = mw.util.getParamValue('user'); |
|
− | + | showStartwith = mw.util.getParamValue('Startwith'); |
|
− | + | var tussenvoegsel; |
|
− | + | 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; |
|
− | + | var tempgetal; |
|
− | + | var temp; |
|
− | + | var Artikelr = []; |
|
− | + | var Artikeln = []; |
|
− | + | var Artikellink = []; |
|
− | + | var getUser; |
|
− | + | var Thematemp = []; |
|
− | + | var Opmerkingtemp = []; |
|
− | + | var Thematempx; |
|
− | + | var Opmerkingtempx; |
|
− | + | var Knop1x = []; |
|
− | + | var Knop2x = []; |
|
− | + | var Knop3x = []; |
|
− | + | var Opmerking = []; |
|
− | + | var Thema = []; |
|
− | + | var tabel; |
|
− | + | 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); |
|
− | + | }); |
|
+ | } |
||
− | } |
||
} |
} |
||
− | var showHints = mw.util.getParamValue( |
+ | var showHints = mw.util.getParamValue('projectopschonen'); |
− | if (showHints) { |
+ | if (showHints) { |
− | + | showHints = "disabled"; |
|
− | + | document.getElementById("footer-places").innerHTML += '<li id="footer-places-gadget-opschonen">Hints zijn gemaakt door <a href="/User:Rots61" title="Gebruiker:Rots61">Rots61</a>, versie: ' + opschoonversion + '</li>'; |
|
− | + | //varvar |
|
− | + | var articletitle = mw.config.get('wgPageName'); |
|
− | + | var articleId = mw.config.get('wgArticleId'); |
|
− | + | var beg = false; |
|
− | + | var dp = false; |
|
− | + | var link = 0; |
|
− | + | var link2 = ""; |
|
− | + | var temp; |
|
− | + | var temp2; |
|
− | + | var linkhttp = 0; |
|
− | + | var redirects = ""; |
|
− | + | var Hints = ""; |
|
− | + | var htmltext; |
|
− | + | var Nummer; |
|
− | + | var CheckChecked; |
|
− | + | var articlesize; |
|
− | + | var linksopartikel; |
|
− | + | var valuechecked; |
|
− | + | var woordenschat = false; |
|
− | + | startHints(); |
|
} |
} |
||
Versie van 12 jan 2023 17:27
/* jshint sub:true maxerr:100000 */
// Gadget gemaakt door [[User:Rots61]]
// Documentatie op [[WikiKids:Opschonen]]
var opschoonversion = '1.2';
var text;
var api = new mw.Api();
var alreadydone;
function showProject(text) {
// text = array
document.getElementsByTagName("h1")[0].textContent = "Speciaal:Opschonen";
document.title = "Opschonen - WikiKids";
tempgetal = 1;
tempnumber = 1;
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:Opschonen?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))))))) {
} else {
showAantal = 51;
showSkipDone = true;
}
lengtetext = text.length;
while (tempnumber !== showAantal) {
Artikeln[tempgetal] = getURLParamNumber(text);
if (Artikeln[tempgetal] === 'exit') {
tempnumber = -1;
showAantal = -1;
} else {
Artikelr[tempgetal] = text[Artikeln[tempgetal]]["N"];
if (text[Artikeln[tempgetal]]["D"]) {
gedaan[tempgetal] = " disabled";
text[Artikeln[tempgetal]]["T"] = " ";
linkextra[tempgetal] = "Done";
Knop1x[tempgetal] = "";
Knop2x[tempgetal] = "";
Knop3x[tempgetal] = '<td colspan="3" style="color:green; font-weight: bold; text-align: center;">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"]) {
Opmerking[tempgetal] = text[Artikeln[tempgetal]]["O"];
} else {
Opmerking[tempgetal] = '<input type="text" id=Opmerking' + tempgetal + ' name=Opmerking' + tempgetal + ' size=70">';
}
if (text[Artikeln[tempgetal]]["T"]) {
Thema[tempgetal] = '<center>' + text[Artikeln[tempgetal]]["T"] + '</center>';
} else {
Thema[tempgetal] = '<input type="text" id=Thema' + tempgetal + ' name=Thema' + tempgetal + ' size=10">';
}
console.log(Artikeln[tempgetal] + ": " + Artikelr[tempgetal]);
Artikellink[tempgetal] = '<a href="https://wikikids.nl/' + Artikelr[tempgetal] + '?projectopschonen=x&checked=' + linkextra[tempgetal] + '" target="_blank">' + Artikelr[tempgetal] + '</a>' + vorigeuser[tempgetal];
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 getURLParamNumber(text, nummer) {
willekeuriggetal = 0;
while (willekeuriggetal === 0) {
willekeuriggetal = getRandomNumber(text.length);
if (willekeuriggetal === text.length) {
return 'exit';
} else {
if (showUser) {
if (text[willekeuriggetal]["U"] === showUser) {
} else {
willekeuriggetal = 0;
}
}
if (showThema) {
if (text[willekeuriggetal]["T"]) {
} else {
willekeuriggetal = 0;
}
} else if (showSkipThema) {
if (text[willekeuriggetal]["T"]) {
willekeuriggetal = 0;
}
}
if (showDone) {
if (text[willekeuriggetal]["D"]) {
} else {
willekeuriggetal = 0;
}
} else if (showSkipDone) {
if (text[willekeuriggetal]["D"]) {
willekeuriggetal = 0;
}
}
if (showStartwith) {
var re = new RegExp('^' + showStartwith, "g");
if (text[willekeuriggetal]["N"] !== text[willekeuriggetal]["N"].replace(re, "newstring")) {
console.log(text[willekeuriggetal]["N"]);
} else {
willekeuriggetal = 0;
}
}
if (showFrom) {
if (text[willekeuriggetal]["N"]) {
}
if (showTo) {
if (text[willekeuriggetal]["N"]) {
}
}
}
}
}
return willekeuriggetal;
}
function Change1(getal) {
if (!document.getElementById('Thema' + getal).disabled) {
Thematemp[getal] = document.getElementById('Thema' + getal).value;
}
document.getElementById('Thema' + getal).disabled = true;
document.getElementById('Opmerking' + getal).disabled = false;
document.getElementById('Thema' + getal).value = "";
Opmerkingtempx = document.getElementById('Opmerking' + getal).value;
document.getElementById('Opmerking' + getal).value = Opmerkingtemp[getal] ? Opmerkingtemp[getal] : Opmerkingtempx ? Opmerkingtempx : "";
}
function Change2(getal) {
Thematempx = document.getElementById('Thema' + getal).value;
Opmerkingtempx = document.getElementById('Opmerking' + getal).value;
document.getElementById('Thema' + getal).disabled = false;
document.getElementById('Opmerking' + getal).disabled = false;
document.getElementById('Thema' + getal).value = Thematemp[getal] ? Thematemp[getal] : Thematempx ? Thematempx : "";
document.getElementById('Opmerking' + getal).value = Opmerkingtemp[getal] ? Opmerkingtemp[getal] : Opmerkingtempx ? Opmerkingtempx : "";
}
function Change3(getal) {
if (!document.getElementById('Thema' + getal).disabled) {
Thematemp[getal] = document.getElementById('Thema' + getal).value;
}
if (!document.getElementById('Opmerking' + getal).disabled) {
Opmerkingtemp[getal] = document.getElementById('Opmerking' + getal).value;
}
document.getElementById('Thema' + getal).disabled = true;
document.getElementById('Opmerking' + getal).disabled = true;
document.getElementById('Thema' + getal).value = "";
document.getElementById('Opmerking' + getal).value = "";
}
function fromPageaddPage() {
var text;
var artikel;
var checkconfirm;
var checkopmerking;
var Nummer;
getJSONText().done(function (text) {
fromPageCheckOnList(text);
});
}
function fromPageCheckOnList(text) {
if (!Array.isArray(text)) {
text = JSON.parse(text);
}
if (!text[1]["N"]) {
text = JSON.parse(text);
}
addarticle = mw.config.get('wgPageName').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) {
alreadydone = true;
mw.notify("Pagina is een redirect.");
} else {
$.each(ret.query.pages, function () {
if (this.missing !== "") {
if (this.ns === 0) {
Nummer = text.length;
text[text.length] = { "N": addarticle, "D": "D", "U": mw.config.get('wgUserName') };
} else {
alreadydone = true;
mw.notify("Pagina staat niet in de hoofdnaamruimte.");
}
} else {
alreadydone = true;
mw.notify("Pagina bestaat niet. ");
}
}, function (error) {
});
}
});
} else if (text[Nummer]["D"] === "D") {
mw.notify("Dit aritkel is al gecontroleerd door " + text[Nummer]["U"]);
alreadydone = true;
} else {
console.log(Nummer);
text[Nummer]["D"] = "D";
text[Nummer]["U"] = mw.config.get('wgUserName');
}
fromPageSave(text);
}
function fromPageSave(text) {
if (alreadydone) {
} else if (!Nummer) {
setTimeout(fromPageSave, 250);
} else {
checkopmerking = prompt("Mogelijke opmerking over het artikel: ");
if (checkopmerking === null) {
} else if (checkopmerking === '') {
console.log(text);
editpagenow(text);
} else {
text[Nummer]["O"] = checkopmerking;
editpagenow(text);
}
}
}
function addArticleToList(artikel) {
if (!text[1]["N"]) {
text = JSON.parse(text);
}
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"] = " ";
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"]) {
Opmerking[tempgetal] = text[Artikeln[tempgetal]]["O"];
} else {
Opmerking[tempgetal] = '<input type="text" id=Opmerking' + tempgetal + ' name=Opmerking' + tempgetal + ' size=70">';
}
if (text[Artikeln[tempgetal]]["T"]) {
Thema[tempgetal] = '<center>' + text[Artikeln[tempgetal]]["T"] + '</center>';
} else {
Thema[tempgetal] = '<input type="text" id=Thema' + tempgetal + ' name=Thema' + tempgetal + ' size=10">';
}
console.log(Artikeln[tempgetal] + ": " + Artikelr[tempgetal]);
Artikellink[tempgetal] = '<a href="https://wikikids.nl/' + Artikelr[tempgetal] + '?projectopschonen=x&checked=' + linkextra[tempgetal] + '" target="_blank">' + Artikelr[tempgetal] + '</a>' + vorigeuser[tempgetal];
tabel += '<tr> <td>' + Artikellink[tempgetal] + '</td>' + Knop1x[tempgetal] + Knop2x[tempgetal] + Knop3x[tempgetal] + '<td>' + Opmerking[tempgetal] + '</td> <td>' + Thema[tempgetal] + '</td> </tr>';
mw.notify("Artikel toegevoegd op deze pagina.");
document.getElementById('bodyContent').innerHTML = tabel + eindetabel;
tempgetalxyz = tempgetal;
tempgetal = 1;
while (tempgetal !== gewenstelengte) {
document.getElementById('Radio1.' + tempgetal).checked = Waardes['Radio1'][tempgetal];
document.getElementById('Radio2.' + tempgetal).checked = Waardes['Radio2'][tempgetal];
document.getElementById('Radio3.' + tempgetal).checked = Waardes['Radio3'][tempgetal];
document.getElementById('Opmerking' + tempgetal).value = Waardes['Opmerking'][tempgetal];
document.getElementById('Thema' + tempgetal).value = Waardes['Thema'][tempgetal];
document.getElementById('Opmerking' + tempgetal).disabled = Waardes['Opmerkingdis'][tempgetal];
document.getElementById('Thema' + tempgetal).disabled = Waardes['Themadis'][tempgetal];
tempgetal += 1;
}
if (comesfromcookie) {
document.getElementById('Radio1.' + tempgetalxyz).checked = true;
Change1(tempgetalxyz);
comesfromcookie = false;
}
Nummer = undefined;
}
}
function editpagenow(textx) {
console.log("Welkom!");
while (textx) {
text = textx;
textx = false;
console.log("TRALALLAA");
}
if (!Array.isArray(text)) {
console.log(text);
} else {
console.log("X");
text = JSON.stringify(text);
}
console.log("Dit is een willekeurige regel.... .asdflk jlfkj lsdjfl a");
api.get({
action: 'query',
prop: 'info',
intoken: 'edit',
titles: 'kaslv', //Pagina moet niet bestaan.
}).done(
function (data) {
edit_token = data.query.pages['-1'].edittoken;
}).done(function (data) {
api.post({
'action': 'edit',
'title': "Gebruiker:Rots61/Test.json",
'text': text,
'summary': "Pagina's als gecontroleerd gemarkeerd. [[WikiKids:Opschonen|(bewerking gedaan met 'Opschonen')]]",
'tags': 'Opschonen',
'bot': true,
'token': edit_token,
}).done(
function (data) {
if (data.edit.result == "Success") {
mw.notify("Opgeslagen!", { autoHide: false });
} else {
mw.notify("Mislukt, meldt dit bij mij", { autoHide: false });
}
console.log(data.edit);
document.getElementById('bodyContent').innerHTML = "Opslaan gelukt. Herlaad de pagina om hem opnieuw te gebruiken. ";
});
});
}
function startIT() {
if (!Array.isArray(text)) {
text = JSON.parse(text);
}
tempgetal = 1;
highArtikelr = Artikelr.length;
while (tempgetal !== highArtikelr) {
if (text[Artikeln[tempgetal]]["D"]) {
} else {
console.log(text[Artikeln[tempgetal]]["N"]);
console.log(text[Artikeln[tempgetal]]);
getKnop3 = document.getElementById("Radio3." + tempgetal);
if (getKnop3 && getKnop3.checked) {
} else {
var getonderwerp = document.getElementById("Thema" + tempgetal);
if (getonderwerp && getonderwerp.value) {
getonderwerp = getonderwerp.value;
} else {
getonderwerp = "";
}
var getopmerking = document.getElementById("Opmerking" + tempgetal);
if (getopmerking && getopmerking.value) {
getopmerking = getopmerking.value;
} else {
getopmerking = "";
}
getKnop1 = document.getElementById("Radio1." + tempgetal);
getKnop2 = document.getElementById("Radio2." + tempgetal);
if (getKnop1 && getKnop1.checked) {
if (getopmerking) {
text[Artikeln[tempgetal]]["U"] = mw.config.get('wgUserName');
text[Artikeln[tempgetal]]["O"] = getopmerking;
text[Artikeln[tempgetal]]["D"] = "D";
} else {
text[Artikeln[tempgetal]]["D"] = "D";
text[Artikeln[tempgetal]]["U"] = mw.config.get('wgUserName');
}
} else if ((getKnop2 && getKnop2.checked) || getopmerking || getonderwerp) {
text[Artikeln[tempgetal]]["U"] = mw.config.get('wgUserName');
text[Artikeln[tempgetal]]["O"] = getopmerking;
text[Artikeln[tempgetal]]["T"] = getonderwerp;
}
}
}
tempgetal += 1;
}
console.log(text);
editpagenow(text);
console.log("Is uitgevoerd?");
}
function getJSONText() {
return api.get({
action: "query",
prop: "revisions",
titles: "Gebruiker:Rots61/Test.json",
rvlimit: "1",
rvprop: "content",
rvslots: "main",
}).then(function (data) {
temp = data.query.pages;
temp = temp[148926];
temp = temp.revisions;
temp = temp[0];
text = temp.slots.main;
text = text["*"];
return JSON.parse(text);
});
}
function getRandomNumber(lengtetext) {
if (showAll) {
allNummer += 1;
return allNummer;
}
return Math.floor(Math.random() * lengtetext);
}
function startHints() {
htmltext = document.getElementById('mw-content-text').innerHTML;
paginalink = 'https://wikikids.nl/Wikikids:Wikiproject/Opschonen#';
document.getElementById('mw-content-text').innerHTML = '<div id="gadget-ophalen">Hints ophalen</div>'
+ '<div id="gadget-hint-http" style="color:red; display:none;">Er is een link die begint met http. (<a href="' + paginalink + 'HTTP_links">Wat moet ik doen?</a>)</div>'
+ '<div id="gadget-hint-vreemdelink" style="color:red; display:none;">Er klopt iets niet met een link. (<a href="' + paginalink + 'Link_klopt_niet">Wat moet ik doen?</a>)</div>'
+ '<div id="gadget-hint-dp" style="color:red; display:none;">Er staat een link naar een doorverwijspagina op dit artikel. (<a href="' + paginalink + 'Doorverwijspagina">Wat moet ik doen?</a>)</div>'
+ '<span id="gadget-hint-geenlinks" style="color:red; display:none;">Er verwijzen geen andere artikels naar dit artikel. <span id="gadget-hint-welportaal" style="color:green; display:none;">(Wel een portaal) </span>(<a href="' + paginalink + 'Geen_links">Wat moet ik doen?</a>)</span>'
+ '<div id="gadget-hint-grootbeg" style="color:red; display:none;">Dit artikel is wel groot voor een beginnetje. (<a href="' + paginalink + 'Groot_beginnetje">Wat moet ik doen?</a>)</div>'
+ '<div id="gadget-hint-geencat" style="color:red; font-weight:bold; display:none;">Er staat geen categorie op dit artikel. (<a href="' + paginalink + 'Geen_categorie">Wat moet ik doen?</a>)</div>'
+ '<div id="gadget-hint-weiniglinks" style="color:red; display:none;">Er staan te weinig links op dit artikel. (<a href="' + paginalink + 'Te_weinig_links_op_pagina">Wat moet ik doen?</a>)</div>'
+ '<div id="gadget-hint-woordenschat" style="display:none;">Ter informatie: Woordenschatartikel</div>'
+ '<div id="gadget-hint-extlink" style="display:none;">Er staan externe links op deze pagina. (<a href="' + paginalink + 'Externe_links">Wat moet ik doen?</a>)</div>'
+ '<div id="gadget-hint-gebruiker" style="color:green; font-weight:bold; display:none;">Artikel is geschreven door Hanssain. (<a href="' + paginalink + 'Artikel_gemaakt_door_gebruiker">Wat moet ik doen?</a>)</div>'
+ '<div id="gadget-hint-gecontroleerd" style="color:green; font-weight:bold; display:none;">Artikel is al gecontroleerd. (<a href="' + paginalink + 'Artikel_al_gecontroleerd">Wat moet ik doen?</a>)</div>'
+ '<hr id="gadget-ophalenlijn>'
+ document.getElementById('mw-content-text').innerHTML;
getFirstAuteur();
getCategories();
getLinksIn();
getTextLength();
getBeg();
getLinksOut();
checkIfChecked();
getWoordenschat();
getExterneLinks();
setTimeout(removeloading, 1500);
// Gecontroleerd, gebruiker, extlink, vreemde link, http, geencat, geenlinks
//Moet nog: weiniglinks, grootkopje, dp
}
function removeloading() {
if (!woordenschat) {
if (articlesize > 2000) {
if (beg) {
document.getElementById('gadget-hint-grootbeg').style.display = "";
}
if (linksopartikel < 5) {
document.getElementById('gadget-hint-weiniglinks').style.display = "";
}
} else if (linksopartikel < 2) {
document.getElementById('gadget-hint-weiniglinks').style.display = "";
}
}
api.get({
action: "query",
prop: "linkshere",
titles: articletitle,
lhnamespace: "100",
lhlimit: "50",
lhshow: "!redirect",
}).then(function (data) {
temp = data.query.pages[articleId];
if (typeof temp.linkshere === 'undefined') {
} else {
document.getElementById('gadget-hint-welportaal').style.display = "";
document.getElementById('gadget-hint-geenlinks').style.color = "";
}
});
document.getElementById("gadget-ophalen").innerHTML = "";
}
function getTextLength() {
return api.get({
action: "query",
prop: "revisions",
titles: articletitle,
rvlimit: "1",
rvprop: "content|size",
rvslots: "main",
}).then(function (data) {
temp = data.query.pages;
temp = temp[articleId].revisions["0"].size;
articlesize = temp;
return temp;
});
}
function getCategories() {
return api.get({
action: "query",
prop: "categories",
titles: articletitle,
clshow: "!hidden",
}).then(function (data) {
temp = data.query.pages[articleId].categories;
if (!temp) {
document.getElementById("gadget-hint-geencat").style.display = "";
}
});
}
function getFirstAuteur() {
return api.get({
action: "query",
prop: "revisions",
titles: articletitle,
rvlimit: "1",
rvprop: "user",
rvdir: "newer",
rvslots: "main",
}).then(function (data) {
temp = data.query.pages[articleId].revisions[0].user;
if (temp === "Hanssain") {
document.getElementById("gadget-hint-gebruiker").style.display = "";
}
});
}
function getWoordenschat() {
return api.get({
action: "query",
prop: "categories",
clcategories: "Category:Woordenschat",
titles: articletitle,
}).then(function (data) {
temp = data.query.pages;
temp = temp[articleId];
if (typeof temp.categories !== 'undefined') {
woordenschat = true;
document.getElementById('gadget-hint-woordenschat').style.display = "";
}
});
}
function getBeg() {
return api.get({
action: "query",
prop: "categories",
clcategories: "Category:WikiKids:Beginnetje",
titles: articletitle,
}).then(function (data) {
temp = data.query.pages;
temp = temp[articleId];
if (typeof temp.categories !== 'undefined') {
beg = true;
}
});
}
function getLinksOut() {
return api.get({
action: "query",
prop: "links",
titles: articletitle,
pllimit: "5000",
}).then(function (data) {
temp = data.query.pages;
temp = temp[articleId];
if (typeof temp.links !== 'undefined') {
linksopartikel = temp.links.length;
getDP();
} else {
linksopartikel = 0;
}
});
}
function getLinksIn() {
api.get({
action: "query",
prop: "linkshere",
titles: articletitle,
lhnamespace: "0",
lhlimit: "50",
lhshow: "!redirect",
}).then(function (data) {
temp = data.query.pages[articleId];
if (typeof temp.linkshere === 'undefined') {
document.getElementById("gadget-hint-geenlinks").style.display = "";
}
});
}
function checkIfChecked() {
valuechecked = mw.util.getParamValue('checked');
if (valuechecked === "Done") {
document.getElementById("gadget-hint-gecontroleerd").style.display = "";
} else {
getJSONText().done(function (text) {
for (var i = 0, iLen = text.length; i < iLen; i++) {
if (text[i].N == articletitle) checkChecked = text[i]["D"];
}
if (checkChecked === "D") {
document.getElementById("gadget-hint-gecontroleerd").style.display = "";
}
});
}
}
function getDP() {
api.get({
action: "query",
generator: "links",
prop: "categories",
titles: articletitle,
gpllimit: "5000",
cllimit: "5000",
clcategories: "Categorie:Wikikids:Doorverwijspagina",
}).then(function (data) {
temp = data.query.pages;
for (const property in temp) {
if (temp[property].categories) {
console.log(temp[property].title);
document.getElementById("gadget-hint-dp").style.display = "";
}
}
});
}
function getExterneLinks() {
api.get({
action: "query",
prop: "extlinks|categories",
titles: articletitle,
ellimit: "5000",
}).then(function (data) {
temp = data.query.pages;
temp = temp[articleId].extlinks;
if (typeof temp === 'undefined') {
} else {
var tempgetal = 0;
while (typeof temp[tempgetal] !== 'undefined') {
if (temp[tempgetal]["*"].startsWith("http:")) {
document.getElementById("gadget-hint-http").style.display = "";
} else if (temp[tempgetal]["*"].startsWith("https:")) {
if (beg === true) {
if (temp[tempgetal]["*"] == "https://schooltv.nl/zoekresultaten/?q=" + articletitle) {
} else if (temp[tempgetal]["*"] == "https://www.youtube.com/results?search_query=" + articletitle) {
} else if (temp[tempgetal]["*"] == "https://commons.wikimedia.org/w/index.php?title=Special:Search&search=" + articletitle + "&ns0=1&ns6=1&ns12=1&ns14=1&ns100=1&ns106=1") {
} else if (temp[tempgetal]["*"] == "https://commons.wikimedia.org/w/index.php?search=" + articletitle + "&title=Special:MediaSearch&go=Go&type=image") {
} else if (temp[tempgetal]["*"] == "https://www.google.nl/search?q=" + articletitle) {
} else if (temp[tempgetal]["*"] == "https://nl.wikipedia.org/wiki/" + articletitle) {
} else if (temp[tempgetal]["*"] == "https://wikikids.nl/Wikikids:Beeldbank") {
} else {
document.getElementById("gadget-hint-extlink").style.display = "";
}
} else {
document.getElementById("gadget-hint-extlink").style.display = "";
}
} else {
document.getElementById("gadget-hint-vreemdelink").style.display = "";
}
tempgetal += 1;
}
}
});
}
function changeInstellingen() {
var instelling = document.getElementById("instellingen").style.display;
if (instelling === 'none') {
document.getElementById("instellingen").style.display = "";
document.getElementById("maxoption").disabled = false;
} else {
document.getElementById("instellingen").style.display = 'none';
document.getElementById("maxoption").disabled = true;
document.getElementById("user").value = "";
document.getElementById("startwith").value = "";
}
}
function hulpInfo() {
document.getElementsByTagName("h1")[0].textContent = "Speciaal:Opschonen";
document.title = "Help - Opschonen - WikiKids";
infotext = '<input type="checkbox" id="allepaginas" onclick="changeInstellingen();">Krijg willekeurige pagina\'s. <br>'
+ '<div id="instellingen">'
+ 'Gebruiker: <input type="text" id="user"><br>'
+ 'Alleen artikels die starten met: <input type="text" id="startwith"><br></div>'
+ 'Gecontroleerd: <select name="done" id="done">'
+ '<option value="notdone">Niet</option>'
+ '<option value="xdone" selected>Maakt niet uit</option>'
+ '<option value="done">Wel</option>'
+ '</select><br>'
+ 'Thema: <select name="thema" id="thema">'
+ '<option value="notthema">Geen</option>'
+ '<option value="xthema" selected>Maakt niet uit</option>'
+ '<option value="thema">Wel</option>'
+ '</select><br>'
+ 'Aantal: <select name="aantal" id="aantal">'
+ '<option value="100">100</option>'
+ '<option value="50" selected>50</option>'
+ '<option value="10">10</option>'
+ '<option value="0">0</option>'
+ '<option value="max" id="maxoption">Max</option>'
+ '</select><br>'
+ '<br><button onclick="getsettings()">Bekijk pagina\'s</button>'
+ 'Vragen hierover? Laat het me weten';
document.getElementById('bodyContent').innerHTML = infotext;
}
function getsettings() {
var allepaginasl = document.getElementById('allepaginas').checked;
var startwithl = document.getElementById('startwith').value;
var themal = document.getElementById('thema').value;
var userl = document.getElementById('user').value;
var aantall = document.getElementById('aantal').value;
var donel = document.getElementById('done').value;
var url = 'https://wikikids.nl/Speciaal:Opschonen?';
if (allepaginasl) {
} else {
url += 'allepaginas=x&';
}
if (themal === "thema") {
url += 'thema=x&';
} else if (themal === "notthema") {
url += 'notthema=x&';
}
if (donel === "done") {
url += 'done=x&';
} else if (donel === "notdone") {
url += 'notdone=x&';
}
if (userl) {
url += 'user=' + userl + '&';
}
url += 'aantal=' + aantall;
window.location.href = url;
}
if (mw.config.get('wgNamespaceNumber') === -1 && mw.config.get('wgTitle') === "Opschonen") {
document.getElementById("footer-places").innerHTML += '<li id="footer-places-gadget-opschonen">Script gemaakt door <a href="/User:Rots61" title="Gebruiker:Rots61">Rots61</a>, versie: ' + opschoonversion + '</li>';
if (document.URL === "https://wikikids.nl/Speciaal:Opschonen?action=help") {
var infotext;
hulpInfo();
} else {
showAantal = parseInt(mw.util.getParamValue('aantal'));
showUser = mw.util.getParamValue('user');
showStartwith = mw.util.getParamValue('Startwith');
var tussenvoegsel;
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;
var tempgetal;
var temp;
var Artikelr = [];
var Artikeln = [];
var Artikellink = [];
var getUser;
var Thematemp = [];
var Opmerkingtemp = [];
var Thematempx;
var Opmerkingtempx;
var Knop1x = [];
var Knop2x = [];
var Knop3x = [];
var Opmerking = [];
var Thema = [];
var tabel;
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);
});
}
}
var showHints = mw.util.getParamValue('projectopschonen');
if (showHints) {
showHints = "disabled";
document.getElementById("footer-places").innerHTML += '<li id="footer-places-gadget-opschonen">Hints zijn gemaakt door <a href="/User:Rots61" title="Gebruiker:Rots61">Rots61</a>, versie: ' + opschoonversion + '</li>';
//varvar
var articletitle = mw.config.get('wgPageName');
var articleId = mw.config.get('wgArticleId');
var beg = false;
var dp = false;
var link = 0;
var link2 = "";
var temp;
var temp2;
var linkhttp = 0;
var redirects = "";
var Hints = "";
var htmltext;
var Nummer;
var CheckChecked;
var articlesize;
var linksopartikel;
var valuechecked;
var woordenschat = false;
startHints();
}
if ((mw.config.get('wgNamespaceNumber') === 0) && (mw.config.get('wgArticleId') > 1)) {
document.getElementById("mw-panel").innerHTML += `<nav id="p-op" style="background-color: #1D9CB9" class="vector-menu vector-menu-portal portal"
aria-labelledby="p-op-label" role="navigation">
<h3 id="p-op-label">
<span>Opschonen</span>
</h3>
<div class="body vector-menu-content" style="border-bottom: 1px solid #1D9CB9">
<ul class="vector-menu-content-list">
<li>
<button onclick="location.href='https://wikikids.nl/Speciaal:Opschonen';">Speciaal:Opschonen</button>
</li>
<li>
<button
onclick="location.href='https://wikikids.nl/${mw.config.get('wgPageName')}?projectopschonen=x';">Opschoon
hints</button>
</li>
<li>
<button onclick="fromPageaddPage()" disabled>Gecontroleerd</button>
</li>
</ul>
</div>
</nav>`;
}