„Benutzer:Midas02/Zeusmode/qtemplate2.js“ – Versionsunterschied

aus Wikipedia, der freien Enzyklopädie
Zur Navigation springen Zur Suche springen
Inhalt gelöscht Inhalt hinzugefügt
KKeine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 1.203: Zeile 1.203:
var dab = document.getElementById('t-dab');
var dab = document.getElementById('t-dab');
if (dab) dab.innerHTML = 'Bezig met zoeken...';
if (dab) dab.innerHTML = 'Bezig met zoeken...';
var url = wgScriptPath + '/api.php?maxage=86400&smaxage=86400&action=query&prop=links&pllimit=500&tlnamespace=10&indexpageids&format=json&callback=findDABsCB&titles=Benutzer:Midas02/Zeusmode/Disambiguationspage';
var url = wgScriptPath + '/api.php?maxage=86400&smaxage=86400&action=query&rawcontinue=&prop=links&pllimit=500&tlnamespace=10&indexpageids&format=json&callback=findDABsCB&titles=Benutzer:Midas02/Zeusmode/Disambiguationspage';
importScriptURI(url);
importScriptURI(url);
}
}
Zeile 1.218: Zeile 1.218:


function findDABsQuery(qcont) {
function findDABsQuery(qcont) {
var url = wgScriptPath + '/api.php?maxage=300&smaxage=300&action=query&redirects&generator=links&gpllimit=500&prop=templates&tllimit=500&indexpageids&format=json&callback=findDABlinksCB&titles=' + encodeURIComponent(wgPageName);
var url = wgScriptPath + '/api.php?maxage=300&smaxage=300&action=query&rawcontinue=&redirects&generator=links&gpllimit=500&prop=templates&tllimit=500&indexpageids&format=json&callback=findDABlinksCB&titles=' + encodeURIComponent(wgPageName);
if(qcont) url += '&tlcontinue=' + encodeURIComponent(qcont)
if(qcont) url += '&tlcontinue=' + encodeURIComponent(qcont)
importScriptURI(url);
importScriptURI(url);

Version vom 7. Juli 2015, 01:06 Uhr

//<nowiki><pre>

//------------------------------------------------------
//quickTemplate from [[User:Zanaq/Zeusmode]]
//(c) 2006-2010 Zanaq, released under GPL 
//------------------------------------------------------

function findInArray2(elements2, searchString2, caseSensitive2)
{
 elementString2=elements2.toSource().toUpperCase();
 a2=elementString2.indexOf(searchString2.toUpperCase());
 if (a2==-1) return(-1);
 
 b2=elementString2.substring(a2+1).match(/, "/g);
 if (!b2) return(elements2.length-1);
 
 return(elements2.length - b2.length - 1);
 
}



templateLanguage=wgServer.substring(7, wgServer.indexOf('.'));

var qTemplate = new Array();
var qPos = new Array();
var qCategory = new Array();
var qTemplateText = new Array();
var qPrompt = new Array();
var qDisplayText = new Array();
var qDefault = new Array();
var dontusesquirlyBrackets = new Array();
var qAdvancedParameters = new Array();
var qHidden = new Array;
var qCustomTemplateIdentifier = new Array();
var qSection = new Array;
var qOptions = new Array;
var qWidth = new Array;
var k = 0;

var regexpBO = new Array();
var regexpBC = new Array();
var bracketsOpen = new Array();
var bracketsClose = new Array();

var lastTemplate;
var templateReason;
vandalizedPage=getPreviousPage().replace(/_/g, ' ');

var drawnTheTemplateBar = 0;

if (zmUseLocalTemplates)
{

//<nowiki><pre>
/*-------------------------------------------------------------------------
//Nederlandstalige sjabloondefinities voor [[Gebruiker:Zanaq/Zeusmodus]]
-------------------------------------------------------------------------*/
d=new Date(); d=d.getFullYear() + '!!!' +  (((d.getMonth()+1) < 10) ? '0' : '') + (d.getMonth()+1) + '!!!' + ((d.getDate() < 10) ? '0' : '')+ d.getDate();

if (wgPageName.substring(0,23) == 'Wikipedia:Te_beoordelen')
{

  //addDeletionNominationTemplate();
  if (lastTemplate)  { qTemplate[++k] = lastTemplate + 'nominatie ' + vandalizedPage     ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Werk in uitvoering' ;qTemplateText[k] = '$1\n*[[:'+ vandalizedPage +']] - ' + lastTemplate + ' - $2 ~~~~';qPrompt[k] = 'tekst voor de nominatie';dontusesquirlyBrackets[k]=1;qSection[k]='lastfilled'; qDefault[k]=templateReason};
  if (vandalizedPage){ qTemplate[++k] =  'Verwijdernominatie ' + vandalizedPage     ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Werk in uitvoering' ;qTemplateText[k] = '$1\n*[[:'+ vandalizedPage +']] - $2 ~~~~';qPrompt[k] = 'tekst voor de nominatie';dontusesquirlyBrackets[k]=1;qSection[k]='lastfilled'; }
  qTemplate[++k] = 'Verwijdernominatie'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Werk in uitvoering' ;qTemplateText[k] = '$1\n* $2 ~~~~';qPrompt[k] = 'tekst voor de nominatie';dontusesquirlyBrackets[k]=1;qSection[k]='lastfilled';
//qCustomTemplateIdentifier[0] = k;

} else if ( wgCanonicalNamespace == "User_talk")
     {

    //     if (!document.location.href.match(/.+\:\d+\.\d+\.\d+\.\d+/)) { //ano's

    qTemplate[++k] = 'welkomstbericht'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ; qTemplateText[k] = '{{hola}}\n*$2 ~~~~\n$1';qPrompt[k] = 'commentaar'; qDisplayText[k]='welkom';dontusesquirlyBrackets[k]=1;qDefault[k]= '[[' + vandalizedPage + ']]';

    qTemplate[++k] = 'hola|welkom|wa|welkomstbericht|w|welkomAnoniem' ; qPos[k] ='top'      ;  qCategory[k] = 'en:' + wgPageName ; qDisplayText[k] = 'hola' ;   qHidden[k]=1;

             qTemplate[++k] = '-' ; qPos[k] = '4%';

             qTemplate[++k] = 'ws|waarschuwing'    ; qPos[k] ='top'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ;qDisplayText[k]='ws';


             qTemplate[++k] = 'zb|zandbak|puber|pbr|pb|geklieder'    ; qPos[k] ='top'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ; 

             qTemplate[++k] = 'exlink'    ; qPos[k] ='top'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ;

             qTemplate[++k] = '-' ; qPos[k] = '3%';


             
//             qTemplate[++k] = 'ds zb->ws'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ;qTemplateText[k] = '$1\n# ~~~~~ $2\n#* zb -> ws';qPrompt[k] = 'Aard van het vandalisme?';qDefault[k] = "Vandalisme op ''" +   vandalizedPage + "''" ; qDisplayText[k]='z->w';dontusesquirlyBrackets[k]=1; qAdvancedParameters[k]='&section=0' ; qSection[k]=0;

    if (isSysop != true) {
	     qTemplate[++k] = 'ds'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ; qPrompt[k] = 'Aard van het vandalisme?';qDefault[k] = "Geklieder op pagina ''" +   vandalizedPage + "''" ; qDisplayText[k]='#~~';dontusesquirlyBrackets[k]=1;  qSection[k]=0;
             qOptions[k]=["", "zb->ws", "exlink->ws", "welkom->ws","welkom->zb","welkom->exlink","BLOKVERZOEK!"];
             qTemplateText[k] = ['$1\n# ~~~~~ $2',
                                 '$1\n# ~~~~~ $2\n#* zb -> ws',
                                 '$1\n# ~~~~~ $2\n#* exlink -> ws',
                                 '$1\n# ~~~~~ $2\n#* welkom -> ws',
                                 '$1\n# ~~~~~ $2\n#* welkom -> zb',
                                 '$1\n# ~~~~~ $2\n#* welkom-> exlink',
                                 '$1\n# ~~~~~ $2\n#* blokverzoek',
'$1\n# ~~~~~ $2\n#* $3'];




        } else {
	     qTemplate[++k] = 'ds'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ; qPrompt[k] = 'Aard van het vandalisme?';qDefault[k] = "Geklieder op pagina ''" +   vandalizedPage + "''" ; qDisplayText[k]='#~~';dontusesquirlyBrackets[k]=1;  qSection[k]=0;
             qOptions[k]=["", "zb->ws", "exlink->ws", "welkom->ws","welkom->zb","welkom->exlink","1 dag blok", "3 dagen", "1 week", "2 weken", "3 maanden", "6 maanden", "1 jaar", "2 jaar"];
             qTemplateText[k] = ['$1\n# ~~~~~ $2',
                                 '$1\n# ~~~~~ $2\n#* zb -> ws',
                                 '$1\n# ~~~~~ $2\n#* exlink -> ws',
                                 '$1\n# ~~~~~ $2\n#* welkom -> ws',
                                 '$1\n# ~~~~~ $2\n#* welkom -> zb',
                                 '$1\n# ~~~~~ $2\n#* welkom-> exlink',
                                 '$1\n# ~~~~~ $2\n#* 1 dag geblokkeerd',
                                 '$1\n# ~~~~~ $2\n#* 3 dagen geblokkeerd',
                                 '$1\n# ~~~~~ $2\n#* 1 week geblokkeerd',
                                 '$1\n# ~~~~~ $2\n#* 2 weken geblokkeerd',
                                 '$1\n# ~~~~~ $2\n#* 1 maand geblokkeerd',
                                 '$1\n# ~~~~~ $2\n#* 3 maanden geblokkeerd',
                                 '$1\n# ~~~~~ $2\n#* 6 maanden geblokkeerd',
                                 '$1\n# ~~~~~ $2\n#* 1 jaar geblokkeerd',
                                 '$1\n# ~~~~~ $2\n#* 2 jaar geblokkeerd',
                                 '$1\n# ~~~~~ $2\n#* $3'];

             qTemplate[++k] = 'blok'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ;qTemplateText[k] = '$1\n#* blok - $2';qPrompt[k] = 'bloklengte?';qDefault[k] = '1 dag' ;qDisplayText[k]='blok';dontusesquirlyBrackets[k]=1; qAdvancedParameters[k]='&section=0' ;qSection[k]=0;
        }

    qTemplate[++k] = '-' ; qPos[k] = '3%';


  //           qTemplate[++k] = 'ds wa->zb'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ;qTemplateText[k] = '$1\n# ~~~~~ $2\n#* wa -> zb';qPrompt[k] = 'Aard van het vandalisme?';qDefault[k] = "Geklieder op ''" +   vandalizedPage + "''" ; qDisplayText[k]='wa->zb';dontusesquirlyBrackets[k]=1; qAdvancedParameters[k]='&section=0' ;qHidden[k]=1;qSection[k]=0;
    //         qTemplate[++k] = 'ds wa->ws'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ;qTemplateText[k] = '$1\n# ~~~~~ $2\n#* wa -> ws';qPrompt[k] = 'Aard van het vandalisme?';qDefault[k] = "Vandalisme op ''" +   vandalizedPage + "''" ; qDisplayText[k]='wa->ws';dontusesquirlyBrackets[k]=1; qAdvancedParameters[k]='&section=0' ;qHidden[k]=1;qSection[k]=0;
      //       qTemplate[++k] = 'ds exlink->ws'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ;qTemplateText[k] = '$1\n# ~~~~~ $2\n#* exlink -> ws';qPrompt[k] = 'Aard van het vandalisme?';qDefault[k] = "Vandalisme op ''" +   vandalizedPage + "''" ; qDisplayText[k]='exlink->ws';dontusesquirlyBrackets[k]=1; qAdvancedParameters[k]='&section=0' ;qHidden[k]=1;qSection[k]=0;


             qTemplate[++k] = '-' ; qPos[k] = '5%' ;qHidden[k]=1;

             qTemplate[++k] = 'Nieuw bericht - [[' + vandalizedPage + ']]'   ; qPos[k] ='bottom'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ;qTemplateText[k] = '$1\n==' + vandalizedPage + '==\n$2 ~~~~';qPrompt[k] = 'Nieuw bericht?';qDefault[k] = '[[' + vandalizedPage + ']]'; qDisplayText[k]='+nw'; qHidden[k]=1;dontusesquirlyBrackets[k]=1; 

             qTemplate[++k] = 'vzb'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Sjabloon:vzb' ;qTemplateText[k] = '$1\n==$2==\n{{subst:vzb|$2|' + wgUserName + '}} ~~~~';qPrompt[k] = 'Artikel?';qDefault[k] = vandalizedPage; qHidden[k]=1;

             qTemplate[++k] = 'vvn'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Sjabloon:vvn' ;qTemplateText[k] = '$1\n==' + vandalizedPage + '==\n{{subst:vvn|' + vandalizedPage + '|{{subst:LOCALYEAR}}|{{subst:LOCALMONTH}}|{{subst:LOCALDAY2}}|$2}} ~~~~';qPrompt[k] = 'Reden? (De reden wordt tussengevoegd: maak daarom een complete zin.)';qDefault[k] = ''; qHidden[k]=1;

      if (isSysop == true)
     {
             qTemplate[++k] = 'vvn2'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Sjabloon:vvn2' ;qTemplateText[k] = '$1\n==$2==\n{{subst:vvn2|$2}} ~~~~';qPrompt[k] = 'Artikel?';qDefault[k] = vandalizedPage; qHidden[k]=1;
     }
             qTemplate[++k] = 'ls2'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Sjabloon:ls2' ;qTemplateText[k] = '$1\n==Externe links op $2==\n{{subst:ls2|$2}} ~~~~';qPrompt[k] = 'Artikel?';qDefault[k] =  vandalizedPage ; qDisplayText[k]='ls2'; qHidden[k]=1;

/*
             qTemplate[++k] = 'eenedit'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'Sjabloon:eenedit' ;qTemplateText[k] = '$1\n==$2==\n{{eenedit|$2}} ~~~~';qPrompt[k] = 'Artikel?';qDefault[k] = vandalizedPage; qDisplayText[k]='subst:1edit'; qHidden[k]=1;

             qTemplate[++k] = 'Aut'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'GFDL' ;qTemplateText[k] = '$1\n==Auteursrechtenschending ' + vandalizedPage + '==\n{{Gebruiker:Zanaq/Aut|' + vandalizedPage + '|$2}} ~~~~';qPrompt[k] = 'Meer problemen?';qDefault[k] = 'Daarnaast heeft de tekst een niet-encyclopedische stijl.'; qDisplayText[k]='Aut'; qHidden[k]=1;

             qTemplate[++k] = 'GFDL'    ; qPos[k] ='bottom'      ;  qCategory[k] = 'GFDL' ;qTemplateText[k] = '$1\n==Auteursrechtenschending ' + vandalizedPage + '==\n{{Gebruiker:Zanaq/GFDL|' + vandalizedPage + '|$2}} ~~~~';qPrompt[k] = 'Welke wikipedia?';qDefault[k] = 'Engelse'; qDisplayText[k]='GFDL'; qHidden[k]=1;
*/
             qTemplate[++k] = '-' ; qPos[k] = '5%' ;qHidden[k]=1;


} else if (wgCanonicalNamespace == "") {

/*    qTemplate[++k] = 'wikify'    ; qPos[k] ='top'      ;  qCategory[k] = 'Categorie:Wikipedia:Wikificatie_nodig' ;

    qTemplate[++k] = '-' ; qPos[k] = '2%';
*/
qTemplate[++k] = 'nocat!!!!!!' + d + '|nocat|xnocat';qDisplayText[k]='nocat';qCategory[k] = 'Categorie:Wikipedia:Nog te categoriseren' ; qPos[k]='bottom';

    qTemplate[++k] = 'beg|beginnetje|xbeg'; qPos[k] ='bottom'   ;  qCategory[k] = 'Categorie:Wikipedia:Beginnetje' ;
    qOptions[k]=["",
"geografie",
"landen & volken",
"steden",
"geschiedenis",
"middeleeuwen",
"nieuwste tijd",
"oudheid",
"kunst & cultuur",
"muziek",
"mens & maatschappij",
"dagelijks leven",
"economie",
"film",
"landbouw",
"media",
"politiek",
"religie",
"sport",
"voetbal",
"taal",
"literatuur",
"wetenschap & technologie",
"aardwetenschappen",
"astronomie",
"biologie",
"filosofie",
"geneeskunde",
"informatica",
"natuurkunde",
"scheikunde",
"wiskunde",
"verkeer & vervoer",
"openbaar vervoer"];

    qTemplate[++k] = '-' ; qPos[k] = '2%';

    qTemplate[++k] = 'wb!!!!!!' + d + '|wb'   ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Woordenboekdefinitie' ;qDisplayText[k] = 'wb' ;
    qTemplate[++k] = 'wiu'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Nog niet gereed' ;qTemplateText[k] = '{{wiu|1=$2|2={{subst:LOCALYEAR}}|3={{subst:LOCALMONTH}}|4={{subst:LOCALDAY2}}}}\n$1';qPrompt[k] = 'commentaar'
    qTemplate[++k] = 'auteur'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Auteur' ;qTemplateText[k] = '{{auteur|1=$2|2={{subst:LOCALYEAR}}|3={{subst:LOCALMONTH}}|4={{subst:LOCALDAY2}}}}\n$1';qPrompt[k] = 'commentaar (url)'; 
    qTemplate[++k] = 'reclame!!!!!!' + d + '|reclame|xreclame'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Weg';qDisplayText[k] = 'reclame' ;

    qTemplate[++k] = '-' ; qPos[k] = '2%';

    qTemplate[++k] = 'weg'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Weg' ;qTemplateText[k] = '{{weg|1=$2|2={{subst:LOCALYEAR}}|3={{subst:LOCALMONTH}}|4={{subst:LOCALDAY2}}}}\n$1';qPrompt[k] = 'commentaar (url)'; qDefault[k] = 'Te weinig beschikbare [[WP:VER|onafhankelijke bronnen]]. (NE)';

    qTemplate[++k] = '#REDIRECT'    ; qPos[k] ='top'   ;  qCategory[k] = 'Wikipedia:Redirect' ;qTemplateText[k] = '#REDIRECT [[$2]]';qPrompt[k] = 'doelpagina' ; qDisplayText[k] = '#R' ; dontusesquirlyBrackets[k]=''; qHidden[k]=1; qDefault[k] = wgPageName;
/*    qTemplate[++k] = 'NPOV|npov|nPOV'      ; qPos[k] ='top'      ;  qCategory[k] = 'Categorie:Wikipedia:Npov' ; ; qHidden[k]=1;
    qTemplate[++k] = 'twijfel'   ; qPos[k] ='top'      ;  qCategory[k] = 'Categorie:Wikipedia:Twijfel' ; ; qHidden[k]=1;

    qTemplate[++k] = '-' ; qPos[k] = '8%'; qHidden[k]=1;
*/
    qTemplate[++k] = 'wiu|xwiu'   ; qPos[k] ='top'      ;  qCategory[k] = 'Categorie:Wikipedia:Nog niet gereed' ; ; qHidden[k]=1;
    qTemplate[++k] = 'meebezig|wiu2'   ; qPos[k] ='top'      ;  qCategory[k] = 'Categorie:Wikipedia:Werk in uitvoering' ; qHidden[k]=1; qDisplayText[k] = 'wiu2';

    qTemplate[++k] = '-' ; qPos[k] = '8%'; qHidden[k]=1;

    
    qTemplate[++k] = 'de:' + wgPageName.replace(/_/,' ') ; qPos[k] ='bottom'      ;  qCategory[k] = 'de:' + wgPageName ; qDisplayText[k] = 'de' ;dontusesquirlyBrackets[k]='[[]]' ; qHidden[k]=1;
    qTemplate[++k] = 'en:' + wgPageName.replace(/_/,' ')  ; qPos[k] ='bottom'      ;  qCategory[k] = 'en:' + wgPageName ; qDisplayText[k] = 'en' ; dontusesquirlyBrackets[k]='[[]]' ; qHidden[k]=1; 
    qTemplate[++k] = 'es:' + wgPageName.replace(/_/,' ')  ; qPos[k] ='bottom'      ;  qCategory[k] = 'es:' + wgPageName ; qDisplayText[k] = 'es' ;dontusesquirlyBrackets[k]='[[]]' ; qHidden[k]=1;
    qTemplate[++k] = 'fr:' + wgPageName.replace(/_/,' ')  ; qPos[k] ='bottom'      ;  qCategory[k] = 'fr:' + wgPageName ; qDisplayText[k] = 'fr' ;dontusesquirlyBrackets[k]='[[]]' ; qHidden[k]=1;

    qTemplate[++k] = '-' ; qPos[k] = '8%'; qHidden[k]=1;

    qTemplate[++k] = 'dpintro'   ; qPos[k] ='top'         ;  qCategory[k] = 'Categorie:Wikipedia:Doorverwijspagina' ;  qHidden[k]=1; qDisplayText[k] = 'dpi' ; 
    qTemplate[++k] = 'dp'        ; qPos[k] ='bottom'      ;  qCategory[k] = 'Categorie:Wikipedia:Doorverwijspagina' ;  qHidden[k]=1;

    qTemplate[++k] = '-' ; qPos[k] = '8%'; qHidden[k]=1;

} else if (wgCanonicalNamespace == "File") {
qTemplate[++k] = 'nocat!!!!!!' + d + '|nocat|xnocat';qDisplayText[k]='nocat';qCategory[k] = 'Categorie:Wikipedia:Nog te categoriseren' ; qPos[k]='bottom';

/*    qTemplate[++k] = 'nocat|xnocat'; qPos[k] ='bottom'   ;  qCategory[k] = 'Categorie:Wikipedia:Nog_te_categoriseren' ;*/
   qTemplate[++k] = '-' ; qPos[k] = '50%';
   qTemplate[++k] = 'geeninfo'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Afbeeldingen van onbekende oorsprong en voorwaarden' ;qTemplateText[k] = '{{geeninfo|1=$2|2={{subst:LOCALYEAR}}|3={{subst:LOCALMONTH}}|4={{subst:LOCALDAY2}}}}\n$1';qPrompt[k] = 'commentaar'
   qTemplate[++k] = 'weg'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Weg' ;qTemplateText[k] = '{{afbeeldingweg|1=$2|2={{subst:LOCALYEAR}}|3={{subst:LOCALMONTH}}|4={{subst:LOCALDAY2}}}}\n$1';qPrompt[k] = 'commentaar'; qDefault[k] = 'Niet encyclopedisch (NE)';

   qTemplate[++k] = 'geenOTRS'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Weg' ;qTemplateText[k] = '{{geenOTRS|1=$2|2={{subst:LOCALYEAR}}|3={{subst:LOCALMONTH}}|4={{subst:LOCALDAY2}}}}\n$1';qPrompt[k] = 'commentaar'; qDefault[k] = ''; qDisplayText[k] = 'OTRS';

   qTemplate[++k] = '-' ; qPos[k] = '10%';

   qTemplate[++k] = 'nucommons'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:NuCommons' ;qTemplateText[k] = '{{nucommons|1=$2}}\n$1';qPrompt[k] = 'titel op Commons';  qDisplayText[k] = 'nuC';

   qTemplate[++k] = 'verplaats naar Wikimedia Commons'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Verplaats naar Wikimedia Commons' ; qDisplayText[k] = 'naarC';

   qTemplate[++k] = '-' ; qPos[k] = '10%';

} else if (wgCanonicalNamespace == "Template") {
    qTemplate[++k] = '#REDIRECT'    ; qPos[k] ='top'   ;  qCategory[k] = 'Wikipedia:Redirect' ;qTemplateText[k] = '#REDIRECT [[$2]]';qPrompt[k] = 'doelpagina' ; qDisplayText[k] = '#R' ; dontusesquirlyBrackets[k]=''; qDefault[k] = wgPageName;

qTemplate[++k] = 'nocat!!!!!!' + d + '|nocat|xnocat';qDisplayText[k]='nocat';qCategory[k] = 'Categorie:Wikipedia:Nog te categoriseren' ; qPos[k]='bottom';

   /* qTemplate[++k] = 'nocat|xnocat'; qPos[k] ='bottom'   ;  qCategory[k] = 'Categorie:Wikipedia:Nog_te_categoriseren' ;*/
   qTemplate[++k] = '-' ; qPos[k] = '60%';
   qTemplate[++k] = 'weg'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Weg' ;qTemplateText[k] = '<noinclude>{{sjabweg|1=$2|2={{subst:LOCALYEAR}}|3={{subst:LOCALMONTH}}|4={{subst:LOCALDAY2}}}}</noinclude>\n$1';qPrompt[k] = 'commentaar'; qDefault[k] = 'Niet encyclopedisch (NE)';
   qTemplate[++k] = '-' ; qPos[k] = '20%';
} else if (wgCanonicalNamespace == "Category") {
qTemplate[++k] = 'nocat!!!!!!' + d + '|nocat|xnocat';qDisplayText[k]='nocat';qCategory[k] = 'Categorie:Wikipedia:Nog te categoriseren' ; qPos[k]='bottom';

    qTemplate[++k] = '-' ; qPos[k] = '50%';

 qTemplate[++k] = 'weg'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Weg' ;qTemplateText[k] = '{{catweg|1=$2|2={{subst:LOCALYEAR}}|3={{subst:LOCALMONTH}}|4={{subst:LOCALDAY2}}}}\n$1';qPrompt[k] = 'commentaar (url)'; qDefault[k] = 'Onnodig';


} else if (wgCanonicalNamespace == "User") {
   qTemplate[++k] = '#REDIRECT'    ; qPos[k] ='top'   ;  qCategory[k] = 'Wikipedia:Redirect' ;qTemplateText[k] = '#REDIRECT [[$2]]';qPrompt[k] = 'doelpagina' ; qDisplayText[k] = '#R' ; dontusesquirlyBrackets[k]=''; qDefault[k] = wgPageName;
qTemplate[++k] = '-'    ; qPos[k] ='10%'

    qTemplate[++k] = 'weg'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Weg' ;qTemplateText[k] = '{{weg|1=$2|2={{subst:LOCALYEAR}}|3={{subst:LOCALMONTH}}|4={{subst:LOCALDAY2}}}}\n$1';qPrompt[k] = 'commentaar (url)'; qDefault[k] = 'Hier is een [[Wikipedia:Gebruikerspagina|gebruikerspagina]] niet voor bedoeld.';


} else {
    qTemplate[++k] = '#REDIRECT'    ; qPos[k] ='top'   ;  qCategory[k] = 'Wikipedia:Redirect' ;qTemplateText[k] = '#REDIRECT [[$2]]';qPrompt[k] = 'doelpagina' ; qDisplayText[k] = '#R' ; dontusesquirlyBrackets[k]=''; qDefault[k] = wgPageName;

   qTemplate[++k] = '-' ; qPos[k] = '50%';
}

if (!isSysop)
{
    qTemplate[++k] = 'nuweg'    ; qPos[k] ='top'   ;  qCategory[k] = 'Categorie:Wikipedia:Nuweg' ;qTemplateText[k] = '{{nuweg|1=$2}}\n$1';qPrompt[k] = 'commentaar';
}
    qTemplate[++k] = '-' ; qPos[k] = '3%';



deletionLinkId='verwijderpagina';
deletionTemplates='nuweg|wb|wiu|weg|auteur|reclame|ne';

//</pre></nowiki>


}

if (zmUseCustomTemplates)
   document.write('<scr'+'ipt type="text/javascript"'
  + 'src="//nl.wikipedia.org/w/index.php?title=' + zmCustomTemplateLocation
  + '&action=raw&ctype=text/javascript&dontcountme=s"></scr'+'ipt>');


function preProcessTemplates()
{

//alert(qTemplate.length);

for (i=1;i < qTemplate.length; i++)
  {
 
    if (dontusesquirlyBrackets[i] == null)
    {
       bracketsOpen[i] = '{{' ; bracketsClose[i] = '}}';
 
    } else 
    {
       q=dontusesquirlyBrackets[i].length / 2;
       if (q > 0) {
       bracketsOpen[i] = dontusesquirlyBrackets[i].substring(0,q);
       bracketsClose[i] = dontusesquirlyBrackets[i].substring(q);
       } else {
         bracketsOpen[i] = '';
         bracketsClose[i] = '';
       }
 
     }
 
     regexpBO[i]=bracketsOpen[i].replace( /\{/g ,'\\{').replace( /\[/g ,'\\['); 
     regexpBC[i]=bracketsClose[i].replace( /\{/g ,'\\}').replace( /\]/g ,'\\]'); 


     if (qTemplate[i] != '-')
     {
      q=qTemplate[i].split(/\|/g); 
      for (j=0; j < q.length; j++)
      {
        qTemplate[i]+='|' + q[j].substring(0,1).toUpperCase() + q[j].substring(1);
       }
     }


 }

}



function toggleHiddenElement(element, controlelement, hidetext, showtext)
{

 hidden=document.getElementById(element);
 hidden.style.display = (hidden.style.display == 'none') ? '' : 'none';
 
 document.getElementById(controlelement).innerHTML = (hidden.style.display == 'none') ? showtext : hidetext;
}

 
// -----------------------------------------------------------------------------
// Trim
// -----------------------------------------------------------------------------
 
function trim(stringToTrim)
{
 
  for (s=0;s < stringToTrim.length && stringToTrim[s++] < 33;); 
  for (e=stringToTrim.length; e >0  && stringToTrim[--e] < 33;);
 
  return(stringToTrim.substring(s-1,e+1));
}
 
 
// -----------------------------------------------------------------------------
// Load the edit form in the background
// -----------------------------------------------------------------------------
 
function loadEditFormBackground()
{
t=setTimeout(function(){loadEditFormBackground2();},250);
}

function loadEditFormBackground2()
{
 
  xmlhttp = HTTPClient();
  if (!xmlhttp)
    return;


var thetitle="/w/index.php?title="+encodeURIComponent(wgPageName);

  var span = document.createElement('span');

 span.innerHTML +='<a name=zmEditform style="margin:-1em;padding:-1em" id="editformcontrolelement" href=#zmEditform onclick=toggleHiddenElement("hiddeneditform","editformcontrolelement","-","+")>+</a>';

  document.getElementById('bodyContent').appendChild(span);

  var div = document.createElement( 'div' );
  div.id = 'hiddeneditform';
  div.style.display = 'none';
  document.getElementById('bodyContent').appendChild( div );

  xmlhttp.open("GET", thetitle + '&action=edit', true);
  xmlhttp.onreadystatechange = addEditForm;
  xmlhttp.send(null);
 
}
 
 
function addEditForm() 
{
 
  if (xmlhttp.readyState != 4)
    return;

   a=xmlhttp.responseText.indexOf('<form id="editform"');
   b=xmlhttp.responseText.indexOf('</form>',a+1)+7;
  
   document.getElementById('hiddeneditform').innerHTML = xmlhttp.responseText.substring(a,b);

   detectTemplates();
}
 




//----------------------------------------------
//    Section Parser
// identify sections according to wiki markup.
// returns an array of ['header']['content']
// (c) 2008 Zanaq, released under GPL
//----------------------------------------------
function sectioning(text)
{
 regex=/(^=+[^=\n]+=+ *$)/mgi;
 a=text.split(regex);
 sections=new Array;
 currentsection=0;
 sections[currentsection]=new Array;
sections[currentsection]['header']='';
sections[currentsection]['content']='';
 for (i=0;i<a.length;i++)
 {
  if (a[i].charAt(0) == "=")
  {
   sections[++currentsection]=new Array;
   sections[currentsection]['header']= a[i];
   sections[currentsection]['content']='';

  } else {
   sections[currentsection]['content'] = a[i];
  }
 }
 return(sections);
}





function detectTemplates()
{
   if (drawnTheTemplateBar != 2)
   {

       setTimeout("detectTemplates();",100);

        return(0);
   }




preProcessTemplates();

//alert(qTemplate.length);
editText=document.getElementById('wpTextbox1').value;

 
//alert(r.test(editText));
for (i=1;i < qTemplate.length; i++)
  {
 
   if (qTemplate[i] != '-') {
 
    r=RegExp( regexpBO[i] +'[\\n ]*?(' +  qTemplate[i] + ')[\\n ]*?(|\\|[^\\}]*?)' + regexpBC[i],'g' );

     aaa=r.exec(editText);
     
     if (!aaa)
     {
     //alert(r.test(editText));
      document.getElementById('chkqt' + i).checked = false;
    } else {
     //alert(r.test(editText));


 if ((qOptions[i])  && (aaa[2]))
 {
  argument=findInArray2(qOptions[i], aaa[2].substring(1));
 //alert(qOptions[i][argument]);
if (qOptions[i][argument] != undefined)
  {
  document.getElementById('selcmbqt' + i).value=qOptions[i][argument];
document.getElementById('cmbqt' + i).value=qOptions[i][argument];
  } else {

   r=RegExp( '(' + regexpBO[i] +'[\\n ]*?(' +  qTemplate[i] + ')[\\n ]*?(|\\|[^\\}]*?)' + regexpBC[i] + ')','g' );

     aaa=r.exec(editText);
   a = aaa[0].indexOf('|')+1;
   if (a > 0) 
document.getElementById('cmbqt' + i).value=aaa[0].substring(a, aaa[0].length-2);     
   // alert(aaa[0]);
  }
//alert(aaa[2].substring(1));
}

 document.getElementById('chkqt' + i).checked = true;
 
    }

 
     document.getElementById('chkqt' + i).disabled = false;
 
   }
  }
 
//if (wgPageName.substring(0,4) == 'Gebr')
//if (wgPageName.substring(0,24) == 'Wikipedia:Te_verwijderen')
 //detectFirstEmptySection();
//findTemplate()
 


 
}

function addQTemplate() {
 
 
//    var csub=document.getElementById("top");
//    var msg=document.createElement("p");
 
//    msg.innerHTML = ''<img src="' + imgZeus + '" align="left">';
 
//    csub.appendChild(msg);
 
 
    wikifybar = '';
    hiddenBar='';
 
if (location.href.indexOf('token=') != -1)
  return 0;
 
  wikifybar = '<table width=100% style="margin-bottom:-1em;margin-top:-1em;z-index:99999"><tr>';
  wikifybar +='<a id="toggleHiddenBar" href=javascript:toggleHiddenElement("hiddenBar","toggleHiddenBar","-","+") style="font-size:200%;float:left;display:none">+</a>';
 
 
  for (i=1;i < qTemplate.length; i++)
  {
 
 
      qT= "'" + qTemplate[i] + "'";
 
      if (qDisplayText[i]== null) 
       {
        if (qTemplate[i].indexOf('|') != -1)
          qDisplayText[i] = qTemplate[i].substring(0, qTemplate[i].indexOf('|'));
       }
 
       
       wkfb = (qTemplate[i] != '-') 
           ? (qTemplateText[i] == null)
                ? '<td style=vertical-align:bottom><center><input type="checkbox" DISABLED style="width:15px;height:15px;margin-top:-1px;margin-bottom:1px" id="chkqt' + i + '" name="chkqt' + i + '" value="greyed" onclick="toggleTemplate(' + i + ');">&nbsp;<a href="/wiki/' + qCategory[i] + '">' + ((qDisplayText[i]==null) ? qTemplate[i] : qDisplayText[i])+ '</a></center></td>'
                :'<td style=vertical-align:bottom><center><input type="button" style="width:15px;height:15px;margin-top:-1px;margin-bottom:1px" id="chkqt' + i + '" name=chkqt"' + i + '" value="" onclick="submitButtonedTemplate(' + i + ');">&nbsp;<a href="/wiki/' + qCategory[i] + '">' + ((qDisplayText[i]==null) ? qTemplate[i] : qDisplayText[i]) + '</a></center></td>'
           : '<td width="' + qPos[i] + '">&nbsp;</td>';
        
	if (qOptions[i] !=null)
       {
          
         w = (qWidth[i] != null) ? qWidth[i] : 65;
          wkfCombobox=createComboBox('cmbqt'+i, w, qOptions[i][0], qOptions[i], qOptions[i]);

           wkfb+='<td style=vertical-align:top><div style=position:relative;top:.2em>'+wkfCombobox+'</div></td>';

       
         }
 
 
 
 
if (qHidden[i] == null)
{
wikifybar += wkfb;
} else {
hiddenBar += wkfb;
}
 
 
//<input type="INPUT" 
  
  } 
 
 
  wikifybar += '<td><center><input type="checkbox"  style="margin-top:-1em" CHECKED id="chkMinorEdit" name="chkMinorEdit" value="grayed" onclick="">&nbsp;' + txtMinorEdit + '</center></td>'
  wikifybar += '<td><input id="wpSave" type="submit"  style="margin-top:0em" value="' + txtSavePage + '" name="wpSave" accesskey="s" title="Sla uw wijzigingen op [alt-s]"/  onclick=\"barClickSubmit();\"></td>';
  wikifybar += '</tr></table>';
  wikifybar += '<table  id="hiddenBar" style="display:none;margin-top:1em" width=100%><tr>' + hiddenBar + '</tr></table>';
 
// buggy in Opera?


drawnTheTemplateBar++;

document.getElementById("wikifybarrr").innerHTML= wikifybar;
// alert(msg.innerHTML);
//  csub.insertBefore(msg, csub.firstChild);


//csub.innerHTML = csub.innerHTML + wikifybar; //fix met dank aan MrBlueSky?

if (hiddenBar != '')
{
 hidden=document.getElementById('toggleHiddenBar');
 hidden.style.display = '';
}

if ((wgAction == 'submit') || (wgAction == 'edit'))
    detectTemplates();


} 


function barClickSubmit()
{
if ((wgAction != 'submit') && (wgAction != 'edit') && (typeof ( haveFixedDAB ) == "undefined" ) )
{
 
 editsummary=prompt(txtComment);
 if (editsummary==null) return(0);
 if (editsummary!='') document.getElementById('wpSummary').value += ' - ' + editsummary;
}
 


 document.getElementById('editform').submit();
 
}

function toggleTemplate(template)
{
    editText=document.getElementById('wpTextbox1').value;
    
smr=document.getElementById('wpSummary');

       if (qTemplate[template].indexOf('|') != -1)
       {
          placeText = qTemplate[template].substring(0, qTemplate[template].indexOf('|'));
       } else {
          placeText = qTemplate[template];
       }

    
    if (document.getElementById('chkqt' + template).checked) //checkmark has just been added
     {

//     if (qTemplateText[k] == null)
//     {
       if (qOptions[template]) placeText+=(document.getElementById('cmbqt' + template).value == '') ? '' : ('|'+ document.getElementById('cmbqt' + template).value);



	rr=RegExp( regexpBO[template] +'(' +  qTemplate[template] + ')(|\\|[^\\}]*?)' + regexpBC[template],'g' );

    	if (rr.test(smr.value))
	{
		rr=RegExp( '(, )*\\-' + regexpBO[template] +'(' +  qTemplate[template] + ')(|\\|[^\\}]*?)' + regexpBC[template],'g' );
		
		smr.value=trim(smr.value.replace(rr,''));
        
		if (smr.value.substr(0,2) == ', ') smr.value=smr.value.substr(2);
       } else {


		if (smr.value!='') smr.value += ', ';
		smr.value+='+' + bracketsOpen[template] + placeText.replace(/!!!/g, '|') + bracketsClose[template];
       }
       if (!qTemplateText[template])
       {
         if (qPos[template] != 'bottom')
         {
         document.getElementById('wpTextbox1').value = trim(bracketsOpen[template] + placeText.replace(/!!!/g, '|') + bracketsClose[template] + '\n' + trim(document.editform.wpTextbox1.value));
          } else {
          document.getElementById('wpTextbox1').value =  trim(trim(document.editform.wpTextbox1.value) + '\n'+ bracketsOpen[template] + placeText.replace(/!!!/g, '|') + bracketsClose[template]);
          }
         }   else {

//alert(document.getElementById('wpTextbox1').value);
document.getElementById('wpTextbox1').value =  trim(qTemplateText[template].replace(/\$1/g, trim(form.getElementsByTagName('textarea')[0].value)).replace(/\$2/g, prompted));
  

         }
       
     } else {





 //alert(escape(bracketsOpen));
//alert(template);
 //alert(regexpBO[template]);
   
    r=RegExp( regexpBO[template] +'[\\n ]*?(' +  qTemplate[template] + ')[\\n ]*?(|\\|[^\\}]*?)' + regexpBC[template],'g' );

     document.getElementById('wpTextbox1').value=trim(editText.replace(r,''));

    r=RegExp( '(, )\\+' + regexpBO[template] + placeText + regexpBC[template],'g' );
//    smr.value=trim(smr.value.replace(r,''));

    r=RegExp( regexpBO[template] +'(' +  qTemplate[template] + ')(|\\|[^\\}]*?)' + regexpBC[template],'g' );

    if (r.test(smr.value))
    {
      r=RegExp( '(, )*\\+' + regexpBO[template] +'(' +  qTemplate[template] + ')(|\\|[^\\}]*?)' + regexpBC[template],'g' );

      smr.value=trim(smr.value.replace(r,''));
      if (smr.value.substr(0,2) == ', ') smr.value=smr.value.substr(2);

    } else {

       if (smr.value!='') smr.value += ', ';
       smr.value+='-' + bracketsOpen[template] + placeText + bracketsClose[template];
    }
       
     

     }
   




}



function submitButtonedTemplate(template)
{
 editText=document.getElementById('wpTextbox1').value;
//alert(qSection[template]);

 if ( (document.location.href.indexOf('&section=') == -1) && ( (qSection[template]!=null) ) )//             (qSection[template]>=0) || (qSection[template] == 'lastfilled') ) )
    {
      sections=sectioning(editText);

      sct=qSection[template];

      if (sct=='lastfilled')
      { 
        for (i=0;i<sections.length;i++)
        {
  //         alert(sections[i]['content'].length);
           if (sections[i]['content'].length < 3) break;
        }
        
        sct= (i<sections.length)  ? i -1 : sections.length - 1;

      }
//alert('dhjsh' + sct);
      editText=sections[sct]['content'];
//     alert(editText);
    }

 

     if (qPrompt[template] == null) 
            { 
                 prompted = '';
            } else {
                prompted = prompt(qPrompt[template], (qDefault[template]==null) ? '' : qDefault[template]);
                if (prompted==null) return;
            }

if ( typeof ( qTemplateText[template] ) == "string" ) 
{
       editText =  trim(qTemplateText[template].replace(/\$1/g, trim(editText)).replace(/\$2/g, prompted));
       selectedValue='';

} else {

//a=qTemplateText[template].length
selectedValue=document.getElementById('cmbqt' + template).value

a=findInArray2(qOptions[template], '"' + selectedValue + '"');

selectedOption=(a==-1) 
     ? (qTemplateText[template][qTemplateText[template].length-1])
     :(qTemplateText[template][a]);
//alert(selectedOption);

       editText =  trim(selectedOption.replace(/\$1/g, trim(editText)).replace(/\$2/g, prompted).replace(/\$3/g, selectedValue));


//alert(typeof ( qTemplateText[template] ));

}

       
if ( (document.location.href.indexOf('&section=') == -1) && ( (qSection[template]!=null) ) )
    {
      sections[sct]['content']='\n\n'+editText +'\n\n';
      editText=unSectioning(sections);
    }

//alert(qTemplate[template]);
document.getElementById('wpSummary').value+= '+' + bracketsOpen[template] + qTemplate[template].substring(0,qTemplate[template].indexOf('|')) + bracketsClose[template];

document.getElementById('wpSummary').value+=((prompted != null) && (prompted != '')) ? (' - ' + prompted) : '';

document.getElementById('wpSummary').value+=((selectedValue != null) && (selectedValue != '')) ? (', ' + selectedValue) : '';



document.getElementById('wpTextbox1').value=trim(editText);

if ( (wgAction != 'submit') && (wgAction != 'edit') &&  (document.getElementById('hiddeneditform').style.display == 'none') )
           document.getElementById('editform').submit();

} 




function getPreviousPage()
{


     url=document.location.href;
 
     tp=url.indexOf('?template=');
     if (tp != -1) 
     {
      pp=url.indexOf('&vandalized=');
      rp=url.indexOf('&reason=');
      if (rp == -1) 
      {
        rp = url.length;
       templateReason= '';
      } else {
       templateReason=decodeURIComponent(url.substring(rp+8));

      }
 
      lastTemplate=decodeURIComponent(url.substring(tp+10,pp));

      articleName=decodeURIComponent(url.substring(pp+12,rp));

      return(decodeURIComponent(articleName));
     }



 
 z=   document.location.href.indexOf('vandalized=');
 if (z != -1)
 {
  articleName=document.location.href.substring(z+11);
  
  z=  document.location.href.indexOf('&');
  if (z != -1)
  {
     articleName=articleName.substring(0,z);
  }
  
  
  return(decodeURIComponent(articleName));
 }
 
 if (document.referrer == null)
  return('');
 
 
 ref = document.referrer;

 
 z=   ref.indexOf('vandalized=');
 if (z != -1)
 {
  articleName=ref.substring(z+11);
  z=  articleName.indexOf('&');
  if (z != -1)
  {
     articleName=articleName.substring(0,z);
  }

  return(decodeURIComponent(articleName));
 }
 





 
z=   ref.indexOf('/wiki/');
 
if (z == -1)
{
  z=ref.indexOf('title=');
  zz=ref.indexOf('&');
 
  articleName=ref.substring(z+6,zz);
 
} else {
  zz=ref.indexOf('?');
  
  articleName=(zz!=-1) ? ref.substring(z+6,zz) : ref.substring(z+6);

}
 
 return(decodeURIComponent(articleName));
}


function passArticlename()
{

contentSub=document.getElementById('contentSub');
q=contentSub.getElementsByTagName('a');

q = (contentSub.innerHTML.indexOf('<') > 10) ? q[0] : q[1];

sep = (q.href.indexOf('action=edit') == -1) ? '?' : '&';

q.href += sep + 'vandalized=' + encodeURIComponent(vandalizedPage);
 
//q.href =  'http://nl.wikipedia.org/wiki/Overleg_gebruiker:Zanaq/Test' + '?vandalized=' + encodeURIComponent(vandalizedPage);

}




function unSectioning(sections)
{
  //alert(sections.length);
  unSectionedText='';
  for (i=0;i<sections.length;i++)
  {
 //alert(sections[i]['header']);
     unSectionedText+=sections[i]['header'] +sections[i]['content'];
  }
  return(unSectionedText);
}



/*===============
Find deletion templates in a page
================*/
 
function findTemplate()
{
 
verwijderlink=document.getElementById(deletionLinkId);
 if (verwijderlink==null) return(0);
 //alert('sjhj');
 if (document.getElementById('wpTextbox1') == null) 
 {t=setTimeout('findTemplate();',100);
  return(0);
 } 
var regexFindTemplates = RegExp('\\{\\{(' + deletionTemplates + ')(.*)\\}\\}','im');
 a = regexFindTemplates.exec(document.getElementById('wpTextbox1').value);
 
 a[2] = (a[2][0]=='|') ? a[2].substring(1) : '';
 a[2] = (a[2][1]=='=') ? a[2].substring(2) : a[2];
 
 a[2]=a[2].split(/\|(\d+=\d+|\d+)/)[0];
 
 url='?template=' + encodeURIComponent(a[1]) + '&vandalized=' + encodeURIComponent(wgPageName.replace(/_/g, ' '));
 
 if (a[2] != '') url += '&reason=' + encodeURIComponent(a[2]);
 
 verwijderlink.getElementsByTagName('a')[0].href += url;
 
}


if (zmUseQuickTemplate == true)
{
 if (wgCanonicalSpecialPageName == "Contributions")
 {
    passArticlename();
}
 if ((wgCanonicalNamespace != 'Special') && (wgAction != 'submit') && (wgAction != 'edit'))
  loadEditFormBackground();





    var csub=document.getElementById("contentSub");
    var msg=document.createElement("div");
    msg.innerHTML = '<p id=wikifybarrr></p>';
  csub.insertBefore(msg, csub.firstChild);


 if (wgCanonicalNamespace != 'Special')
{
  addQTemplate();

  window.addEventListener ('DOMContentLoaded',addQTemplate,false);
}
findTemplate()
}


/* ----------------------------------------------------
Doorverwijspagina lookup-script

Gebaseerd op:
* http://nl.wikipedia.org/wiki/Gebruiker:Silver Spoon/dpzoeker.js, gebaseerd op:
* http://en.wikipedia.org/wiki/User:Splarka/dabfinder.js 


---------------------------------------------------- */

var dabnames = new Array();
var dabfound = -1;
var clickedLink = -1;
var clickedTarget = "";
	
	function fixDABlink(s)
	{
	
		if (s.value == 'ViewDABpage')
		{
		    document.location.href='/wiki/' + s.getElementsByTagName('option')[0].value;
			return;
		}
		
		a=s.value.indexOf('[[');
		b=s.value.indexOf(']]',a);
		if (b==-1)
		{
			document.getElementById('t-dab').innerHTML += '<br>Fout in optie';
			return;
		}
		
		c=s.value.indexOf('|');
		if ((c > a) && (c < b)) b=c;
		selectedOption=s.value.substring(a+2,b);
		
		a=document.getElementById("wpTextbox1").value.toUpperCase().indexOf('[['+s.getElementsByTagName('option')[0].value.toUpperCase() +']]');
if (a == -1) a=document.getElementById("wpTextbox1").value.toUpperCase().indexOf('[['+s.getElementsByTagName('option')[0].value.toUpperCase() +'|');
		if (a==-1)
		{
			document.getElementById('t-dab').innerHTML += '<br>Geen link gevonden';
			return;
		}

		b=document.getElementById("wpTextbox1").value.indexOf(']]', a);
		if (b==-1)
		{
			document.getElementById('t-dab').innerHTML += '<br>Geen link gevonden';
			return;
		}
	
	
		c=document.getElementById("wpTextbox1").value.indexOf('|', a);
		if ((c > a) && (c < b)) b=c+1; else b=a+2;
		
		document.getElementById("wpTextbox1").value=document.getElementById("wpTextbox1").value.substring(0,a) + '[[' + selectedOption + '|' + document.getElementById("wpTextbox1").value.substring(b);
		


		summ=document.getElementById("wpSummary");
		if (summ.value.indexOf(txtFixDisambiguation) == -1)
			summ.value +=txtFixDisambiguation;

		summ.value += ', [[' + s.getElementsByTagName('option')[0].value + ']] → [[' + selectedOption + ']]';
		
		document.getElementById('t-dab').innerHTML += '<br>' + s.getElementsByTagName('option')[0].value + ' gefixt';
		haveFixedDAB = true;
	}
	
	function loadDABraw()
{
	if (xmlhttp.readyState != 4) return;
 
    if ((xmlhttp.responseText.toUpperCase().indexOf('REDIRECT') != -1) || (xmlhttp.responseText.toUpperCase().indexOf('DOORVERWIJZING') != -1))
	{
	
		a=xmlhttp.responseText.indexOf('[[');
		b=xmlhttp.responseText.indexOf(']]',a);
		if (b!=-1)
		{
			title= xmlhttp.responseText.substring(a+2,b).trim();
			
			url=wgServer + wgScript + '?title=' + encodeURIComponent(title) + '&action=raw';
			xmlhttp = HTTPClient();
			if (!xmlhttp) return;
		 
			xmlhttp.open("GET", url, true);
			xmlhttp.onreadystatechange = loadDABraw;
			xmlhttp.send(null);

		}
	
	
	
	return;
	}
 
	
    wikiText = xmlhttp.responseText.trim();
 
    DABlines = wikiText.split('\n');
	opts= '';
	for (l in DABlines)
    {
      
	  line = DABlines[l];
if (typeof(line) != 'string') line='';
	  if ((line.indexOf('[[') != -1) && ((line.indexOf(':') > 7) || (line.indexOf(':') < 3))) //Interwiki
	  {
		
	  
DABlines[l]=DABlines[l].replace(/\*?/g,'').trim();
		opts += '<option value="' + DABlines[l] + '"> ' + DABlines[l];
	  }
    }

	opts += '<option value=ViewDABpage>Bekijk doorverwijspagina';
    var docobj = document.getElementById('bodyContent') || document.getElementById('content') || document.body;	
	originalwidth = docobj.getElementsByTagName('a')[clickedLink].offsetWidth;
	
		
	selectlist = document.getElementById('select-' + clickedLink);
	selectlist.innerHTML+=opts;
	
}

function loadDAB(l)
{

   i = l.id.substring(l.id.indexOf('-')+1);
 title = document.getElementById('link-' + i).title
   
   docobj = document.getElementById('bodyContent') || document.getElementById('content') || document.body;
   
	url=wgServer + wgScript + '?title=' + title + '&action=raw';


clickedLink = i;

if (document.getElementById('select-' + clickedLink).length == 1)
{

  clickedTarget=title;
	xmlhttp = HTTPClient();
	if (!xmlhttp) return;
 
	xmlhttp.open("GET", url, true);
	xmlhttp.onreadystatechange = loadDABraw;
	xmlhttp.send(null);

}
   
   
   
}

function findDABsButton() {

  if(!queryString('oldid') && !queryString('diff') && (wgAction == 'view' || wgAction == 'purge' || wgAction == 'submit')) {
    addPortletLink('p-tb','javascript:findDABs()','Links naar dp\'s','t-dab');
    if(queryString('finddab')=='true') findDABs();
  }
}
 
function findDABs() {
  if (dabfound == -1)
  {
	dabfound=0;
  } else {
    return(0);
  }

  var dab = document.getElementById('t-dab');
  if (dab) dab.innerHTML = 'Bezig met zoeken...';
  var url = wgScriptPath + '/api.php?maxage=86400&smaxage=86400&action=query&rawcontinue=&prop=links&pllimit=500&tlnamespace=10&indexpageids&format=json&callback=findDABsCB&titles=Benutzer:Midas02/Zeusmode/Disambiguationspage';
  importScriptURI(url);
}
 
function findDABsCB(obj) {
  if(!obj['query'] || !obj['query']['pages'] || !obj['query']['pageids']) return
  var links = obj['query']['pages'][obj['query']['pageids'][0]]['links']
  if(!links) return
  for(var i=0;i<links.length;i++) {
    dabnames.push(links[i]['title']);
  }
  findDABsQuery();
}

function findDABsQuery(qcont) {
  var url = wgScriptPath + '/api.php?maxage=300&smaxage=300&action=query&rawcontinue=&redirects&generator=links&gpllimit=500&prop=templates&tllimit=500&indexpageids&format=json&callback=findDABlinksCB&titles=' + encodeURIComponent(wgPageName);
  if(qcont) url += '&tlcontinue=' + encodeURIComponent(qcont)
  importScriptURI(url);
}

function findDABlinksCB(obj) {
  var dablinks = new Array();
  if(!obj['query'] || !obj['query']['pages'] || !obj['query']['pageids']) return
  appendCSS('.dablink-found {background-color: #FAB;}');
  appendCSS('.DABselect { height=16px; font-size:80%;border:1px solid #AAA;padding:0;background:#FAB; margin:0;margin-left:-4px;margin-right:-4px;position:relative;top:1px }');
  appendCSS('.DABparent {background:#FED;}');

  var ids = obj['query']['pageids'];
  var links = new Array()
  for(var i=0;i<ids.length;i++) {
    var templates = obj['query']['pages'][ids[i]]['templates'];
    if(!templates) continue
    for(var j=0;j<templates.length;j++) {
      var tpl = templates[j]['title'];
      for(var k=0;k<dabnames.length;k++) {
        if(tpl == dabnames[k]) {
          dablinks.push(obj['query']['pages'][ids[i]]['title']);
          continue;
        }
      }
    }
  }
  if(obj['query']['redirects']) {
    var dablen = dablinks.length;
    var redirects = obj['query']['redirects'];
    if(redirects) {
      for(var i=0;i<redirects.length;i++) {
        for(var j=0;j<dablen;j++) {
          if(obj['query']['redirects'][i]['to'] == dablinks[j]) {
            dablinks.push(obj['query']['redirects'][i]['from']);
            continue;
          }
        }
      }
    }
  }
  var docobj = document.getElementById('bodyContent') || document.getElementById('content') || document.body;
  var links = docobj.getElementsByTagName('a')
  for(var i=0;i<links.length;i++) {
    for(var j=0;j<dablinks.length;j++) {
      var dablink = dablinks[j].replace(/ /g,'_');
	  var chklink = (links[i].hasAttribute('href')) ? links[i].getAttribute('href', 2).replace(/\#.*/,'') : ''
      chklink = chklink.replace(wgArticlePath.replace(/\$1/,''),'');
      chklink = decodeURIComponent(chklink);

      if(chklink == dablink && links[i].className.indexOf('dablink-found') == -1 && links[i].parentNode.className.indexOf('comment') == -1) {
        links[i].className += ' dablink-found';
        //links[i].href='/wiki/Special:WhatLinksHere/' + dablink;
if (document.getElementById('wpTextbox1')!=null)
{
        links[i].id='link-' + i;
		
		//links[i].href='javascript:loadDAB(' + i + ',"' + chklink + '")';
		links[i].onmouseover=function(){loadDAB(this);};
		spann = document.createElement("span");
		spann.id = 'chklink' + i;

coption=(dablinks[j].toUpperCase() == links[i].innerHTML.toUpperCase()) ? dablinks[j] : dablinks[j] + '|' + links[i].innerHTML ;

		spann.innerHTML='<select class=DABselect id="' + 'select-' + i + '" onChange = "fixDABlink(this)" style="width:' +(links[i].offsetWidth+18)+'px;" type=text list=browsers >  ' + '<option value="' + dablinks[j] + '">' + coption+ '</select>';
	links[i].style.display='none';
		links[i].parentNode.insertBefore(spann,links[i]) ;
		
		document.getElementById('select-'+i).onmouseover=function(){loadDAB(this);};
//links[i].innerHTML+='<span id="chklink' + i + '"></span>';
                }
		links[i].parentNode.className += ' DABparent';
                dabfound++;
                
      }
    }
  }
 
  var dab = document.getElementById('t-dab');
  if(obj['query-continue'] && obj['query-continue']['templates']) {
    if(dab) {
      dab.innerHTML = 'dp-links zoeken...';
    }
    findDABsQuery(obj['query-continue']['templates']['tlcontinue']);
  } else {
    if(dab) {
      if(dabfound > 0) {
        var span = document.createElement('span');
        dab.innerHTML = dabfound + ' dp-links';
        
      } else {
        dab.innerHTML = 'Geen dp-links gevonden.';
      }
    } else {
      //alert(dabfound + ' dp-links gevonden.');
    }
  }
}
 
function queryString(p) {
  var re = RegExp('[&?]' + p + '=([^&]*)');
  var matches;
  if (matches = re.exec(document.location)) {
    try { 
      return decodeURI(matches[1]);
    } catch (e) {
    }
  }
  return null;
}

if ( typeof ( zmUseFixDABs ) == "undefined" )      zmUseFixDABs=true;
if ( typeof ( zmDABdelay ) == "undefined" )      zmDABdelay=30000;


if (zmUseFixDABs)
{
 findDABsButton();


 if (((wgCanonicalNamespace=="") || (wgCanonicalNamespace=="Template") || (wgCanonicalNamespace=="File") || (wgCanonicalNamespace=="User")) && (document.location.href.indexOf('&diff')==-1))
 {
  if (vandalizedPage == "Wikipedia:Links naar doorverwijspagina's/Artikelen") zmDABdelay = 1500;
  
   if (zmDABdelay > 0)
        setTimeout("findDABs();",zmDABdelay);
  
 }
}

//</pre></nowiki>