Gebruiker:Rots61/JS-TVB.js: verschil tussen versies
		
		
		
		
		
		Naar navigatie springen
		Naar zoeken springen
		
				
		
		
	
|  (klikken -> overheen met je muis) | |||
| (42 tussenliggende versies door dezelfde gebruiker niet weergegeven) | |||
| Regel 1: | Regel 1: | ||
| /* jshint sub:true maxerr:100000 */ | /* jshint sub:true maxerr:100000 */ | ||
| + | // Dit script heeft invloed op heel WikiKids, alle gebruikers.   | ||
| // Script dat ervoor zorgt dat alle pagina's met een categorie die bij een portaal hoort, automatisch een of meerdere TVB krijgen. | // Script dat ervoor zorgt dat alle pagina's met een categorie die bij een portaal hoort, automatisch een of meerdere TVB krijgen. | ||
| // Geschreven door Rots61 | // Geschreven door Rots61 | ||
| − | var  | + | var apiTVB = {};   | 
| var catsOnPage = mw.config.get('wgCategories'); | var catsOnPage = mw.config.get('wgCategories'); | ||
| var TVBportalen = []; | var TVBportalen = []; | ||
| var hoofdportalen = {}; | var hoofdportalen = {}; | ||
| + | |||
| + | |||
| + | |||
| + | // HIERONDER BEWERKEN | ||
| + | |||
| + | |||
| + | |||
| // Het hoofdportaal wordt niet getoond als een onderportaal dit heeft.  ["HOOFDPORTAAL"] = ["ONDERPORTAAL", "ONDERPORTAAL2"] | // Het hoofdportaal wordt niet getoond als een onderportaal dit heeft.  ["HOOFDPORTAAL"] = ["ONDERPORTAAL", "ONDERPORTAAL2"] | ||
| − | hoofdportalen["Nederland"] = ["Groningen (provincie)", "Friesland", "Gelderland", "Drenthe", "Flevoland", "Zuid-Holland", "Zeeland", "Noord-Holland", "Noord- | + | // Het is ook mogelijk om meerdere lagen toe te voegen. Voorbeeld: WikiKidsAtlas -> Europa -> Nederland -> Friesland.  | 
| + | |||
| + | hoofdportalen["Nederland"] = ["Groningen (provincie)", "Friesland", "Gelderland", "Drenthe", "Flevoland", "Zuid-Holland", "Zeeland", "Noord-Holland", "Noord-Brabant", "Limburg (Nederland)", "Utrecht (provincie)", "Overijssel"]; | ||
| hoofdportalen["België"] = ["Vlaanderen", "Wallonië"]; | hoofdportalen["België"] = ["Vlaanderen", "Wallonië"]; | ||
| hoofdportalen["Oceanië"] = ["Australië", "Nieuw-Zeeland"]; | hoofdportalen["Oceanië"] = ["Australië", "Nieuw-Zeeland"]; | ||
| − | hoofdportalen["Europa"] = ["Griekse Oudheid", "Nederland", "België", "Frankrijk", "Denemarken", "Duitsland", "Griekenland", "Italië", "Luxemburg", "Oekraïne", "Oostenrijk", "Rusland", "Spanje", "Turkije", "Verenigd Koninkrijk", "Zweden", "Zwitserland", "Groningen (provincie)", "Friesland", "Gelderland", "Drenthe", "Flevoland", "Zuid-Holland", "Zeeland", "Noord-Holland", "Noord-Braband", "Limburg", "Utrecht (provincie)", "Overijssel", "Vlaanderen", "Wallonië"]; | + | hoofdportalen["Europa"] = ["Romeinse Oudheid" ,"Griekse Oudheid", "Nederland", "België", "Frankrijk", "Denemarken", "Duitsland", "Griekenland", "Italië", "Luxemburg", "Oekraïne", "Oostenrijk", "Rusland", "Spanje", "Turkije", "Verenigd Koninkrijk", "Zweden", "Zwitserland", "Groningen (provincie)", "Friesland", "Gelderland", "Drenthe", "Flevoland", "Zuid-Holland", "Zeeland", "Noord-Holland", "Noord-Braband", "Limburg", "Utrecht (provincie)", "Overijssel", "Vlaanderen", "Wallonië"]; | 
| hoofdportalen["Azië"] = ["China", "Japan", "Turkije", "Rusland", "Israël", "Filipijnen"]; | hoofdportalen["Azië"] = ["China", "Japan", "Turkije", "Rusland", "Israël", "Filipijnen"]; | ||
| hoofdportalen["Afrika"] = ["Egypte", "Israël"]; | hoofdportalen["Afrika"] = ["Egypte", "Israël"]; | ||
| hoofdportalen["Noord-Amerika"] = ["Mexico", "Verenigde Staten", "Canada"]; | hoofdportalen["Noord-Amerika"] = ["Mexico", "Verenigde Staten", "Canada"]; | ||
| − | hoofdportalen["WikiKidsAtlas"] = ["Nederland", "België", "Frankrijk", "Denemarken", "Duitsland", "Griekenland", "Italië", "Luxemburg", "Oekraïne", "Oostenrijk", "Rusland", "Spanje", "Turkije", "Verenigd Koninkrijk", "Zweden", "Zwitserland", "Groningen (provincie)", "Friesland", "Gelderland", "Drenthe", "Flevoland", "Zuid-Holland", "Zeeland", "Noord-Holland", "Noord-Braband", "Limburg", "Utrecht (provincie)", "Overijssel", "Vlaanderen", "Wallonië", "China", "Japan", "Turkije", "Rusland", "Israël", "Filipijnen", "Egypte", "Mexico", "Verenigde Staten", "Canada"]; //Alle portalen eronder, als het goed is.   | + | hoofdportalen["Zuid-Amerika"] = ["Brazilië"]; | 
| − | hoofdportalen["Geschiedenis"] = ["Amerikaanse Burgeroorlog", "Eerste Wereldoorlog", "Egyptische Oudheid", "Franse Tijd", "Gouden Eeuw", "Middeleeuwen", "Oudheid", "Prehistorie", "Renaissance", "Romeinse Oudheid", "Van 1945 tot nu", "Griekse Oudheid", "Industriële Revolutie"]; | + | hoofdportalen["WikiKidsAtlas"] = ["Zuid-Amerika", "Noord-Amerika", "Afrika", "Azië", "Europa", "Oceanië", "Nederland", "België", "Frankrijk", "Denemarken", "Duitsland", "Griekenland", "Italië", "Luxemburg", "Oekraïne", "Oostenrijk", "Rusland", "Spanje", "Turkije", "Verenigd Koninkrijk", "Zweden", "Zwitserland", "Groningen (provincie)", "Friesland", "Gelderland", "Drenthe", "Flevoland", "Zuid-Holland", "Zeeland", "Noord-Holland", "Noord-Braband", "Limburg", "Utrecht (provincie)", "Overijssel", "Vlaanderen", "Wallonië", "China", "Japan", "Turkije", "Rusland", "Israël", "Filipijnen", "Egypte", "Mexico", "Verenigde Staten", "Canada", "Brazilië"]; //Alle portalen eronder, als het goed is.   | 
| − | hoofdportalen["Wetenschap"] = ["Wiskunde", "Natuurkunde", "Scheikunde", "Biologie", "Coronavirus", "Menselijk lichaam", "Dierentuinen"]; | + | hoofdportalen["Geschiedenis"] = ["Amerikaanse Burgeroorlog", "Eerste Wereldoorlog", "Egyptische Oudheid", "Franse Tijd", "Gouden Eeuw", "Middeleeuwen", "Oudheid", "Prehistorie", "Renaissance", "Romeinse Oudheid", "Van 1945 tot nu", "Griekse Oudheid", "Industriële Revolutie", "Interbellum", "Tweede Wereldoorlog"]; | 
| + | hoofdportalen["Wetenschap"] = ["Wiskunde", "Natuurkunde", "Scheikunde", "Biologie", "Coronavirus", "Menselijk lichaam", "Dierentuinen", "Dieren", "Heelal en astronomie"]; | ||
| hoofdportalen["Verkeer & Vervoer"] = ["Openbaar vervoer", "Ruimtevaart", "Binnen- en zeevaart", "Luchtvaart"]; | hoofdportalen["Verkeer & Vervoer"] = ["Openbaar vervoer", "Ruimtevaart", "Binnen- en zeevaart", "Luchtvaart"]; | ||
| − | hoofdportalen["Biologie"] = ["Coronavirus", "Menselijk lichaam", "Dierentuinen"]; | + | hoofdportalen["Biologie"] = ["Coronavirus", "Menselijk lichaam", "Dierentuinen", "Dieren"]; | 
| − | hoofdportalen["Politiek"] = ["Republiek", "Monarchie" | + | hoofdportalen["Politiek"] = ["Republiek", "Monarchie", "Dictatuur"]; | 
| − | |||
| hoofdportalen["Godsdienst"] = ['Islam', 'Christendom']; | hoofdportalen["Godsdienst"] = ['Islam', 'Christendom']; | ||
| hoofdportalen["Oudheid"] = ["Griekse Oudheid", "Romeinse Oudheid", "Egyptische Oudheid"]; | hoofdportalen["Oudheid"] = ["Griekse Oudheid", "Romeinse Oudheid", "Egyptische Oudheid"]; | ||
| hoofdportalen["Griekenland"] = ["Griekse Oudheid"]; | hoofdportalen["Griekenland"] = ["Griekse Oudheid"]; | ||
| + | hoofdportalen["Kunst & Cultuur"] = ["Muziek", "Architectuur", "Literatuur", "Theater", "Film", "Harry Potter", "Subcultuur"]; | ||
| + | hoofdportalen["Informatietechnologie (IT)"] = ['Videogames']; | ||
| + | |||
| + | |||
| + | // Alle portalen die alleen worden getoond als ze het enige portaal van de pagina zijn. Dit om ervoor te zorgen dat deze niet te vaak voorkomen. | ||
| + | // Dit kun je dus zien als een hoofdportaal die alles onder zich heeft. | ||
| + | // Als alle portalen van het artikel hieronder staan, wordt de volgorde aangehouden die hier staat, en wordt alleen de laatste getoond.   | ||
| + | var TVBalsenige = ['Woordenschat', 'Maatschappij', 'Beroepen']; | ||
| + | |||
| + | //einde definities, hieronder niets aanpassen (tenzij je precies weet wat je doet).  | ||
| + | |||
| + | |||
| + | |||
| + | // HIERBOVEN BLIJVEN | ||
| + | |||
| − | |||
| function TVBstart0() { | function TVBstart0() { | ||
| − | + |      apiTVB['randomstingasd4'] = new mw.Api(); | |
| − | |||
|      var temp; |      var temp; | ||
|      if (catsOnPage.includes('WikiKids:Geen TVB') || catsOnPage.includes('Wikikids:Doorverwijspagina') || mw.config.get('wgArticleId') === 1) { |      if (catsOnPage.includes('WikiKids:Geen TVB') || catsOnPage.includes('Wikikids:Doorverwijspagina') || mw.config.get('wgArticleId') === 1) { | ||
| Regel 43: | Regel 66: | ||
| 			} else { | 			} else { | ||
| 			    for (var x = 0; x < catsOnPage.length; x++) { | 			    for (var x = 0; x < catsOnPage.length; x++) { | ||
| − | + | 			    	apiTVB[x] = new mw.Api(); | |
| 			    	TVBgetPageCountPT(x, "Categorie:" + catsOnPage[x]); | 			    	TVBgetPageCountPT(x, "Categorie:" + catsOnPage[x]); | ||
| 			    } | 			    } | ||
| Regel 49: | Regel 72: | ||
|      	} else { |      	} else { | ||
| 		    for (var e = 0; e < catsOnPage.length; e++) { | 		    for (var e = 0; e < catsOnPage.length; e++) { | ||
| − | + | 		    	apiTVB[e] = new mw.Api(); | |
| 		    	TVBgetPageCountPT(e, "Categorie:" + catsOnPage[e]); | 		    	TVBgetPageCountPT(e, "Categorie:" + catsOnPage[e]); | ||
| 		    } | 		    } | ||
| Regel 57: | Regel 80: | ||
| function TVBgetPageCountPT(apinr, pageName) { | function TVBgetPageCountPT(apinr, pageName) { | ||
| − | + |      apiTVB[apinr].get({ | |
|          action: "query", |          action: "query", | ||
|          prop: "linkshere", |          prop: "linkshere", | ||
| Regel 70: | Regel 93: | ||
|              var tempgetal = 0; |              var tempgetal = 0; | ||
|              while (temp[tempgetal]) { |              while (temp[tempgetal]) { | ||
| − |                  if (temp[tempgetal]["title"].startsWith(" | + |                  if (temp[tempgetal]["title"].startsWith("Wikikids:TVB/Portalen")) { | 
|                      TVBportalen.push(temp[tempgetal]["title"].split("/Portalen/").pop()); |                      TVBportalen.push(temp[tempgetal]["title"].split("/Portalen/").pop()); | ||
|                  } |                  } | ||
|                  tempgetal += 1; |                  tempgetal += 1; | ||
|              } |              } | ||
| − | |||
|              if ((apinr + 1) == catsOnPage.length) { |              if ((apinr + 1) == catsOnPage.length) { | ||
|              	loadBoxes(pageName); |              	loadBoxes(pageName); | ||
|              } else if (apinr === 1 && mw.config.get('wgNamespaceNumber') === 14) { |              } else if (apinr === 1 && mw.config.get('wgNamespaceNumber') === 14) { | ||
|              	loadBoxes(pageName); |              	loadBoxes(pageName); | ||
| − |              } else if (mw.config.get('wgPageName').startsWith(" | + |              } else if (mw.config.get('wgPageName').startsWith("Wikikids:TVB/Portalen/")) { | 
|              	loadBoxes(pageName); |              	loadBoxes(pageName); | ||
|              } |              } | ||
| Regel 88: | Regel 110: | ||
|              } else if (apinr === 1 && mw.config.get('wgNamespaceNumber') === 14) { |              } else if (apinr === 1 && mw.config.get('wgNamespaceNumber') === 14) { | ||
|              	loadBoxes(pageName); |              	loadBoxes(pageName); | ||
| − |              } else if (mw.config.get('wgPageName').startsWith(" | + |              } else if (mw.config.get('wgPageName').startsWith("Wikikids:TVB/Portalen/")) { | 
|              	loadBoxes(pageName); |              	loadBoxes(pageName); | ||
|              } |              } | ||
| Regel 100: | Regel 122: | ||
| 	var wikitekstTVB = "{{TVB|"; | 	var wikitekstTVB = "{{TVB|"; | ||
|      if (TVBportalen.length !== 0) { |      if (TVBportalen.length !== 0) { | ||
| − | |||
| 		TVBportalen = TVBportalen.filter(function(item, pos, self) { | 		TVBportalen = TVBportalen.filter(function(item, pos, self) { | ||
| 		    return self.indexOf(item) == pos; | 		    return self.indexOf(item) == pos; | ||
| 		}); | 		}); | ||
| − | + | 		console.log(TVBportalen); | |
| − | + | 		for (var g = 0; g < TVBalsenige.length; g++) { | |
| − | + | 			if (TVBportalen.length > 1 && TVBportalen.includes(TVBalsenige[g])) { | |
| − | + | 				TVBportalen.splice(TVBportalen.indexOf(TVBalsenige[g]), 1); | |
| − | + | 			} | |
| 		} | 		} | ||
| 		for (const property in hoofdportalen) { | 		for (const property in hoofdportalen) { | ||
| Regel 128: | Regel 149: | ||
| 	wikitekstTVB += 'w=' + bodyContentWidthX + '}}'; | 	wikitekstTVB += 'w=' + bodyContentWidthX + '}}'; | ||
| 	console.log(wikitekstTVB); | 	console.log(wikitekstTVB); | ||
| − | 	if (mw.config.get('wgPageName').startsWith(" | + | 	if (mw.config.get('wgPageName').startsWith("Wikikids:TVB/Portalen/")) { | 
| 		document.getElementById(pageName).outerHTML = wikitekstTVB;   | 		document.getElementById(pageName).outerHTML = wikitekstTVB;   | ||
| 		TVBportalen = []; | 		TVBportalen = []; | ||
| Regel 138: | Regel 159: | ||
| 		    contentmodel: 'wikitext', | 		    contentmodel: 'wikitext', | ||
| 		} ).done( function ( query ) { | 		} ).done( function ( query ) { | ||
| − | 		    document.getElementById(' | + | 		    document.getElementById('TerugVerwijsBox').innerHTML += query.parse.text['*']; | 
| 		}); | 		}); | ||
| 	} | 	} | ||
| 	}, 250); | 	}, 250); | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| } | } | ||
| function TVBstartOverzichtPagina(cat) { | function TVBstartOverzichtPagina(cat) { | ||
| − | + | 	apiTVB[cat] = new mw.Api(); | |
| 	TVBgetPageCountPT(cat, cat); | 	TVBgetPageCountPT(cat, cat); | ||
| } | } | ||
| function TVBstartCats() { | function TVBstartCats() { | ||
| − | + | 	apiTVB[1] = new mw.Api(); | |
| 	TVBgetPageCountPT(1, "Categorie:" + mw.config.get('wgTitle')); | 	TVBgetPageCountPT(1, "Categorie:" + mw.config.get('wgTitle')); | ||
| } | } | ||
| if (mw.config.get('wgNamespaceNumber') === 0 && mw.config.get('wgAction') === 'view') { | if (mw.config.get('wgNamespaceNumber') === 0 && mw.config.get('wgAction') === 'view') { | ||
| − | 	document.getElementById('mw-content-text'). | + | 	div = document.createElement('div'); | 
| + | 	div.id = 'TerugVerwijsBox'; | ||
| + | 	document.getElementById('mw-content-text').after(div); | ||
| 	TVBstart0(); | 	TVBstart0(); | ||
| } else if (mw.config.get('wgNamespaceNumber') === 14 && mw.config.get('wgAction') === 'view') { | } else if (mw.config.get('wgNamespaceNumber') === 14 && mw.config.get('wgAction') === 'view') { | ||
| − | 	document.getElementById('mw-content-text'). | + | 	div = document.createElement('div'); | 
| + | 	div.id = 'TerugVerwijsBox'; | ||
| + | 	document.getElementById('mw-content-text').after(div); | ||
| 	TVBstartCats(); | 	TVBstartCats(); | ||
| − | |||
| − | |||
| } | } | ||
Huidige versie van 10 okt 2025 om 08:02
/* jshint sub:true maxerr:100000 */
// Dit script heeft invloed op heel WikiKids, alle gebruikers.  
// Script dat ervoor zorgt dat alle pagina's met een categorie die bij een portaal hoort, automatisch een of meerdere TVB krijgen.
// Geschreven door Rots61
var apiTVB = {}; 
var catsOnPage = mw.config.get('wgCategories');
var TVBportalen = [];
var hoofdportalen = {};
// HIERONDER BEWERKEN
// Het hoofdportaal wordt niet getoond als een onderportaal dit heeft.  ["HOOFDPORTAAL"] = ["ONDERPORTAAL", "ONDERPORTAAL2"]
// Het is ook mogelijk om meerdere lagen toe te voegen. Voorbeeld: WikiKidsAtlas -> Europa -> Nederland -> Friesland. 
hoofdportalen["Nederland"] = ["Groningen (provincie)", "Friesland", "Gelderland", "Drenthe", "Flevoland", "Zuid-Holland", "Zeeland", "Noord-Holland", "Noord-Brabant", "Limburg (Nederland)", "Utrecht (provincie)", "Overijssel"];
hoofdportalen["België"] = ["Vlaanderen", "Wallonië"];
hoofdportalen["Oceanië"] = ["Australië", "Nieuw-Zeeland"];
hoofdportalen["Europa"] = ["Romeinse Oudheid" ,"Griekse Oudheid", "Nederland", "België", "Frankrijk", "Denemarken", "Duitsland", "Griekenland", "Italië", "Luxemburg", "Oekraïne", "Oostenrijk", "Rusland", "Spanje", "Turkije", "Verenigd Koninkrijk", "Zweden", "Zwitserland", "Groningen (provincie)", "Friesland", "Gelderland", "Drenthe", "Flevoland", "Zuid-Holland", "Zeeland", "Noord-Holland", "Noord-Braband", "Limburg", "Utrecht (provincie)", "Overijssel", "Vlaanderen", "Wallonië"];
hoofdportalen["Azië"] = ["China", "Japan", "Turkije", "Rusland", "Israël", "Filipijnen"];
hoofdportalen["Afrika"] = ["Egypte", "Israël"];
hoofdportalen["Noord-Amerika"] = ["Mexico", "Verenigde Staten", "Canada"];
hoofdportalen["Zuid-Amerika"] = ["Brazilië"];
hoofdportalen["WikiKidsAtlas"] = ["Zuid-Amerika", "Noord-Amerika", "Afrika", "Azië", "Europa", "Oceanië", "Nederland", "België", "Frankrijk", "Denemarken", "Duitsland", "Griekenland", "Italië", "Luxemburg", "Oekraïne", "Oostenrijk", "Rusland", "Spanje", "Turkije", "Verenigd Koninkrijk", "Zweden", "Zwitserland", "Groningen (provincie)", "Friesland", "Gelderland", "Drenthe", "Flevoland", "Zuid-Holland", "Zeeland", "Noord-Holland", "Noord-Braband", "Limburg", "Utrecht (provincie)", "Overijssel", "Vlaanderen", "Wallonië", "China", "Japan", "Turkije", "Rusland", "Israël", "Filipijnen", "Egypte", "Mexico", "Verenigde Staten", "Canada", "Brazilië"]; //Alle portalen eronder, als het goed is. 
hoofdportalen["Geschiedenis"] = ["Amerikaanse Burgeroorlog", "Eerste Wereldoorlog", "Egyptische Oudheid", "Franse Tijd", "Gouden Eeuw", "Middeleeuwen", "Oudheid", "Prehistorie", "Renaissance", "Romeinse Oudheid", "Van 1945 tot nu", "Griekse Oudheid", "Industriële Revolutie", "Interbellum", "Tweede Wereldoorlog"];
hoofdportalen["Wetenschap"] = ["Wiskunde", "Natuurkunde", "Scheikunde", "Biologie", "Coronavirus", "Menselijk lichaam", "Dierentuinen", "Dieren", "Heelal en astronomie"];
hoofdportalen["Verkeer & Vervoer"] = ["Openbaar vervoer", "Ruimtevaart", "Binnen- en zeevaart", "Luchtvaart"];
hoofdportalen["Biologie"] = ["Coronavirus", "Menselijk lichaam", "Dierentuinen", "Dieren"];
hoofdportalen["Politiek"] = ["Republiek", "Monarchie", "Dictatuur"];
hoofdportalen["Godsdienst"] = ['Islam', 'Christendom'];
hoofdportalen["Oudheid"] = ["Griekse Oudheid", "Romeinse Oudheid", "Egyptische Oudheid"];
hoofdportalen["Griekenland"] = ["Griekse Oudheid"];
hoofdportalen["Kunst & Cultuur"] = ["Muziek", "Architectuur", "Literatuur", "Theater", "Film", "Harry Potter", "Subcultuur"];
hoofdportalen["Informatietechnologie (IT)"] = ['Videogames'];
// Alle portalen die alleen worden getoond als ze het enige portaal van de pagina zijn. Dit om ervoor te zorgen dat deze niet te vaak voorkomen.
// Dit kun je dus zien als een hoofdportaal die alles onder zich heeft.
// Als alle portalen van het artikel hieronder staan, wordt de volgorde aangehouden die hier staat, en wordt alleen de laatste getoond.  
var TVBalsenige = ['Woordenschat', 'Maatschappij', 'Beroepen'];
//einde definities, hieronder niets aanpassen (tenzij je precies weet wat je doet). 
// HIERBOVEN BLIJVEN
function TVBstart0() {
    apiTVB['randomstingasd4'] = new mw.Api();
    var temp;
    if (catsOnPage.includes('WikiKids:Geen TVB') || catsOnPage.includes('Wikikids:Doorverwijspagina') || mw.config.get('wgArticleId') === 1) {
    } else {
    	if (catsOnPage.includes('Woordenschat') && catsOnPage.length === 1) {
    		TVBportalen.push('Woordenschat');
			loadBoxes();
    	} else if (catsOnPage.includes('Woordenschat') && catsOnPage.length === 2 ) {
			if (catsOnPage.includes('Basiswoordenlijstgroep8') || (catsOnPage.includes('Basiswoordenlijstgroep7') || (catsOnPage.includes('Basiswoordenlijstgroep6') || ( catsOnPage.includes('Basiswoordenlijstgroep5') || (catsOnPage.includes('Basiswoordenlijstgroep4') || (catsOnPage.includes('Basiswoordenlijstgroep3') || (catsOnPage.includes('Basiswoordenlijstgroep2') ||  catsOnPage.includes('Basiswoordenlijstgroep1')))))))) {
				TVBportalen.push('Woordenschat');
				loadBoxes();
			} else {
			    for (var x = 0; x < catsOnPage.length; x++) {
			    	apiTVB[x] = new mw.Api();
			    	TVBgetPageCountPT(x, "Categorie:" + catsOnPage[x]);
			    }
			}
    	} else {
		    for (var e = 0; e < catsOnPage.length; e++) {
		    	apiTVB[e] = new mw.Api();
		    	TVBgetPageCountPT(e, "Categorie:" + catsOnPage[e]);
		    }
    	}
    }
}
function TVBgetPageCountPT(apinr, pageName) {
    apiTVB[apinr].get({
        action: "query",
        prop: "linkshere",
        titles: pageName,
        lhlimit: "100",
    }).then(function (data) {
        temp = data.query.pages;
        for (const property in temp) {
        	temp = temp[property].linkshere;
        }
        if (typeof temp !== 'undefined') {
            var tempgetal = 0;
            while (temp[tempgetal]) {
                if (temp[tempgetal]["title"].startsWith("Wikikids:TVB/Portalen")) {
                    TVBportalen.push(temp[tempgetal]["title"].split("/Portalen/").pop());
                }
                tempgetal += 1;
            }
            if ((apinr + 1) == catsOnPage.length) {
            	loadBoxes(pageName);
            } else if (apinr === 1 && mw.config.get('wgNamespaceNumber') === 14) {
            	loadBoxes(pageName);
            } else if (mw.config.get('wgPageName').startsWith("Wikikids:TVB/Portalen/")) {
            	loadBoxes(pageName);
            }
        } else {
        	if (apinr + 1 === catsOnPage.length) {
            	loadBoxes(pageName);
            } else if (apinr === 1 && mw.config.get('wgNamespaceNumber') === 14) {
            	loadBoxes(pageName);
            } else if (mw.config.get('wgPageName').startsWith("Wikikids:TVB/Portalen/")) {
            	loadBoxes(pageName);
            }
        }
        
    });
}
function loadBoxes(pageName) {
	setTimeout(function() {
	var wikitekstTVB = "{{TVB|";
    if (TVBportalen.length !== 0) {
		TVBportalen = TVBportalen.filter(function(item, pos, self) {
		    return self.indexOf(item) == pos;
		});
		console.log(TVBportalen);
		for (var g = 0; g < TVBalsenige.length; g++) {
			if (TVBportalen.length > 1 && TVBportalen.includes(TVBalsenige[g])) {
				TVBportalen.splice(TVBportalen.indexOf(TVBalsenige[g]), 1);
			}
		}
		for (const property in hoofdportalen) {
			if (TVBportalen.includes(property)) {
				for (var a = 0; a < hoofdportalen[property].length; a++) {
					if (TVBportalen.includes(hoofdportalen[property][a])) {
						if (TVBportalen.includes(property)) {
							TVBportalen.splice(TVBportalen.indexOf(property), 1);
						}
					}
				}
			}
		}
		for (var y = 0; y < TVBportalen.length; y++) { 
			wikitekstTVB += TVBportalen[y] + '|';
		}
	}
	bodyContentWidthX = document.getElementById('bodyContent').offsetWidth;
	wikitekstTVB += 'w=' + bodyContentWidthX + '}}';
	console.log(wikitekstTVB);
	if (mw.config.get('wgPageName').startsWith("Wikikids:TVB/Portalen/")) {
		document.getElementById(pageName).outerHTML = wikitekstTVB; 
		TVBportalen = [];
	} else {
		api.get( {
		    action: 'parse',
		    text: wikitekstTVB,
		    titles: mw.config.get('wgTitle'),
		    contentmodel: 'wikitext',
		} ).done( function ( query ) {
		    document.getElementById('TerugVerwijsBox').innerHTML += query.parse.text['*'];
		});
	}
	}, 250);
}
function TVBstartOverzichtPagina(cat) {
	apiTVB[cat] = new mw.Api();
	TVBgetPageCountPT(cat, cat);
}
function TVBstartCats() {
	apiTVB[1] = new mw.Api();
	TVBgetPageCountPT(1, "Categorie:" + mw.config.get('wgTitle'));
}
if (mw.config.get('wgNamespaceNumber') === 0 && mw.config.get('wgAction') === 'view') {
	div = document.createElement('div');
	div.id = 'TerugVerwijsBox';
	document.getElementById('mw-content-text').after(div);
	TVBstart0();
} else if (mw.config.get('wgNamespaceNumber') === 14 && mw.config.get('wgAction') === 'view') {
	div = document.createElement('div');
	div.id = 'TerugVerwijsBox';
	document.getElementById('mw-content-text').after(div);
	TVBstartCats();
}