Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Internet Explorer/Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
  • Opera: Strg+F5
//gmw.loader.load("//de.wikipedia.org/w/index.php?title=Benutzer:TMg/autoFormatter.js&action=raw&ctype=text/javascript");
mw.loader.load('//wikisource.org/w/index.php?title=MediaWiki:GoogleOCR.js&action=raw&ctype=text/javascript');
mw.loader.load("//de.wikipedia.org/w/index.php?title=Benutzer:TMg/cleanDiff.js&action=raw&ctype=text/javascript");
mw.loader.load('//en.wikisource.org/w/index.php?title=MediaWiki:Gadget-massdelete.js&action=raw&ctype=text/javascript')

// <nowiki>

function httpGet(theUrl) {
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
    xmlHttp.send( null );
    return xmlHttp.responseText;
}

function httpGet2() {
  var requests = new Array(arguments.length);
  for (i = 0; i < arguments.length; i++) {
    requests[i] = new XMLHttpRequest();
  	console.log(arguments[i]);
    requests[i].open("GET", arguments[i], true);
    requests[i].extraInfo= arguments[i];
    requests[i].onload = function (e) {
      if (requests[i].readyState === 4) {
      	console.log(requests[i].extraInfo + ':');
        if (requests[i].status === 200) {
          console.log(requests[i].responseText);
        } else {
          console.error(requests[i].statusText);
        }
      }
    };
    requests[i].onerror = function (e) {
      console.error(requests[i].statusText);
    };
    requests[i].send(null); 
  }
}

function clean() {
	httpGet2('/wiki/Berlin', '/wiki/Bonn');
	var article = document.editform.wpTextbox1.value;
    article = article.replace(
    	/\[https{0,1}:\/\/commons\.wikimedia\.org\/wiki\/(.*?) (.*?)\]/g, 
    	function( $0, $1, $2 ) {
    		var prefix = '[[commons:';
    		if ($1.match(/^(Kategorie:|Category:|Datei:|File:|Bild:|Image:).*/i)) {
    			prefix = '[[:commons:';
    		}
			return prefix + decodeURI($1).replace(/[ _]+/g, ' ') + '|' + $2 +  ']]';
		}
	);
	article = article.replace(
    	/\[https{0,1}:\/\/([a-z]+)\.wikipedia\.org\/wiki\/(.*?) (.*?)\]/g, 
    	function( $0, $1, $2, $3 ) {
    		var prefix = '[[w:';
    		if ($2.match(/^(Kategorie:|Category:|Datei:|File:|Bild:|Image:).*/i)) {
    			prefix = '[[:w:';
    		}
			return prefix + $1 + ':' + decodeURI($2).replace(/[ _]+/g, ' ') + '|' + $3 +  ']]';
		}
	);
	article = article.replace(/\[\[(:{0,1})w:de:/g, '[[$1w:');

	article = article.replace(
    	/\[https{0,1}:\/\/([a-z]+)\.wikisource\.org\/wiki\/(.*?) (.*?)\]/g, 
    	function( $0, $1, $2, $3 ) {
    		var prefix = '[[s:';
    		if ($2.match(/^(Kategorie:|Category:|Datei:|File:|Bild:|Image:).*/i)) {
    			prefix = '[[:s:';
    		}
			return prefix + $1 + ':' + decodeURI($2).replace(/[ _]+/g, ' ') + '|' + $3 +  ']]';
		}
	);
	article = article.replace(/\[\[(:{0,1})s:de:/g, '[[$1');
    document.editform.wpTextbox1.value = article;
    document.getElementById("wpWatchthis").checked = true;
    document.getElementById("wpSummary").value = "Aufräumung";
}

function clean2() {
	
  var article = document.editform.wpTextbox1.value;
  article = article.replace(/\t/g, " ");
  article = article.replace(/\r\n!/g, " ");
  article = article.replace(/\r\nI /g, " ");
  article = article.replace(/\r\nl /g, " ");
  article = article.replace(/\r\n1 /g, " ");
  article = article.replace(/\r\ni /g, " se");
  article = article.replace(/\r\n>/g, "");
  article = article.replace(/\"/g, "“");
  article = article.replace(/\'/g, "’");
  article = article.replace(/—/g, "–");
  article = article.replace(/»/g, "n");
  article = article.replace(/«/g, "n");
  article = article.replace(/\.\n/g, ".\n\n");
  article = article.replace(/\?\n/g, "?\n\n");
  article = article.replace(/!\n/g, "!\n\n");
  article = article.replace(/“\n/g, "“\n\n");
  article = article.replace(/ uud /g, " und ");
  article = article.replace(/ nnd /g, " und ");
  article = article.replace(/ zn /g, " zu ");
  article = article.replace(/ iu /g, " in ");
  article = article.replace(/ cs /g, " es ");
  article = article.replace(/ cr /g, " er ");
  article = article.replace(/ rc\./g, " etc.");
  article = article.replace(/ dcr /g, " der ");
  article = article.replace(/ sür /g, " für ");
  article = article.replace(/ eiu /g, " ein ");
  article = article.replace(/ dcn /g, " den ");
  article = article.replace(/ sic /g, " sie ");
  article = article.replace(/ nm /g, " um ");
  article = article.replace(/ nnr /g, " nur ");
  article = article.replace(/\. \. \./g, "…");
  article = article.replace(/\.\.\./g, "…");
  article = article.replace(/ ! /g, " ");
  article = article.replace(/ I /g, " ");
  article = article.replace(/ ^ /g, " ");
  article = article.replace(/ anch /g, " auch ");
  article = article.replace(/ fie /g, " sie ");
  article = article.replace(/ fich /g, " sich ");
  article = article.replace(/ Ick /g, " Ich ");
  article = article.replace(/ ick /g, " ich ");
  article = article.replace(/ suhr /g, " fuhr ");
  article = article.replace(/ find /g, " sind ");
  article = article.replace(/([a-zA-ZöäüÖÄÜß’]+)S([a-zA-ZöäüÖÄÜß]*)/g, "$1s$2");
  article = article.replace(/Dr\./g, "<tt>Dr.</tt>");
  article = article.replace(/ , /g, ", ");
  article = article.replace(/\- \n/g, "");
  article = article.replace(/ +\n/g, "\n");
  article = article.replace(/… \./g, ". …");
  document.editform.wpTextbox1.value = article;
  document.getElementById("wpWatchthis").checked = true;
}

function replace() {
  var article = document.editform.wpTextbox1.value;
  var str1 = prompt("Was soll ersetzt werden?");
  var str2 = prompt("Womit soll ersetzt werden?");
  if (confirm("'" + str1 + "' -> '" + str2 + "'")) {
    var replacer = new RegExp(str1, "g");
    document.editform.wpTextbox1.value = article.replace(replacer, str2);
    document.getElementById("wpWatchthis").checked = true;
  }
}

function bru() {
  var article = document.editform.wpTextbox1.value;
  article = article.replace(/\[\[bild:/g, "[[xxx:");
  article = article.replace(/\[\[Bild:/g, "[[xxx:");
  article = article.replace(/\[\[image:/g, "[[xxx:");
  article = article.replace(/\[\[Image:/g, "[[xxx:");
  article = article.replace(/\[\[file:/g, "[[xxx:");
  article = article.replace(/\[\[File:/g, "[[xxx:");
  article = article.replace(/\[\[datei:/g, "[[xxx:");
  article = article.replace(/\[\[Datei:/g, "[[xxx:");
  article = article.replace(/\[\[xxx:(.*?)\|.*?([0-9]+)px.*\|(.*?)\]\]/g, "{{BRU|$1|center|$2|$3||center}}");
  if ((document.editform.wpTextbox1.value != article) && (article.indexOf("xxx:")==-1) ) {
    document.editform.wpTextbox1.value = article;
    document.getElementById("wpWatchthis").checked = true;
    document.getElementById("wpSummary").value = "[[Vorlage:BRU]]";
  }
}


function textSelect(inp, s, e) {
  e = e || s;
  if (inp.createTextRange) {
    var r = inp.createTextRange();
    r.collapse(true);
    r.moveEnd('character', e);
    r.moveStart('character', s);
    r.select();
  } else if (inp.setSelectionRange) {
    inp.focus();
    inp.setSelectionRange(s, e);
  }
}

function insertBru() {
  var article = document.editform.wpTextbox1.value;
  var name = mw.config.get('wgTitle');
  var str = name.match(/Gartenlaube \((\d{4})\) (\d{3,4})/);
  if (str) {
    var text = prompt("Bildtext: ", "");
    var pos = text.indexOf("<br />");
    if (pos==-1) {
      text = text.replace (/Bild:  /, "");
      text = text.replace(/  /g, "<br />");
      pos = text.indexOf("<br />");
    }
    if (pos!=-1) {
      var teil1 = text.substring(0, pos);
      teil1 = teil1.replace(/ $/, "");
      var teil2 = text.substring(pos+6);
      teil2 = teil2.replace(/^ /, "");
      var tokens = teil2.split(" ");
      var l = tokens.length;
      teil2 = "";
      for (var i = 0; i < l-2; i++) {
         teil2 += tokens[i] + " ";
      }
      var teil3 = tokens[l-2] + " " + tokens[l-1];
      text =  teil1 + ".'''<br />" + teil2 + "''" + teil3 + "''.";
    } else {
      text = text + ".'''";
    }
    text = text.replace(/\.\./g, ".");
    text = text.replace(/\.\'\'\./g, "''.");
    var startPos = document.editform.wpTextbox1.selectionStart;
    var beforeStr = article.substring(0, startPos-1);
    var afterStr = article.substring(startPos);

    document.editform.wpTextbox1.value = beforeStr + "\n\n{{BRU|Die Gartenlaube (" + str[1] + ") b " + str[2] + ".jpg|center|300|'''" + text + "||center}}\n\n" + afterStr;
    
    pos = document.editform.wpTextbox1.value.indexOf("|300|");
    if (pos>=0) {
      textSelect(document.editform.wpTextbox1, pos+8, pos+8);
    }
    document.getElementById("wpWatchthis").checked = true;
  } else {
    alert("Artikel hat falsches Format.");
  }
  
}

function myPrompt(label) {
  var text = prompt(label, "");
  if (text===null) {
    text = "";
  }
  return text;
}

function przu() {
  var article = document.editform.wpTextbox1.value;
  var textarea = document.querySelector("textarea").value; 
  var startPos = document.editform.wpTextbox1.selectionStart;

  var beforeStr = article.substring(0, startPos);
  var afterStr = article.substring(startPos);

  document.editform.wpTextbox1.value = beforeStr + "{{PRZU}}" + afterStr;
  textSelect(document.editform.wpTextbox1, startPos+8, startPos+8);
}


function sec() {
  //var startSec = prompt("1. Section?");
  var startSec = 1;
  var endSec = parseInt(startSec) + 1;
  var article = document.editform.wpTextbox1.value;
  var textarea = document.querySelector("textarea").value; 
  var startPos = document.editform.wpTextbox1.selectionStart;
  var endPos = document.editform.wpTextbox1.selectionEnd;

  var beforeStr = article.substring(0, startPos-1);
  var titleStr = article.substring(startPos, endPos);
  var afterStr = article.substring(endPos+1);

  document.editform.wpTextbox1.value = "<section begin=" + startSec + " />" + beforeStr + "<section end=" + startSec + " />\n\n\n{{Linie}}\n\n\n<section begin=" + endSec + " />" + afterStr + "<section end=" + endSec + " />";
  textSelect(document.editform.wpTextbox1, endPos+67, endPos+67);
}

function nbsp() {
  var article = document.editform.wpTextbox1.value;
  var textarea = document.querySelector("textarea").value; 
  var startPos = document.editform.wpTextbox1.selectionStart;

  var beforeStr = article.substring(0, startPos-1);
  var afterStr = article.substring(startPos);

  document.editform.wpTextbox1.value = beforeStr + "&nbsp;" + afterStr;
  textSelect(document.editform.wpTextbox1, startPos+6, startPos+6);
}

function autor() {
  var article = document.editform.wpTextbox1.value;
  var textarea = document.querySelector("textarea").value; 
  var startPos = document.editform.wpTextbox1.selectionStart;
  var endPos = document.editform.wpTextbox1.selectionEnd;

  var beforeStr = article.substring(0, startPos);
  var titleStr = article.substring(startPos, endPos);
  var afterStr = article.substring(endPos);

  document.editform.wpTextbox1.value = beforeStr + "{{right|''" + titleStr + "''}}" + afterStr;
  textSelect(document.editform.wpTextbox1, endPos+14, endPos+14);
}

function ueberschrift() {
  var article = document.editform.wpTextbox1.value;
  var textarea = document.querySelector("textarea").value; 
  var startPos = document.editform.wpTextbox1.selectionStart;
  var endPos = document.editform.wpTextbox1.selectionEnd;

  var beforeStr = article.substring(0, startPos);
  var titleStr = article.substring(startPos, endPos);
  var afterStr = article.substring(endPos);
  var pos = titleStr.indexOf("\n");
  if (pos!=-1) {
    var teil1 = titleStr.substring(0, pos);
    var teil2 = titleStr.substring(pos+2);
    document.editform.wpTextbox1.value = beforeStr + "{{GLÜberschrift|||" + teil1 + "'''}}\n{{center|" + teil2 + "}}" + afterStr;
  } else {
    document.editform.wpTextbox1.value = beforeStr + "{{GLÜberschrift|||" + titleStr + "'''}}" + afterStr;
  }
  document.getElementById("wpWatchthis").checked = true;
}

function callWikiApi(params) {
	var url = "https://de.wikisource.org/w/api.php"; 
	url = url + "?origin=*";
	Object.keys(params).forEach(function(key){url += "&" + key + "=" + params[key];});
    return httpGet(url);
}

function tt() {
	var zustand2level = {"unkorrigiert": 1, "korrigiert": 3, "fertig": 4};
    var title = mw.config.get('wgTitle');
    var article = document.editform.wpTextbox1.value;
    var str = article.match(/\| *BEARBEITUNGSSTAND *= *([a-z]+)/);
    var level = -1;
    if (str) {
    	level = zustand2level[str[1]];
    }
    if (level<0) {
    	return;
    }
	var params = {action: "query", titles: title, prop: "templates", format: "json", tllimit: "100" };
    var response = callWikiApi(params);
    var templates = Object.values(JSON.parse(response)['query']['pages'])[0]['templates'];
	console.log(templates);
	for (var idx in templates) {
		template = templates[idx];
		if (template['ns']==102) {
			title = template['title'];
			console.log(title);
			params = {action: "query", titles: title, prop: "pageprops", format: "json" };
			response = callWikiApi(params);
			var pageprops = Object.values(JSON.parse(response)['query']['pages'])[0]['pageprops'];
			console.log(pageprops['proofread_page_quality_level']);
			if (pageprops['proofread_page_quality_level']<level) {
				alert(title + " ist nicht mindestens auf Level + " + level + " sondern auf " + pageprops['proofread_page_quality_level']);
			}
		}
	}

}

function przu() {
  var article = document.editform.wpTextbox1.value;
  var textarea = document.querySelector("textarea").value; 
  var startPos = document.editform.wpTextbox1.selectionStart;
  var endPos = document.editform.wpTextbox1.selectionEnd;

  var beforeStr = article.substring(0, startPos);
  var titleStr = article.substring(startPos, endPos);
  var afterStr = article.substring(endPos);

  document.editform.wpTextbox1.value = beforeStr + "{{PRZU}}" + afterStr;
}

function newPage(year, page, para) {
	var glSeit = "{{SeitePR|<SEITE>|Die Gartenlaube (18<JAHR>) <SEITE>.jpg<PARA>}}";
	glSeit = glSeit.replace(/<JAHR>/, year);
    glSeit = glSeit.replace(/<SEITE>/, page);
    if (page<10) {
        glSeit = glSeit.replace(/<SEITE>/, "00" + page);
    } else if (page<100) {
    	glSeit = glSeit.replace(/<SEITE>/, "0" + page);
    } else {
        glSeit = glSeit.replace(/<SEITE>/, page);
    }
    glSeit = glSeit.replace(/<PARA>/, para);
    return glSeit;
}

function gl() {
	var jahr = myPrompt("Jahr: ");
	//var jahr = 68;
	var heft = myPrompt("Heft: ");
	var seite = myPrompt("Seite(n): ");
	heft = heft.replace(/-/g, "–");
	seite = seite.replace(/-/g, "–");

	var glArt = "{{GartenlaubenArtikel\n|VORIGER=\n|NÄCHSTER=\n|AUTOR=[[]]\n|TITEL=<TITEL>\n|JAHR=18<JAHR>\n|Heft=<HEFT>\n|Seite=<SEITE>\n|BILD=\n|KURZBESCHREIBUNG=\n|WIKIPEDIA=\n|SONSTIGES=\n|BEARBEITUNGSSTAND=korrigiert\n}}\n\n{{BlockSatzStart}}\n<SEITEN>{{BlockSatzEnd}}";
    //glArt += "\n\n[[Kategorie:Gedicht]]";
    str = mw.config.get('wgTitle');
    str2 = str.match(/(.*) \(.*\)/);
    var title = "";
    if (str2) {
        title = str2[1];
    } else {
    	title = str;
    }
	glArt = glArt.replace(/<TITEL>/, title);
	glArt = glArt.replace(/<JAHR>/, jahr);
	glArt = glArt.replace(/<HEFT>/, heft);
	glArt = glArt.replace(/<SEITE>/, seite);

	var seiten = "";
	var ranges = seite.split(","); 
	for (var i = 0; i < ranges.length; i++) {
	    var range = ranges[i].trim().split("–"); 
        if (range.length==1) {
        	seiten += newPage(jahr, range[0], "|2") + "\n";
        } else if (range.length==2) {
      		for (var j = range[0]; j <= range[1]; j++) {
      			var glSeit1 = "";
      			if (j==range[0]) {
	    			glSeit1 = newPage(jahr, j, "|2");
	    		} else if (j==range[1]) {
	    			glSeit1 = newPage(jahr, j, "|1");
	    		} else {
	    			glSeit1 = newPage(jahr, j, "");
	    		}
      			seiten += glSeit1 + "\n";
      		}	
        }
	}
	glArt = glArt.replace(/<SEITEN>/, seiten);
	document.editform.wpTextbox1.value = glArt;
	
	document.getElementById("wpWatchthis").checked = true;
    document.getElementById("wpSummary").value = "Initialer Artikel";
    
    var pos = glArt.indexOf("|VORIGER=");
    textSelect(document.editform.wpTextbox1, pos+9, pos+9);
}

// [[Datei:Um_ein_blondes_Frauenhaar.pdf|Wikisource]]
function vl() {
	var article = document.editform.wpTextbox1.value;

        //preprocessing
        article = article.replace(/https*:\/\/dibiki\.ub\.uni\-kiel\.de\/viewer\/resolver\?/g, "http://nbn-resolving.de/urn/resolver.pl?");
        article = article.replace(/https*:\/\/digital\.ub\.uni\-duesseldorf\.de\/urn\//g, "http://nbn-resolving.de/urn/resolver.pl?");
        article = article.replace(/https*:\/\/www\.dilibri\.de\/urn\//g, "http://nbn-resolving.de/urn/resolver.pl?");
        article = article.replace(/https*:\/\/brema\.suub\.uni\-bremen\.de\/urn\//g, "http://nbn-resolving.de/urn/resolver.pl?");
        article = article.replace(/https*:\/\/digital\.bibliothek\.uni\-halle\.de\/urn\//g, "http://nbn-resolving.de/urn/resolver.pl?");
        article = article.replace(/https*:\/\/digital\.blb\-karlsruhe\.de\/urn\//g, "http://nbn-resolving.de/urn/resolver.pl?");
        //article = article.replace(/http:\/\/sammlungen\.ub\.uni\-frankfurt\.de\/freimann\/urn/g, "http://sammlungen.ub.uni-frankfurt.de/urn");
        article = article.replace(/https*:\/\/sammlungen\.ub\.uni\-frankfurt\.de\/urn\//g, "http://nbn-resolving.de/urn/resolver.pl?");
        article = article.replace(/https*:\/\/www\.mdz\-nbn\-resolving\.de/g, "http://nbn-resolving.de");
        //article = article.replace(/http:\/\/sammlungen\.ulb\.uni\-muenster\.de\/urn\//g, "http://nbn-resolving.de/urn/resolver.pl?");
        article = article.replace(/https*:\/\/www\.nbn\-resolving\.de/g, "http://nbn-resolving.de");
	article = article.replace(/http:\/\/nbn\-resolving\.de\/urn\/resolver\.pl\?urn=/g, "http://nbn-resolving.de/");
        article = article.replace(/https*:\/\/nbn\-resolving\.de\/urn\/resolver\.pl\?urn:/g, "http://nbn-resolving.de/urn:");
	
        //UB Augsburg
	article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:bvb:384\-uba([\d\-]+).+?\]/g, "{{Aug|$1}}");

        //SB Bamberg
	article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:bvb:22-dtl-(\d+).+?\]/g, "{{Bam|$1}}");

        //ZLB Berlin
	article = article.replace(/\[https*:\/\/opus\.kobv\.de\/zlb\/volltexte\/(\d+)\/(\d+).+?\]/g, "{{ZLBB|$1/$2}}");

        //ULB Bonn
	article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:hbz:5:([\d\-]+).+?\]/g, "{{Bonn|$1}}");

        //SUUB Bremen
	article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:gbv:46:([\d\-]+).+?\]/g, "{{Brem|$1}}");

        //TU Braunschweig
        article = article.replace(/\[https*:\/\/www\.digibib\.tu-bs\.de\/\?docid=([0-9]+) .+?\]/g, "{{Braun|$1}}");

        //Deutsches Textarchiv
        article = article.replace(/\[https*:\/\/www\.deutschestextarchiv\.de\/(\w+) .+?\]/g, "{{DTA|$1}}");

        //SLUB Dresden
        article = article.replace(/\[https*:\/\/digital\.slub-dresden\.de\/ppn([\-\w]+)\/([0-9]+) .+?\]/g, "{{SLUB|$1|$2}}");
        article = article.replace(/\[https*:\/\/digital\.slub-dresden\.de\/ppn([\-\w]+) .+?\]/g, "{{SLUB|$1}}");
        article = article.replace(/\[https*:\/\/digital\.slub-dresden\.de\/id([\-\w]+)\/([0-9]+) .+?\]/g, "{{SLUB|$1|$2}}");
        article = article.replace(/\[https*:\/\/digital\.slub-dresden\.de\/id([\-\w]+) .+?\]/g, "{{SLUB|$1}}");
 
        //ULB Düsseldorf
     	article = article.replace(/\[http:\/\/nbn\-resolving\.de\/urn:nbn:de:hbz:061:([\w\-]+).+?\]/g, "{{Düss|$1}}");
     	article = article.replace(/\[https*:\/\/digital\.ub\.uni\-duesseldorf\.de\/content\/pageview\/([0-9]+) .+?\]/g, "{{Düss1|$1}}");
     	article = article.replace(/\[https*:\/\/digital\.ub\.uni\-duesseldorf\.de\/ihd\/content\/pageview\/([0-9]+) .+?\]/g, "{{Düss1|$1}}");
     	article = article.replace(/\[https*:\/\/digital\.ub\.uni\-duesseldorf\.de\/ihd\/periodical\/pageview\/([0-9]+) .+?\]/g, "{{Düss1|$1}}");
     	article = article.replace(/\[https*:\/\/digital\.ub\.uni\-duesseldorf\.de\/ulbdsp\/periodical\/pageview\/([0-9]+) .+?\]/g, "{{Düss1|$1}}");
     	article = article.replace(/\[https*:\/\/digital\.ub\.uni\-duesseldorf\.de\/content\/titleinfo\/([0-9]+) .+?\]/g, "{{Düss2|$1}}");
     	article = article.replace(/\[https*:\/\/digital\.ub\.uni\-duesseldorf\.de\/ihd\/content\/titleinfo\/([0-9]+) .+?\]/g, "{{Düss2|$1}}");
     	article = article.replace(/\[https*:\/\/digital\.ub\.uni\-duesseldorf\.de\/ihd\/periodical\/titleinfo\/([0-9]+) .+?\]/g, "{{Düss2|$1}}");
     	article = article.replace(/\[https*:\/\/digital\.ub\.uni\-duesseldorf\.de\/ulbdsp\/periodical\/titleinfo\/([0-9]+) .+?\]/g, "{{Düss2|$1}}");


        //UB Frankfurt am Main
        //article = article.replace(/\[http:\/\/nbn\-resolving\.de\/urn:nbn:de:hebis:30\-(\d+).+?\]/g, "{{FM|$1}}");
        //article = article.replace(/\[http:\/\/nbn\-resolving\.de\/urn:nbn:de:hebis:30:([\d\-]+).+?\]/g, "{{FM|$1}}");
        //Problem: http://nbn-resolving.de/urn:nbn:de:hebis:30:3-559427 vs. {{FM|3-559427}}
        
        
        //UB Göttingen
        article = article.replace(/\[https*:\/\/resolver\.sub\.uni\-goettingen\.de\/purl\?PPN(\w+).+?\]/g, "{{GDZ|$1}}");

        //ULB Halle
        article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:gbv:3:([\w\-]+).+?\]/g, "{{Halle|$1}}");

        //Internet Archive
        article = article.replace(/\[https*:\/\/www\.archive\.org\/details\/(\w+) .+?\]/g, "{{IA|$1}}");
        article = article.replace(/\[https*:\/\/archive\.org\/details\/(\w+) .+?\]/g, "{{IA|$1}}");

        //Thüringer Landes- und Universitätsbibliothek Jena
        article = article.replace(/\[https*:\/\/zs\.thulb\.uni-jena\.de\/receive\/jportal_jpjournal_([0-9]+)[; \?].*?\]/g, "{{Thulb|$1|j}}");
        article = article.replace(/\[https*:\/\/zs\.thulb\.uni-jena\.de\/receive\/jportal_jpvolume_([0-9]+)[; \?].*?\]/g, "{{Thulb|$1|v}}");
        article = article.replace(/\[https*:\/\/zs\.thulb\.uni-jena\.de\/receive\/jportal_jparticle_([0-9]+)[; \?].*?\]/g, "{{Thulb|$1|a}}");
        article = article.replace(/\[https*:\/\/zs\.thulb\.uni-jena\.de\/receive\/jportal_person_([0-9]+)[; \?].*?\]/g, "{{Thulb|$1|p}}");

        //BLB Karlsruhe
        article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:bsz:31-(\d+).+?\]/g, "{{BLB|$1}}"); 

        //UB Kiel
        article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:gbv:8:([\d\-]+).+?\]/g, "{{Kiel|$1}}");

        //Dilibri Koblenz
        article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:0128-([\d\-]+).+?\]/g, "{{Dilibri|$1}}");

        //UB Michigan
        article = article.replace(/\[https*:\/\/quod\.lib\.umich\.edu\/cgi\/t\/text\/pageviewer-idx.*idno=([\w\.]+);.*seq=(\d+).*?\]/g, "{{UMDL|$1|$2}}");

        //BSB München
        article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:bvb:12\-bsb([\w\-]+) .+?\]/g, "{{MDZ|$1}}");
        article = article.replace(/\[https*:\/\/reader\.digitale\-sammlungen\.de\/de\/fs1\/object\/display\/bsb([0-9]+)_0+([0-9]+)\.html .+?\]/g, "{{MDZ|$1|$2}}");
        article = article.replace(/\[https*:\/\/reader\.digitale\-sammlungen\.de\/de\/fs1\/object\/goToPage\/bsb([0-9]+)\.html\?pageNo=([0-9]+) .+?\]/g, "{{MDZ|$1|$2}}");

        //UB München
        article = article.replace(/\[https*:\/\/epub\.ub\.uni-muenchen\.de\/(\d+).+?\]/g, "{{LMU|$1}}");

        //ULB Münster
        //article = article.replace(/\[http:\/\/nbn\-resolving\.de\/urn:nbn:de:hbz:6:([\d\-]+).+?\]/g, "{{Münster|$1}}");
        //article = article.replace(/\[http:\/\/nbn\-resolving\.de\/urn:nbn:de:hbz:6\-([\d\-]+).+?\]/g, "{{Münster|$1}}");

        //UB Regensburg
        article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:bvb:355\-ubr([\d\-]+).+?\]/g, "{{UBR|$1}}");

        //UB Tartu
        article = article.replace(/\[https*:\/\/hdl\.handle\.net\/10062\/(\d+).+?\]/g, "{{Tartu|$1}}");
        
        //Handle
        article = article.replace(/\[https*:\/\/hdl\.handle\.net\/([\.\d]+)\/(.+?) (.+?)\]/g, "{{Handle|$1|$2|$3}}");
        article = article.replace(/urlappend%3D;seq%3D/g, 'urlappend%3D;seq%3D');
        
        //UB Heidelberg
        article = article.replace(/\[https*:\/\/digi\.ub\.uni\-heidelberg\.de\/diglit\/([a-zA-Z0-9_]+) .+?\]/g, "{{Heidi|$1}}");
        article = article.replace(/\[https*:\/\/digi\.ub\.uni\-heidelberg\.de\/([a-zA-Z0-9_]+) .+?\]/g, "{{Heidi|$1}}");
        article = article.replace(/\[https*:\/\/digi\.ub\.uni\-heidelberg\.de\/diglit\/([a-zA-Z0-9_]+)\/([0-9]+) .+?\]/g, "{{Heidi|$1|$2}}");
        article = article.replace(/\[https*:\/\/digi\.ub\.uni\-heidelberg\.de\/([a-zA-Z0-9_]+)\/([0-9]+) .+?\]/g, "{{Heidi|$1|$2}}");

        //UB Tübingen
        article = article.replace(/\[https*:\/\/idb\.ub\.uni-tuebingen\.de\/diglit\/([_\-\w]+)\/(\d+).+?\]/g, "{{TÜB|$1|$2}}");
        article = article.replace(/\[https*:\/\/idb\.ub\.uni-tuebingen\.de\/diglit\/([_\-\w]+)\/.+?\]/g, "{{TÜB|$1}}");
        article = article.replace(/\[https*:\/\/idb\.ub\.uni-tuebingen\.de\/diglit\/([_\-\w]+?) .+?\]/g, "{{TÜB|$1}}");

        //UB Weimar
        article = article.replace(/\[https*:\/\/goobipr2\.uni-weimar\.de\/viewer\/resolver.*?wim2-g-(\d+).+?\]/g, "{{WEI|$1}}");

        //HAB Wolfenbüttel
        article = article.replace(/\[https*:\/\/nbn\-resolving\.de\/urn:nbn:de:gbv:23\-drucke\/([\w\-]+).+?\]/g, "{{HAB|$1}}");

        //e-rara.ch
        article = article.replace(/\[https*:\/\/www\.e-rara\.ch\/doi\/10\.3931\/e\-rara\-(\d+).+?\]/g, "{{E-rara|$1}}");

        //BBAW
        article = article.replace(/\[https*:\/\/bibliothek.bbaw.de\/bbaw\/bibliothek-digital\/digitalequellen\/schriften\/anzeige\/index_html\?band=([0-9a-z\/\-]+)\&seite:int=([0-9]+) .+?\]/g, "{{BBAW|$1|$2}}");
        article = article.replace(/\[https*:\/\/bibliothek.bbaw.de\/bibliothek-digital\/digitalequellen\/schriften\/anzeige\/index_html\?band=([0-9a-z\/\-]+)\&seite:int=([0-9]+) .+?\]/g, "{{BBAW|$1|$2}}");
        article = article.replace(/\[https*:\/\/bibliothek.bbaw.de\/bibliothek-digital\/digitalequellen\/schriften\/anzeige\?band=([0-9a-z\/\-]+)\&seite:int=([0-9]+) .+?\]/g, "{{BBAW|$1|$2}}");

        //WLB
        article = article.replace(/\[https*:\/\/digital.wlb-stuttgart.de\/purl\/([a-z0-9X\-]+) .+?\]/g, "{{WLB|$1}}");
        
        //RosDok
        article = article.replace(/\[https*:\/\/purl\.uni-rostock.de\/rosdok\/([a-z0-9]+) .+?\]/g, "{{RosDok|$1}}");
        
        //GND
        article = article.replace(/\[https*:\/\/d-nb\.info\/([X0-9]+) .+?\]/g, "{{GND|$1}}");
        article = article.replace(/\[https*:\/\/d-nb\.info\/gnd\/([X0-9]+) .+?\]/g, "{{GND|$1}}");

        //Google Books
	    article = article.replace(/\[https*:\/\/books\.google\.[comde]+\/books\?id=([a-zA-Z0-9_\-]+).*&pg=([a-zA-Z0-9_\-]+).*? .*?\]/g, "{{GBS|$1|$2}}");
	    article = article.replace(/\[https*:\/\/books\.google\.[comde]+\/books\?id=([a-zA-Z0-9_\-]+).*? .*?\]/g, "{{GBS|$1}}");
	    
	    //HAAB
        article = article.replace(/\[https*:\/\/ora-web.swkk.de\/digimo_online\/digimo.entry\?source=digimo.Digitalisat_anzeigen&a_id=([0-9]+) .+?\]/g, "{{HAAB|$1}}");

        //Zedler
        article = article.replace(/http:\/\/www\.zedler\-lexikon\.de\/blaettern\/einzelseite\.html\?/g, "https://www.zedler-lexikon.de/index.html?c=blaettern&");
        
        //Co
        article = article.replace(/\[https*:\/\/commons\.wikimedia\.org\/w\/index\.php\?title=File\%3A(.+?)\&page=([0-9]+) .+?\]/g, "{{Co|$1|$2}}");
        article = article.replace(/\[https*:\/\/commons\.wikimedia\.org\/w\/index\.php\?title=File:(.+?)\&page=([0-9]+) .+?\]/g, "{{Co|$1|$2}}");
        article = article.replace(/\[https*:\/\/commons\.wikimedia\.org\/w\/index\.php\?title=File:(.+?)\&page=([0-9]+) .+?\]/g, "{{Co|$1|$2}}");
        article = article.replace(/\[https*:\/\/commons\.wikimedia\.org\/wiki\/(File:.+?) +(.+?)\]/g, "[[:$1|$2]]");


        //http://xx.wikisource.org
        article = article.replace(/\[https*:\/\/(\w\w)\.wikisource\.org\//g, "[https://$1.wikisource\.org\/");

        //https://de.wikisource.org
        //article = article.replace(/\[https*:\/\/de.wikisource\.org\/wiki\/(.*?) (.*?)\]/g, "[[$1|$2]]");

        //https://xx.wikisource.org
        article = article.replace(/\[https*:\/\/de\.wikisource\.org\/wiki\/(.*?) (.*?)\]/g, "[[$1|$2]]");
        article = article.replace(/\[https*:\/\/(\w\w)\.wikisource\.org\/wiki\/(.*?) (.*?)\]/g, "[[:$1:$2|$3]]");
        
        article = article.replace(/\[\[doi:(.*?)\|(.*?)\]\]/g, "{{DOI|$1|$2}}");
        article = article.replace(/\[\[doi:(.*?)\]\]/g, "{{DOI|$1}}");
        
        article = article.replace(/\[\[iarchive:(.*?)\|(.*?)\]\]/g, "{{IA|$1}}");
        article = article.replace(/\[\[iarchive:(.*?)\]\]/g, "{{IA|$1}}");

	if (document.editform.wpTextbox1.value!=article) {
		document.editform.wpTextbox1.value = article;
		document.getElementById("wpWatchthis").checked = true;
    	        document.getElementById("wpSummary").value = "[[Wikisource:Verlinkungen]]";
	}
}

function startUp() {

  var article = document.editform.wpTextbox1.value;
  //article = article.replace(/([a-zäöüß])scb([a-zäöüß])/ig, "$1sch$2"); 
  document.editform.wpTextbox1.value = article;
  document.getElementById("wpWatchthis").checked = true;
  //document.getElementById("wpMinoredit").checked = true;
  //document.getElementById("wpSummary").value = "minor";

  if (typeof $.fn.wikiEditor != 'undefined') {
   var name = mw.config.get('wgTitle');


    // Execute on load
    $( function() {
       $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'CL',
            type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
			action: {
              type: 'callback',
              execute: function() {
                 clean();
              }
            }
          }
        }
      } );

      $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'RE',
            type: 'button',
            icon: 'LINK.png',
            action: {
              type: 'callback',
              execute: function() {
                 replace();
              }
            }
          }
        }
      } );

     $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'BU',
            type: 'button',
            icon: 'LINK.png',
            action: {
              type: 'callback',
              execute: function() {
                 bru();
              }
            }
          }
        }
      } );

      $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'IB',
            type: 'button',
            icon: 'LINK.png',
            action: {
              type: 'callback',
              execute: function() {
                 insertBru();
              }
            }
          }
        }
      } );

      $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'PR',
            type: 'button',
            icon: 'LINK.png',
            action: {
              type: 'callback',
              execute: function() {
                 przu();
              }
            }
          }
        }
      } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'SEC',
            type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
            action: {
              type: 'callback',
              execute: function() {
                 sec();
              }
            }
          }
        }
      } );

     $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'NB',
            type: 'button',
            icon: 'LINK.png',
            action: {
              type: 'callback',
              execute: function() {
                 nbsp();
              }
            }
          }
        }
      } );

     $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'AUT',
            type: 'button',
            icon: 'LINK.png',
            action: {
              type: 'callback',
              execute: function() {
                 autor();
              }
            }
          }
        }
      } );
   
      $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'US',
            type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
            action: {
              type: 'callback',
              execute: function() {
                 ueberschrift();
              }
            }
          }
        }
      } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'TT',
            type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Gnome-face-smile.svg/22px-Gnome-face-smile.svg.png',
            action: {
              type: 'callback',
              execute: function() {
                 tt();
              }
            }
          }
        }
      } );

    $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'PRZU',
            type: 'button',
            icon: 'LINK.png',
            action: {
              type: 'callback',
              execute: function() {
                 przu();
              }
            }
          }
        }
      } );
      
     $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'GL',
            type: 'button',
            action: {
              type: 'callback',
              execute: function() {
                 gl();
              }
            }
          }
        }
      } );

      $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
        'section': 'main',
        'group': 'insert',
        'tools': {
          'pretext': {
            label: 'VL',
            type: 'button',
            action: {
              type: 'callback',
              execute: function() {
                 vl();
              }
            }
          }
        }
      } );

    } );
  }
}

$( '#wpTextbox1' ).on( 'wikiEditor-toolbar-doneInitialSections', function () {
    startUp();
} );

//setTimeout("startUp()", 1000);
// </nowiki>