Jump to content

User:Jnanaranjan sahu/common.js

From Wikipedia, the free encyclopedia

This is the current revision of this page, as edited by Jnanaranjan sahu (talk | contribs) at 21:27, 18 September 2023 (Installing User:Qwerfjkl/scripts/script_manager.js (script-installer)). The present address (URL) is a permanent link to this version.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <nowiki>
window.wpDarkModeAutoToggle = true;
/**
 * Blendet eine „Auto-Format“-Funktion in der Werkzeugleiste ein, die viele typische Wikifizierungs-Fehler
 * automatisch korrigiert. Eine ausführliche Beschreibung ist auf der Diskussionsseite zu finden.
 * (<nowiki> zur Umgehung von [[bugzilla:8761]].)
 */
 //alert('hi');
mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Harsh4101991/EditCount.js&action=raw&ctype=text/javascript');importScript('User:Harsh4101991/EditCount.js');
//importScript('User:Harsh4101991/EditCount.js'); 

if ( $( "#odia-converter" ).length ) 
 {
 	code = $('#hidden-code').text();
 	html = $('#hidden-html-code').html();
    $('#odia-converter').html(code+html);
 }
 
/*
if(document.getElementById("odia-coverter"))
{
   alert("it's there catch him");
   //alert(document.getElementById("od2").innerHTML); 
   var new_html=document.getElementById("odia-coverter").getAttribute("value");
   alert(new_html);
   //new_html = document.getElementById("od2").innerHTML;
   //$('#odia-coverter').html(new_html);
}

var html = '<div class="Section1">'+

'<p style="text-align:center" align="center"><font size="5" face="sans-serif"><b><span style="color:#316E89"> Akruti Sarala - Unicode Odia converter </span></b></font><br><font face="sans-serif">Copy Akruti Sarala text and paste below</font></p>'+
'<form name="form1">'+
'<p style="text-align:center" align="center"><textarea style="width: 1148px; height: 232px;" rows="10" cols="110%" name="TextToConvert" id="legacy_text"></textarea></p>'+
'<p style="text-align:center" align="center">'+
'<input name="converter" id="converter" value=" CONVERT " style="width:90px;float:center;background-color:#4AAAD1;color:#FFFFFF;font-weight:bold;margin-left:4px;padding:8px;" accesskey="c" title="Alt + Shift + c" onclick="convert_to_unicode();" type="button"><br><br>'+
'<align=center style="text-align:center"><font size="3" face="sans-serif">Converted Unicode text below<br>'+
'<font size="2" face="sans-serif"><span style="color:#606060">You can copy and use the text below in Facebook, E-mail, blogs, websites and <a href="https://or.wikipedia.org/wiki/WP:CS">ODIA WIKIPEDIA.</a></span></font>'+
'<textarea style="width: 1150px; height: 495px;" rows="30%" cols="110%" name="ConvertedText" id="unicode_text"></textarea><o:p></o:p></font></align=center></p><font size="3" face="sans-serif">'+
'<p style="text-align:center" align="center"><span style="color:#515151"><font size="2">Designed by <a href="http://in.linkedin.com/in/manojsahukar/" target="_blank" title="Reach to me">Manoj Sahukar</a> and <a href="https://meta.wikimedia.org/wiki/User:Psubhashish" target="_blank" title="Reach to me">Subhashish Panigrahi</a>. Under CC-BY-SA 3.0. Inspired by Rebati converter by Srujanika.<br><a href="https://22bc339da9ca3e2462414546a715752e4c2c5e0d.googledrive.com/host/0B5rBGd680WZFemVLa3RxY0preE0/ShreeUnicode" target="_blank" title="Click here"> Click here</a><a> for Shreelipi-Unicode converter.</a></font></span></p><a>'+
'</a></font></form></div><font size="3" face="sans-serif"><a>'+
'</a></font><div style="display: none; top: 239px; left: 1103.98px; opacity: 1; margin-top: 0px;" class="imeselector imeselector-toggle"><a class="ime-name imeselector-toggle" href="#"></a><b class="ime-setting-caret imeselector-toggle"></b><div style="" class="imeselector-menu" role="menu"><h3 class="ime-list-title autonym">ଓଡ଼ିଆ</h3><ul class="ime-list"><li class="ime-im selectable-row" data-ime-inputmethod="or-phonetic"><span class="ime-im-check"></span><a class="selectable-row-item" href="#">ଫୋନେଟିକ</a><a class="ime-perime-help" title="How to use" target="_blank" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/or-phonetic"></a></li><li class="ime-im selectable-row" data-ime-inputmethod="or-transliteration"><span class="ime-im-check"></span><a class="selectable-row-item" href="#">ଟ୍ରାନ୍ସଲିଟରେସନ</a><a class="ime-perime-help" title="How to use" target="_blank" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/or-transliteration"></a></li><li class="ime-im selectable-row" data-ime-inputmethod="or-inscript"><span class="ime-im-check"></span><a class="selectable-row-item" href="#">ଇନସ୍କ୍ରିପ୍ଟ</a><a class="ime-perime-help" title="How to use" target="_blank" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/or-inscript"></a></li><li class="ime-im selectable-row" data-ime-inputmethod="or-inscript2"><span class="ime-im-check"></span><a class="selectable-row-item" href="#">ଇନସ୍କ୍ରିପ୍ଟ2</a><a class="ime-perime-help" title="How to use" target="_blank" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/or-inscript2"></a></li><li class="ime-im selectable-row" data-ime-inputmethod="or-lekhani"><span class="ime-im-check"></span><a class="selectable-row-item" href="#">ଲେଖନୀ</a><a class="ime-perime-help" title="How to use" target="_blank" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/or-lekhani"></a></li></ul><div class="ime-disable selectable-row ime-checked"><span data-i18n="jquery-ime-disable-text" class="ime-disable-link">System input method</span><span class="ime-disable-shortcut">CTRL+M</span></div><h3 data-i18n="jquery-ime-other-languages" class="ime-lang-title">Other languages</h3><div class="ime-language-list-wrapper"><ul class="ime-language-list"><li class="ime-lang selectable-row" lang="en"><a class="selectable-row-item autonym" href="#">English</a></li><li class="ime-lang selectable-row" lang="mr"><a class="selectable-row-item autonym" href="#">मराठी</a></li><li class="ime-lang selectable-row" lang="ne"><a class="selectable-row-item autonym" href="#">नेपाली</a></li><li style="display: none;" class="ime-lang selectable-row" lang="or"><a class="selectable-row-item autonym" href="#">ଓଡ଼ିଆ</a></li></ul></div><a class="ime-selector-more-languages selectable-row selectable-row-item">...</a><div class="ime-help-link selectable-row"><a data-i18n="jquery-ime-help" target="_blank" href="http://github.com/wikimedia/jquery.ime" class="selectable-row-item">Help</a></div></div></div><div style="display: none; top: 333.25px; left: 1103.98px; opacity: 1; margin-top: 0px;" class="imeselector imeselector-toggle"><a class="ime-name imeselector-toggle" href="#"></a><b class="ime-setting-caret imeselector-toggle"></b><div style="top: -229px;" class="imeselector-menu ime-position-top" role="menu"><h3 class="ime-list-title autonym">ଓଡ଼ିଆ</h3><ul class="ime-list"><li class="ime-im selectable-row" data-ime-inputmethod="or-phonetic"><span class="ime-im-check"></span><a class="selectable-row-item" href="#">ଫୋନେଟିକ</a><a class="ime-perime-help" title="How to use" target="_blank" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/or-phonetic"></a></li><li class="ime-im selectable-row" data-ime-inputmethod="or-transliteration"><span class="ime-im-check"></span><a class="selectable-row-item" href="#">ଟ୍ରାନ୍ସଲିଟରେସନ</a><a class="ime-perime-help" title="How to use" target="_blank" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/or-transliteration"></a></li><li class="ime-im selectable-row" data-ime-inputmethod="or-inscript"><span class="ime-im-check"></span><a class="selectable-row-item" href="#">ଇନସ୍କ୍ରିପ୍ଟ</a><a class="ime-perime-help" title="How to use" target="_blank" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/or-inscript"></a></li><li class="ime-im selectable-row" data-ime-inputmethod="or-inscript2"><span class="ime-im-check"></span><a class="selectable-row-item" href="#">ଇନସ୍କ୍ରିପ୍ଟ2</a><a class="ime-perime-help" title="How to use" target="_blank" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/or-inscript2"></a></li><li class="ime-im selectable-row" data-ime-inputmethod="or-lekhani"><span class="ime-im-check"></span><a class="selectable-row-item" href="#">ଲେଖନୀ</a><a class="ime-perime-help" title="How to use" target="_blank" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Extension:UniversalLanguageSelector/Input_methods/or-lekhani"></a></li></ul><div class="ime-disable selectable-row ime-checked"><span data-i18n="jquery-ime-disable-text" class="ime-disable-link">System input method</span><span class="ime-disable-shortcut">CTRL+M</span></div><h3 data-i18n="jquery-ime-other-languages" class="ime-lang-title">Other languages</h3><div class="ime-language-list-wrapper"><ul class="ime-language-list"><li class="ime-lang selectable-row" lang="en"><a class="selectable-row-item autonym" href="#">English</a></li><li class="ime-lang selectable-row" lang="mr"><a class="selectable-row-item autonym" href="#">मराठी</a></li><li class="ime-lang selectable-row" lang="ne"><a class="selectable-row-item autonym" href="#">नेपाली</a></li><li style="display: none;" class="ime-lang selectable-row" lang="or"><a class="selectable-row-item autonym" href="#">ଓଡ଼ିଆ</a></li></ul></div><a class="ime-selector-more-languages selectable-row selectable-row-item">...</a><div class="ime-help-link selectable-row"><a data-i18n="jquery-ime-help" target="_blank" href="http://github.com/wikimedia/jquery.ime" class="selectable-row-item">Help</a></div></div></div>'

function convert_to_unicode()
{

var array_one = new Array(

" û", " ।", // purnacheda
"ö" , " ।" , // purnacheda
"÷÷÷", "", //
// double accented - AkrutiOriSarala
"£" , "୍ମ" , // ma phala
"à" , "୍ମ" , // ma phala
"á" , "୍ମୃ" , // (halanta)m-Rû
"â" , "୍ର" , // ra
"ã" , "୍ର" , // reph
"ä" , "୍ଲ" , // la phala
"å" , "୍ଭ" , // halanta- bha
"æ" , "୍ଳ" , // halanta-La
"ç" , "୍ୱ" , // ba phala
"è" , "୍ସ" , // halanta-sa
"ý", "୍ୟ" , // ja phala
"¥", "୍ୟ" , // ja phala
"ó", "ିଁ" , // i kara

"Iß" , "ୱ", //wa
"Wÿ" , "ଡ଼" , // Da with bindu
"Xÿ" , "ଢ଼" , // Dha with bindu
"Pÿ" , "ଚ" , // c
"[ô" , "ଥି" , // thi
"]ô" , "ଧି" , // dhi
"Lô" , "ଖି" , // khi
"cô", "ତ୍ମ" , // tma

"û" , "ା" , // aa kara
"ò" , "ି" , // i kara
"ú" , "ୀ" , // dirgha i kara
"ê" , "ୁ" , // u kara
"ë" , "ୁ" , // u kara
"ì" , "ୂ" , // dirgha i kara
"í" ,  "ୂ" , // dirgha u kara
"é" , "ୃ" , // ru kara

"ñ", "ଁ" , // chandrabindu
"õ", "ଂ" , // anuswara
"ü", "ଃ" , // bisarga
"þ", "୍" , //halanta
"¨", "୍‍" , // halanta with zero width non joiner

"1" , "୧" , // Numeric 1
"2" , "୨" , // Numeric 2
"3" , "୩" , // Numeric 3
"4" , "୪" , // Numeric 4
"5" , "୫" , // Numeric 5
"6" , "୬" , // Numeric 6
"7" , "୭" , // Numeric 7
"8" , "୮" , // Numeric 8
"9" , "୯" , // Numeric 9
"0" , "୦" , // Numeric 10
"#" , "୰" , // late
"$" , "ଽ" , 
"&" , "ଌ" , // lu
"*" , "ଞ୍ଚ" , // nc
"" ,  "ଞ୍ଚ" , // nc
"î" , "୍ରୁ" , // halanta-r-u
"ï" , "୍ରୂ" , // halanta-r-dirgha u

"Ð" , "କ୍ଷ୍ଣ" , // khya-N
"Ñ" , "୍କ" ,  // halanta-k
"Ò" , "୍ଖ" , // halanta-kh
"Ó" , "୍ଗ" , // halanta-g
"Ô" , "୍ଚ" , // halanta-c
"Õ" , "୍ଜ" , // halanta-j
"Ö" , "୍ଟ" , // halanta-T
"×" , "୍ଠ" , // halanta-Th
"Ø" , "୍ଡ" , // halanta-D
"Ù" , "୍ଣ" , // halanta-N
"Ú" , "୍ଥ" , // halanta-th
"Û" , "୍ଧ" , // halanta-dh
"Ü" , "୍ନ" , // halanta-n
"Ý" , "୍ପ" , // halanta-p
"Þ" , "୍ଫ" , // halanta-ph
"ß" , "୍ୱ" , // halanta-b

"<" , "ଣ୍ଟ" , // NT
"" , "ଣ୍ଟ" , // NT
"…" , "ଟ୍ଟ" , // TT
"μ" , "ମ୍ପ" , // mp
"µ" , "ମ୍ପ" , // mp
"¶" , "ମ୍ଫ" , // mph
"‰" , "ଣ୍ଣ" , // NN
"Š" , "ଣ୍ଡ" , // ND

"Œ" , "ଣ୍ଠ" , // NTh
"™" , "ତ୍ମ" , // tm
"š" , "ତ୍ପ" , // tp
"›" , "ତ୍ସ" , // ts
"œ" , "ତ୍ସ୍ନ" , // t-s-n
"Ÿ" , "ଦ୍ଧ" , // d-dh


"{" , "ଜ୍ଜ" , // jj
"|" , "ଜ୍ଝ" , // j-jh
"}" , "କ୍ର" , // kr

"¡" , "ଦ୍ଧ" , // d-dh
"¢" , "ଦ୍ଘ" , // d-gh
"¤" , "ଧ୍ୟ" , // dhya
"¦" , "ନ୍ଦ" , // nd
"§" , "ନ୍ଧ" , // ndh
"©" , "ତ୍ତ" , // tt
"" , "ତ୍ତ" , // tt
"ª" , "ନ୍ତ୍ର" , // ntr (jantra)
"«" , "ନ୍ତ" , // nt
"¬" , "ଞ୍ଜ" , // nj
"ƒ" , "ଞ୍ଝ" , // njh
"®" , "ପ୍ପ" , // pp
"¯" , "ପ୍ତ" , // pt

"°", "ପ୍ସ" , // ps
"±" , "ବ୍ଦ" , // bd
"²" , "ବ୍ଧ" , // bdh
"´" , "ମ୍ବ" , // mb
"¸" , "ମ୍ଭ" , // mbh
" ̧" , "ମ୍ଭ", // ***mbha
"̧" , "ମ୍ଭ", // mbha
"¹" , "ମ୍ମ" , // mm
"º" , "ଲ୍କ" , // lk
"»" , "ଲ୍ଗ" , // lg
"¼" , "ଶ୍ଛ" , // Nch
"½" , "ଶ୍ଚ" , // S-ch (talabya sa - ca)
"¾" , "ଷ୍ଣ" , // sh-N (murdhanya sa - Na)
"¿" , "ଷ୍ପ" , // sh-p (murdhanya sa - pa)

"À" , "ଷ୍ଫ" , // sh-ph (murdhanya sa - pha)
"Á" , "ଷ୍ଟ" , // sh-T (murdhanya sa - Ta)
"Â" , "ଷ୍ଠ" , // sh-Th (murdhanya sa - Tha)
"Ã" , "ଷ୍କ" , // sh-k (murdhanya sa - ka)
"Ä" , "ସ୍କ" , // s-k
"Å" , "ସ୍ଖ" , // sh-kh
"Æ" , "ସ୍ପ" , // sp
"Ç" , "ସ୍ଫ" , // sph
"È" , "ସ୍ତ୍ର" , // str
"É" , "ସ୍ତ" , // st
"Ê" , "ସ୍ୱ" , // sb
"Ë" , "ଳ୍କ" , // lk
"Ì" , "ଳ୍ପ" , // Lp
"Í" , "ଳ୍ଫ" , // Lph
"Î" , "ତ୍ଥ" , // t-th
"" , "ତ୍ଥ" , // t-th
"Ï" , "ଳ୍ଳ" , // L-L

"@ା" , "ଆ" , // aa
"@" , "ଅ" , // a
"A" , "ଇ" , // i
"B" , "ଈ" , // dirgha i
"C" , "ଉ" , // u
"D" , "ଊ" , // dirgha u
"E" , "ଋ" , // R
"F" , "ୠ" , // RR
"G" , "ଏ" , // e
"H" , "ଐ" , // ai
"I" , "ଓ" , // o
"J" , "ଔ" , // au 

"K" , "କ" , // k
"L" , "ଖ" , // kh
"M" , "ଗ" , // g
"N" , "ଘ" , // gh
"O" , "ଙ" ,

"P" , "ଚ",  // c
"Q" , "ଛ", // ch
"R" , "ଜ", // j
"S" , "ଝ", // jh
"T" , "ଞ", // Nya

"U", "ଟ" , // T
"V", "ଠ" , // Th
"W", "ଡ" , // D
"X", "ଢ" , // Dh
"Y", "ଣ" , // N
"Z" , "ତ" , // t
"[" , "ଥ" , // th
"\\" , "ଦ" , // d
"]" , "ଧ" , // dh
"^", "ନ" , // n
"~" , "ଯ" , // y
"_" , "ପ", // p
"`" , "ଫ", // ph
"a" , "ବ", // b
"b" , "ଭ", // bh
"c" , "ମ", // m
"d" , "ୟ" , // y
"e" , "ର" , // r
"f" , "ଲ" , // l
"g" , "ଶ" , // S (talabya sa)
"h" , "ଷ" , // sh (murdhanya sa)
"i" , "ସ" , // s
"j" , "ହ" , // h
"k" , "ଳ" , // L
"l" , "କ୍ଷ" , // ksh
"m" , "ଜ୍ଞ" , // gya
"n" , "ଦ୍ଭ" , // d-bh
"o" , "କ୍ଟ" , // kT
"p" , "କ୍ଟ୍ର" , // kTr
"q" , "କ୍ତ" , // kt
"r" , "କ୍ସ" , // ks
"s" , "ଗ୍ଦ" , // gd
"t" , "ଗ୍ଧ" , // gdh
"u" , "ଙ୍କ" , 
"v" , "ଙ୍ଖ" ,
"w" , "ଙ୍ଗ" ,
"x" , "ଙ୍ଘ" ,
"y" , "ଚ୍ଚ" ,
"z" , "ଚ୍ଛ" ,
" ̄", "ପ୍ତ",
" ́", "ମ୍ବ",
"‹", "ଣ୍ଢ" , // ndha
"ଏø", " ଐ", // ai
"୍ଯ" , "୍ୟ", // ja phala
" ̈", "୍‍", // halanta with ZWJ
"ଅା", "ଆ" ) // aa


//**********************************************

    var array_one_length = array_one.length ;

    var modified_substring = document.getElementById("legacy_text").value  ;	
	
  document.getElementById("unicode_text").value = "Conversion in progress.."  ;  

//****************************************************
//  Break the long text into small bunches of chunk_size  characters each.
//****************************************************
    var text_size = modified_substring.length ;

    var processed_text = '' ;  //blank

    var sthiti1 = 0 ;  var sthiti2 = 0 ;  var chale_chalo = 1 ;
 
    var chunk_size = 6000; // this character long text will be processed in one go.

    while ( chale_chalo == 1 ) 
    {
     sthiti1 = sthiti2 ;

     if ( sthiti2 < ( text_size - chunk_size ) )  
     { 
      sthiti2 +=  chunk_size ;
//      while (document.getElementById("legacy_text").value.charAt ( sthiti2 ) != ' ') {sthiti2--;} 
//This was making problem if there is no 'space' in the whole document.
     } 
     else  { sthiti2 = text_size  ;  chale_chalo = 0 }

  var modified_substring = document.getElementById("legacy_text").value.substring ( sthiti1, sthiti2 )  ;

  Replace_Symbols( ) ;

  var processed_text = processed_text + modified_substring ;
	  
document.getElementById("unicode_text").value = "Conversion in progress.." + '\n\n' + 'Conversion of ' + sthiti2 + ' charecters out of ' + text_size + ' completed.' ; 

    }
  
document.getElementById("unicode_text").value = processed_text  ;  


// --------------------------------------------------


function Replace_Symbols( )

{

//substitute array_two elements in place of corresponding array_one elements

if ( modified_substring != "" )  // if string to be converted is non-blank then no need of any processing.
{
for ( input_symbol_idx = 0;   input_symbol_idx < array_one_length-1;    input_symbol_idx = input_symbol_idx + 2 )

{ 
//******************************************************
idx = 0  ;  // index of the symbol being searched for replacement

while (idx != -1 ) //while-00
{

modified_substring = modified_substring.replace( array_one[ input_symbol_idx ] , array_one[input_symbol_idx+1] )
idx = modified_substring.indexOf( array_one[input_symbol_idx] )

} // end of while-00 loop

} // end of for loop

// following statements for adjusting position of e, ai, o and au maatraas.
	
modified_substring = modified_substring.replace( /([ù])([କଖଗଘଙଚଛଜଝଞଟଠଡଡ଼ଢଢ଼ଣତଥଦଧନପଫବଭମଯୟରଲବୱଶଷସହକ୍ଷଡ଼ଳ])/g , "$2$1" ) ;
//ଟଠଡଡ଼ଢଢ଼ଣତଥ
modified_substring = modified_substring.replace( /([ù])([୍])([କଖଗଘଚଛଜଝଟଠଡଡ଼ଢଢ଼ଣତଥନପଫବଭମୟରଲବୱଶଷସହକ୍ଷଡ଼ଳ])/g , "$2$3$1" ) ;

modified_substring = modified_substring.replace( /([ù])([୍])([କଖଗଘଚଛଜଝଟଠଡଡ଼ଢଢ଼ଣତଥନପଫବଭମୟରଲବୱଶଷସହକ୍ଷଡ଼ଳ])/g , "$2$3$1" ) ;

modified_substring = modified_substring.replace( /ùø/g  ,  "ୌ" ) ;

modified_substring = modified_substring.replace( /ùା/g  ,  "ୋ" ) ;

modified_substring = modified_substring.replace( /ù÷/g  ,  "ୈ" ) ;

modified_substring = modified_substring.replace( /ù/g  ,  "େ" ) ;

//following three statement for adjusting position of reph ie, half r .
modified_substring = modified_substring.replace( /([କଖଗଘଚଛଜଝଟଠଡଡ଼ଢଢ଼ଣତଥଦଧନପଫବଭମଯରଲଳଵଶଷସହକ୍ଷଜ୍ଞୟ])([ାିୀୁୂୃେୈୋୌଂଁ]*)à/g , "ð$1$2" ) ;
modified_substring = modified_substring.replace( /([କଖଗଘଚଛଜଝଟଠଡଡ଼ଢଢ଼ଣତଥଦଧନପଫବଭମଯରଲଳଵଶଷସହକ୍ଷଜ୍ଞୟ])([ାିୀୁୂୃେୈୋୌଂଁ]*)ð/g , "ð$1$2" ) ;

modified_substring = modified_substring.replace( /([କଖଗଘଚଛଜଝଟଠଡଡ଼ଢଢ଼ଣତଥଦଧନପଫବଭମଯରଲଳଵଶଷସହକ୍ଷଜ୍ଞୟ])([୍])à/g , "ð$1$2" ) ;
modified_substring = modified_substring.replace( /([କଖଗଘଚଛଜଝଟଠଡଡ଼ଢଢ଼ଣତଥଦଧନପଫବଭମଯରଲଳଵଶଷସହକ୍ଷଜ୍ଞୟ])([୍])ð/g , "ð$1$2" ) ;

modified_substring = modified_substring.replace( /ð/g , "ର୍" ) ;


modified_substring = modified_substring.replace( /([ଂଁ])([ାିୀୁୂୃେୈୋୌ])/g , "$2$1" ) ;



} // end of IF  statement  meant to  suppress processing of  blank  string.

} // end of the function  Replace_Symbols

} // end of convert_to_unicode function

function SelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}
alert(new_html); 
$('#odia-coverter').html(html);
*/
(function($, mw)
{
	if (typeof mw !== 'object' || (mw.config.get('wgAction') !== 'edit' && mw.config.get('wgAction') !== 'submit') ||
		typeof $ !== 'function')
		return;
 
	var autoFormatter = {
		click: function(a)
		{
			if (window.wikEd && window.wikEd.useWikEd) wikEd.UpdateTextarea();
			var e = document.forms['editform'].elements, textbox = e['wpTextbox1'], summary = e['wpSummary'];
			if (!textbox) return;
			this.clickedElement = a;
			this.isAll = false;
			this.isDisambiguation = /\{\{\s*[Bb]egriffsklärung\s*[|}]/.test(textbox.value);
			this.lang = mw.config.get('wgContentLanguage');
			this.localisation = typeof window.autoFormatLocalisation === 'undefined' ||
				window.autoFormatLocalisation === true ? this.lang : window.autoFormatLocalisation;
			this.cleanElement(textbox);
			summary.value = this.cleanInternalLinks(summary.value);
			if (window.wikEd && window.wikEd.useWikEd) wikEd.UpdateFrame();
			return false;
		},
		isChanged: function(oldValue, newValue)
		{
			/* Entfernte Leerräume am Textende zählen nie als Änderung */
			oldValue = oldValue.replace(/\s+$/, '');
			newValue = newValue.replace(/\s+$/, '');
			/* Entfernte Leerräume am Zeilenende nicht als Änderung anzeigen, aber trotzdem ersetzen */
			var changed = oldValue.replace(/[\t\r ]+\n/g, '\n') !== newValue;
			var a = this.clickedElement;
			if (!a || !a.nodeType || a.nodeName === 'IMG')
			{
				var e = $(a && a.nodeType ? a : 'img[rel=autoFormatter]');
				e.css('backgroundColor', changed ? '#DEF740' : '');
				e.css('borderRadius', changed ? '3px' : '');
				e.css('opacity', changed ? '' : '.4');
			}
			else if (a && a.style) a.style.color = changed ? 'green' : 'silver';
			/* Normalisierte Zeilenumbrüche nie als Änderung werten, das vermeidet Flackern */
			return changed || oldValue.replace(/\r+$/gm, '') !== newValue;
		},
		cleanElement: function(e)
		{
			e.focus();
			if (typeof e.selectionStart === 'number')
			{
				var scroll = e.scrollTop, s1 = e.selectionStart, s2 = e.selectionEnd;
				if (s2 > s1 && (s1 > 0 || s2 < e.value.length))
				{
					var t = this.cleanText(e.value.substring(s1, s2));
					if (t === false) return;
					var newValue = e.value.substr(0, s1) + t + e.value.substr(s2);
					e.value = newValue;
					s2 = s1 + t.length + (e.value.length - newValue.length); /* Fix for Opera */
				}
				else if (!this.cleanAll(e)) return;
				e.selectionStart = s1;
				e.selectionEnd = s2;
				e.scrollTop = scroll;
			}
			else if (typeof document.selection === 'object') /* Internet Explorer */
			{
				var range = document.selection.createRange();
				if (range.text.length)
				{
					var t = this.cleanText(range.text);
					if (t !== false) range.text = t;
				}
				else this.cleanAll(e);
			}
			else this.cleanAll(e);
		},
		cleanAll: function(e)
		{
			this.isAll = true;
			var t = this.cleanText(e.value);
			if (t !== false) e.value = t.replace(/^\s*\n/, '');
			return t !== false;
		},
		cleanText: function(t)
		{
			var oldValue = t;
			/* Steuerzeichen, undefinierte Unicode-Nummern und BOM entfernen */
			t = t.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F\uFEFF]+/g, '');
			t = t.replace(/[\t\r \xA0\xAD\u1680\u180E\u2000-\u200D\u2028\u2029\u202F\u205F\u2060\u3000]+\n/g, '\n');
			/* Unsichtbares weiches Trennzeichen sichtbar machen, egal wo */
			t = t.replace(/(?:\xAD|&#*(?:shy|x0*AD\b|0*173\b);?)+/gi, '&shy;');
			/* ZERO WIDTH SPACE nur im Lateinischen entfernen */
			t = t.replace(/([\x00-\u024F])\u200B+(?=[\x00-\u024F])/g, '$1');
			/* LRM ist wirkungslos, wenn es neben einem LR-Zeichen steht */
			t = t.replace(/\u200E+(?=[A-Z\]ªµºÀ-ÖØ-öø-\u02B8])/gi, '');
			t = t.replace(/([A-ZªµºÀ-ÖØ-öø-\u02B8])\u200E+/gi, '$1');
			t = t.replace(/\u200E+/g, '&lrm;');
 
			t = this.backupNowikis(t);
 
			t = this.cleanCharacterEntities(t);
 
			t = this.backupFilenames(t);
 
			t = this.cleanHeadlines(t);
			/* Einheitliche Schreibweisen für Schlüsselwörter incl. Leerzeichenausgleich */
			t = t.replace(/\{\{\s*(SEITENTITEL|DISPLAYTITLE):\s*/gi,
				this.localisation === 'de' ? '{{SEITENTITEL:' : this.localisation ? '{{DISPLAYTITLE:' : '{{$1:');
			t = t.replace(/#(WEITERLEITUNG|REDIRECT)[\s:=]*\[+\s*([^[\]|]*[^\s[\]|])(?:\s*\|[^[\]]*)?\]+/gi,
				this.localisation === 'de' ? '#WEITERLEITUNG [[$2]]' : this.localisation ? '#REDIRECT [[$2]]' : '#$1 [[$2]]');
			t = t.replace(/\[\[ *([CK]ategor[iy]e?)\s*:\s*([^[\]|]*[^\s[\]|])\s*(?=[\]|])/gi,
				this.localisation === 'de' ? '[[Kategorie:$2' : this.localisation ? '[[Category:$2' : '[[$1:$2');
			t = this.cleanThumbnails(t);
 
			t = this.cleanReferences(t);
			t = this.cleanTags(t);
			t = this.cleanExternalLinks(t);
			t = this.cleanInternalLinks(t);
			t = this.cleanTemplates(t);
 
			t = t.replace(/\bclass\s*=\s*(?:(") *([ \w-]*? ?))? *\bprettytable\b/g, 'class=$1$2wikitable');
			/* Unnötige Leerzeichen bei HTML-Attributen, wichtig vor den Anführungszeichen */
			while (/[!<|][ \w"-;=?[\]]*\b *= +"/i.test(t))
				t = t.replace(/([!<|][ \w"-;=?[\]]*)\b *= +"/gi, '$1="');
 
			/* Ersten Interlanguage-Link suchen; 9 wegen [[zh-classical:…]] */
			var i = t.search(/^\[\[ *[a-z]{2,3}(?:-[a-z-]{2,9})? *:/m), slice;
			if (i > 0)
			{
				i = Math.max(i, t.indexOf('<references', i));
				slice = t.slice(i);
				t = t.slice(0, i);
			}
			t = this.cleanTypography(t);
			t = this.cleanDates(t);
			if (slice) t += slice;
 
			t = this.cleanDuplicateLinks(t);
			t = this.cleanUnits(t);
			t = this.cleanISBNs(t);
			t = this.cleanCategories(t);
			t = this.cleanNewlines(t);
			/* Paragraf, Abs. und Satz mit geschützten Leerzeichen */
			t = t.replace(/§(?: *|&nbsp;)(\d\w* +A[bsatz.]+)(?: *|&nbsp;)(\d+ +S[atz.]+) *(?=\d)/gi,
				'§&nbsp;$1&nbsp;$2&nbsp;');
			t = t.replace(/§(?: *|&nbsp;)(\d\w* +A[bsatz.]+) *(?=\d)/gi,
				'§&nbsp;$1&nbsp;');
			t = t.replace(/§ *(?=\d)/gi,
				'§&nbsp;');
 
			t = this.cleanRedundantTemplateParameters(t);
			t = this.cleanTemplatesByRules(t);
			t = this.executeUserReplacements(t);
 
			t = this.restoreFilenames(t);
			t = this.restoreNowikis(t);
			return this.isChanged(oldValue, t) ? t : false;
		},
		cleanCharacterEntities: function(t)
		{
			var entities = {
				/* Unicodeblock Basis-Lateinisch (U+0000 bis U+007F) */
				'grave': '`',
				/* Unicodeblock Lateinisch-1, Ergänzung (U+0080 bis U+00FF) */
				'cent': '¢', 'pound': '£', 'yen': '¥', 'sect': '§', 'laquo': '«', 'deg': '°', 'plusmn': '±', 'pm': '±',
				'sup2': '²', 'sup3': '³', 'acute': '´', 'centerdot': '·', 'middot': '·', 'raquo': '»', 'frac14': '¼',
				'frac12': '½', 'half': '½', 'frac34': '¾', 'Auml': 'Ä', 'Ouml': 'Ö', 'times': '×', 'Uuml': 'Ü',
				'szlig': 'ß', 'auml': 'ä', 'ouml': 'ö', 'div': '÷', 'divide': '÷', 'uuml': 'ü',
				/* Unicodeblock Allgemeine Interpunktion (U+2000 bis U+206F) */
				'ndash': '–', 'mdash': '—', 'lsquo': '‘', 'rsquo': '’', 'rsquor': '’', 'lsquor': '‚', 'sbquo': '‚',
				'ldquo': '“', 'rdquo': '”', 'rdquor': '”', 'bdquo': '„', 'ldquor': '„', 'dagger': '†', 'Dagger': '‡',
				'ddagger': '‡', 'bull': '•', 'bullet': '•', 'hellip': '…', 'mldr': '…', 'permil': '‰', 'prime': '′',
				'Prime': '″', 'lsaquo': '‹', 'rsaquo': '›',
				/* Unicodeblock Währungszeichen (U+20A0 bis U+20CF) */
				'euro': '€',
				/* Unicodeblock Pfeile (U+2190 bis U+21FF) */
				'rarr': '→', 'harr': '↔',
				/* Unicodeblock Mathematische Operatoren (U+2200 bis U+22FF) */
				'minus': '−', 'infin': '∞', 'ap': '≈', 'approx': '≈', 'asymp': '≈', 'ne': '≠', 'le': '≤', 'leq': '≤',
				'ge': '≥', 'geq': '≥'
			};
			/* Limit to U+FFFF because of compatibility reasons, keep &#x1000F; intact */
			t = t.replace(/&#*(x([\dA-F]{2,})(?![A-F])|(\d{3,})|[a-z]{2,9}\d{0,2}\b)(?![\d=]);?/gi, function($0, $1, $2, $3)
			{
				if ($2) $3 = parseInt($2, 16);
				/* Don't decode spaces and control characters */
				if ($3 > 160 && $3 < 8191 || $3 > 8207 && $3 < 8232 || $3 > 8239 && $3 < 8287 || $3 > 8303 && $3 < 55296)
					return String.fromCharCode($3);
				return entities[$1] || entities[$1.toLowerCase()] || $0;
			});
			t = t.replace(/ +&#*(?:amp|x0*26|0*38);? +/gi, ' & ');
			/* Geschützte Leerzeichen einheitlich als "&nbsp;", vereinfacht viele folgende Suchmuster */
			return t.replace(/&#*(?:nbsp|x0*A0\b|0*160\b);?/gi, '&nbsp;');
		},
		cleanTags: function(t)
		{
			t = t.replace(/(<\/?s)trike\b/gi, '$1');
 
			/* Drop default font attributes */
			t = t.replace(
				/(<font\b[^<>]*?)\s+fa\w+(?:[\s"',=]*(?:Arial|Helvetica(?:\W?N\w*)?|sans\W?serif)\b)+[\s"';]*(?=\s\w+\s*=|>)/gi,
				'$1');
			t = t.replace(/(<font\b[^<>]*?)\s+size[\s"',=]*(?:-1\b|2\b|100\b[ ,.]*\d*%|1(?:\.0*)?em\b)["';]*/gi, '$1');
			/* Remove tags with no content and no attributes */
			t = t.replace(/<(\w+)\s*(\s\w[^<\/>]*)?>\s*<\/\1\b[^<>]*>/gi, function($0, $1, $2)
			{
				if (($2 && /^ref/i.test($1)) || /^[bh]r$/i.test($1))
					return '<' + $1.toLowerCase() + ($2 || '') + ' />';
				return $2 && /\bclear:/i.test($2) ? $0 : '';
			});
			/* Remove inline elements with no attributes */
			while (/<(font|span)\s*>\s*(?:<(?!\1)|[^<])*?\s*<\/\1[^<>]*>/i.test(t))
				t = t.replace(/<(font|span)\s*>\s*((?:<(?!\1)|[^<])*?)\s*<\/\1[^<>]*>/gi, '$2');
			t = t.replace(
				/<font\s+color[\s"',=]*(#[\dA-F]{3,6}|[a-z]{3,20})[\s"';]*>((?:<(?!font)|[^<])*?)<\/font[^<>]*>/gi,
				'<span style="color:$1;">$2<\/span>');
			t = t.replace(/<font\s+size[\s"',=]*(?:-[2-9]|[01])[\s"';]*>((?:<(?!font)|[^<])*?)<\/font[^<>]*>/gi,
				'<small>$1<\/small>');
			t = t.replace(/<font\s+size[\s"',=]*(?:[+-]0|3)[\s"';]*>((?:<(?!font)|[^<])*?)<\/font[^<>]*>/gi,
				'<span style="font-size:larger;">$1<\/span>');
			/* Merge nested inline tags */
			t = t.replace(
				/<(abbr|cite|mark|q|s|small|u)\s*><(font|span)\s+style\s*=\s*["']?([^\n"<>]*?);?["']?\s*>([^<>]*)<\/\2\s*>\s*(?=<\/\1\s*>)/gi,
				'<$1 style="$3;">$4');
			t = t.replace(
				/(<span\b[^<>]*?)\s+style\s*=\s*["']?([^\n"<>]*?);?["']?\s*><span\s+style\s*=\s*["']?([^\n"<>]*?);?["']?\s*>([^<>]*)<\/span\s*>\s*(?=<\/span\s*>)/gi,
				'$1 style="$2;$3;">$4');
 
			/* Verschiedenste Formen von HTML-Zeilenumbrüchen durch einheitliche ersetzen */
			t = t.replace(/<(?:[\s\/\\]*br\b)+\s*(\s\w[^<>]*?)?[\s.\/\\]*>/gi, '<br$1 />');
			/* Unnötige HTML-Zeilenumbrüche entfernen, wenn sowieso ein Absatz folgt */
			t = t.replace(/ *<br \/>(?=\n[\n#*:;])/gi, '');
			t = t.replace(/<(ref|small|su[bp])\b\s*(\s\w[^<>]*?)?\s*><small\s*>([^<>]*)<\/small\s*><\/\1\s*>/gi,
				'<$1$2>$3<\/$1>');
			t = t.replace(/<small\s*><(ref|small|su[bp])\b\s*(\s\w[^<>]*?)?\s*?( ?\/|>[^<>]*<\/\1)\s*><\/small\s*>/gi,
				'<$1$2$3>');
			/* Drop old navigation bar wrapper, see [[Template:NaviBlock]] */
			return t.replace(/<div\s+class[^<>\w]*BoxenVerschmelzen[^<>\w]*>\s*(\{\{[^#:<>{}]*\}\})\s*<\/div>/gi, '$1');
		},
		cleanHeadlines: function(t)
		{
			/* Keine geschützten Leerzeichen in Überschriften */
			while (/^=.*&nbsp;.*=$/im.test(t))
				t = t.replace(/^(=.*)&nbsp;(?=.*=$)/gim, '$1 ');
			/* Fettung zumindest kompletter Überschriften ist unerwünscht */
			t = t.replace(/^(=+) *'''([^\n']+)''' *(?==+$)/gm, '$1 $2 ');
			/* Repariert kaputte Überschriften, entfernt Doppelpunkte, setzt Leerzeichen */
			t = t.replace(/^(=+) *(.*[^\s=:]) *:? *\1$/gm, '$1 $2 $1');
			/* Normalize "External links" headlines, use "Weblinks" in German */
			return t.replace(/^== *(?:Externer?|External)? *(?:Weblinks?|Links?|Webseiten?|Websites?) *=+/gim,
				this.lang === 'de' ? '== Weblinks ==' : '== External links ==');
		},
		cleanThumbnails: function(t)
		{
			if (this.localisation === 'de')
			{
				/* Unnötiges "rechts" kürzen */
				t = t.replace(
					/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:(?:mini|miniatur|thumb)\s*\|+\s*r(?:echts|ight)|r(?:echts|ight)\s*\|+\s*(?:mini|miniatur|thumb))\s*\|+\s*/gi,
					'$1|thumb|');
				/* Set the order to "thumb|upright" if one isn't localized */
				t = t.replace(
					/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:upright([\s=_\d.]*)\|+\s*(?:mini|miniatur|thumb)|(?:hochkan|uprigh)t([\s=_\d.]*)\|+\s*thumb)\s*\|+\s*/gi,
					'$1|mini|hochkant$2$3|');
				t = t.replace(/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:mini|thumb)\s*\|+\s*/gi,
					'$1|mini|');
				t = t.replace(/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*r(?:echts|ight)\s*\|+\s*/gi,
					'$1|rechts|');
				/* Änderung von "miniatur" in "mini" nur zusammen mit anderen Änderungen */
				t = t.replace(
					/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:((?:left|none|cent[er]+|[en]*framed?|frameless|upright)\s*\|+)\s*miniatur|miniatur\s*(\|+\s*(?:left|none|cent[er]+|[en]*framed?|frameless|upright)))\s*\|+\s*/gi,
					'$1|$2mini$3|');
				t = t.replace(/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*l(?:inks|eft)\s*\|+\s*/gi,
					'$1|links|');
				t = t.replace(/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:oh|no)ne\s*\|+\s*/gi,
					'$1|ohne|');
				t = t.replace(/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:zentriert|cent[er]+)\s*\|+\s*/gi,
					'$1|zentriert|');
				t = t.replace(/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:gerahmt|[en]*framed?)\s*\|+\s*/gi,
					'$1|gerahmt|');
				t = t.replace(/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:rahmenlo|frameles)s\s*\|+\s*/gi,
					'$1|rahmenlos|');
				t = t.replace(/(\[\[Datei:[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:hochkan|uprigh)t[\s=_]*([\d.]*)\s*\|+\s*/gi,
					function($0, $1, $2) { return $1 + '|hochkant' + ($2 ? '=' + $2 : '') + '|'; });
			}
			/* vertical-align values from the CSS standard */
			t = t.replace(/(\[\[(?:Datei|File):[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:grundlinie|baseline)\s*\|+\s*/gi,
				'$1|baseline|');
			t = t.replace(/(\[\[(?:Datei|File):[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:tief(?:gestellt)?|sub)\s*\|+\s*/gi,
				'$1|sub|');
			t = t.replace(/(\[\[(?:Datei|File):[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:hoch(?:gestellt)?|sup|super)\s*\|+\s*/gi,
				'$1|super|');
			t = t.replace(/(\[\[(?:Datei|File):[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:oben|top)\s*\|+\s*/gi,
				'$1|top|');
			t = t.replace(/(\[\[(?:Datei|File):[^\n[\]]*[^\s[\]|])\s*\|+\s*text-(?:oben|top)\s*\|+\s*/gi,
				'$1|text-top|');
			t = t.replace(/(\[\[(?:Datei|File):[^\n[\]]*[^\s[\]|])\s*\|+\s*mi(?:tt|ddl)e\s*\|+\s*/gi,
				'$1|middle|');
			t = t.replace(/(\[\[(?:Datei|File):[^\n[\]]*[^\s[\]|])\s*\|+\s*(?:unten|bottom)\s*\|+\s*/gi,
				'$1|bottom|');
			return t.replace(/(\[\[(?:Datei|File):[^\n[\]]*[^\s[\]|])\s*\|+\s*text-(?:unten|bottom)\s*\|+\s*/gi,
				'$1|text-bottom|');
		},
		cleanExternalLinks: function(t)
		{
			t = t.replace(/\b(?:http(s?)(?::+\/*|\/\/+:*)\b)+/gi, 'http$1://');
			/* Doppelte eckige Klammern um Weblinks vereinfachen */
			t = t.replace(/\[+ *(https?:\/\/[^\n[\]]*?) *\]+/gi, '[$1]');
			/* Weblinks mit senkrechtem Strich reparieren */
			t = t.replace(/(\[https?:\/\/[^\s[\]|]*?) *\| *(?=[^\s=[\]|]+\])/gi, '$1 ');
			/* Schrägstriche am Ende einfacher Domains ergänzen */
			t = t.replace(/(\[https?:\/\/\w[\w.-]*\w\.\w+) +/gi, '$1/ ');
			/* Domains klein schreiben, egal ob beschriftet oder nicht */
			t = t.replace(/\bhttps?:\/\/\b[0-9a-z.-]*[A-Z][\w.-]*/g, function($0) { return $0.toLowerCase(); });
			/* Verbliebene projektinterne Weblinks protokollrelativ machen */
			return t.replace(/\[ *https?:\/+(?=[a-z-]+\.wikipedia\.org\b)/gi, '[//');
		},
		cleanInternalLinks: function(t)
		{
			/* Works for "dewiki" and "enwiki" as well as "metawiki" */
			var wiki = mw.config.get('wgDBname').slice(0, -4);
			var ns = mw.config.get('wgFormattedNamespaces')[-1];
 
			/* Permanente Weblinks in Spezialseiten-Syntax umwandeln */
			var permaLinkReplace = function($0, $1, $2, $3, $4)
			{
				/* Auf Alternative ausweichen, wenn zwischen ID und Anker noch Parameter stehen */
				var m = /^(\d*([^#]*))(.*)$/.exec($3);
				return m && m[2] ? '[{{fullurl:' +
					($1 === wiki ? '' : $1 + ':') + ($2 || ':').replace(/_/g, ' ') + '|oldid=' + m[1] + '}}' + m[3] +
					(typeof $4 === 'string' ? ' ' + $4 : '') + ']' :
					'[[:' + $1 + ':' +
					($1 === wiki ? ns : 'Special') + ':Permanent' +
					($1 === 'de' ? 'er ' : '') + 'Link/' + $3 +
					(typeof $4 === 'string' ? '|' + $4 : '') + ']]';
			};
			/* Weblinks auf Sprachversionen (auch auf die eigene) in Wikilinks umwandeln */
			var interWikiReplace = function($0, $1, $2, $3)
			{
				/* Auf Alternative ausweichen, wenn Parameter enthalten wind */
				var m = /^([^?]*)\?([^#]*)(.*)$/.exec($2);
				try
				{
					return m ? '[{{fullurl:' +
						($1 === wiki ? '' : $1 + ':') +
						decodeURIComponent(m[1]).replace(/_/g, ' ') + '|' + m[2] + '}}' + m[3] +
						(typeof $3 === 'string' ? ' ' + $3 : '') + ']' :
						'[[:' + $1 + ':' + $2.replace(/_/g, ' ') +
						(typeof $3 === 'string' ? '|' + $3 : '') + ']]';
				} catch (ex) { return $0; }
			};
			/* Schreibweise [[Weblink#Anker mit Leerzeichen|Beschriftung]] reparieren */
			t = t.replace(
				/\[+ *(?:https?:)?\/\/([a-z-]+)\.wikipedia\.org\/w\/[\w.]*\?(?:title=([^\s&[\]|]*)&)?oldid=([^\n?[\]|]+?) *\|+ *([^\n[\]|]*?) *\]+/gi,
				permaLinkReplace);
			t = t.replace(
				/\[+ *(?:https?:)?\/\/([a-z-]+)\.wikipedia\.org\/wiki\/([^\n[\]|]*?) *\|+ *([^\n[\]|]*?) *\]+/gi,
				interWikiReplace);
			/* Schreibweise [Weblink#Anker Beschriftung] umwandeln */
			t = t.replace(
				/\[+ *(?:https?:)?\/\/([a-z-]+)\.wikipedia\.org\/w\/[\w.]*\?(?:title=([^\s&[\]|]*)&)?oldid=([^\s?[\]|]+) +([^\n[\]|]+?) *\]+/gi,
				permaLinkReplace);
			t = t.replace(
				/\[+ *(?:https?:)?\/\/([a-z-]+)\.wikipedia\.org\/wiki\/([^\s[\]|]*) +([^\n[\]|]+?) *\]+/gi,
				interWikiReplace);
			/* Schreibweise [Weblink#Anker] umwandeln */
			t = t.replace(
				/\[+ *(?:https?:)?\/\/([a-z-]+)\.wikipedia\.org\/w\/[\w.]*\?(?:title=([^\s&[\]|]*)&)?oldid=([^\s?[\]|]+) *\]+/gi,
				permaLinkReplace);
			t = t.replace(
				/\[+ *(?:https?:)?\/\/([a-z-]+)\.wikipedia\.org\/wiki\/([^\s[\]|]*) *\]+/gi,
				interWikiReplace);
			/* Verbliebene projektinterne Weblinks ohne eckige Klammern ebenfalls umwandeln */
			t = t.replace(
				/(?:https?:)?\/\/([a-z-]+)\.wikipedia\.org\/w\/[\w.]*\?(?:title=([^\s&[\]|]*)&)?oldid=([^\s?<>[\]{|}]*[^\s!"),.:;<>?[\\\]{|}])(?=[\s!),.:;<]|$)/gim,
				permaLinkReplace);
			t = t.replace(
				/(?:https?:)?\/\/([a-z-]+)\.wikipedia\.org\/wiki\/([^\s<>[\]{|}]*[^\s!"),.:;<>?[\\\]{|}])(?=[\s!),.:;<]|$)/gim,
				interWikiReplace);
 
			/* Unnötig gewordene Vorlage in Spezialseiten-Syntax umwandeln */
			t = t.replace(/\{\{\s*Permalink\s*\|[^{|}]*\|\s*(\d+(?: ?#[^{|}]*?)?)\s*(?:(\|)\s*([^{|}]*?))?\s*\}\}/gi,
				'[[' + ns + ':Permanent' + (wiki === 'de' ? 'er ' : '') + 'Link/$1$2$3]]');
			/* Ausgewählte {{fullurl:…|…}} kompakter formulieren */
			t = t.replace(/\{\{\s*fullurl:\s*([^\n{|}]+)\|\s*(?:diff=prev&oldid=(\d+)|oldid=(\d+)&diff=prev)\s*\}\}/gi,
				'{{fullurl:$1|diff=$2$3}}');
 
			/* Wikilinks mit unnötigem Präfix ":w:de:", "w:de:" oder ":de:" vereinfachen */
			t = t.replace(new RegExp('\\[\\[ *(?::? *w *)?: *' + wiki +
				' *: *(((?:Bild|Datei|File|Image|[CK]ategor[iy]e?) *:)?[^\\n[\\]]*\\S) *\\]\\]', 'gi'),
				function($0, $1, $2)
				{
					return '[[' + ($2 ? ':' : '') + $1 + ']]';
				});
 
			/* Anker in internen Links dekodieren */
			t = t.replace(/(\[\[[^\n#[\]{|]*#)([^\n#[\]|]+)(?=\|?[^\n#[\]|}]*\]\])/g, function($0, $1, $2)
			{
				try
				{
					/* Kodierung einiger Zeichen beibehalten (%25, %5B, %5D, %7B-%7D) */
					return $1 + decodeURIComponent($2.replace(/\.(?=[289A-E][\dA-F]|[357][B-F]|40|60)/g, '%')).
						replace(/[%[\]{|}]/g, function($0)
						{
							return '%' + $0.charCodeAt(0).toString(16).toUpperCase();
						});
				} catch (ex) { return $0; }
			});
			/* Sonstige kodierte Linkziele dekodieren */
			t = t.replace(/\[\[([^\n#%[\]{|}]*%[2-9A-E][^\n#[\]{|}]*)(?=#?[^\n[\]{|}]*\|?[^\n[\]{|}]*\]\])/gi,
				function($0, $1)
				{
					try
					{
						/* Kodierung einiger Zeichen beibehalten (%25, %3C, %3E, %5B, %5D, %7B-%7D) */
						return '[[' + decodeURIComponent($1).replace(/[%<>[\]{|}]/g, function($0)
						{
							return '%' + $0.charCodeAt(0).toString(16).toUpperCase();
						});
					} catch (ex) { return $0; }
				});
			/* Verbliebene Unterstriche aus Links entfernen */
			t = t.replace(/\[\[[^\n[\]_{|}]+_[^\n[\]{|}]+(?=\|?[^\n[\]{|}]*\]\])/g, function($0)
			{
				return $0.replace(/_/g, ' ');
			});
 
			/* [[Link|Dash-]] wird zu [[Link|Dash]]- und [[Link|Die]]s zu [[Link|Dies]], weil besser lesbar;
			   MediaWiki akzeptiert hier wirklich nur Kleinbuchstaben, ä, ö, ü und ß */
			t = t.replace(/\[\[ *([^\n[\]|]+?) *(\|[^\n[\]|]+?)(?:(-+)\]\]|\]\]([a-zßäöü]*))/g, '[[$1$2$4]]$3');
			/* [[Link|Link]]s werden zu [[Link]]s weil kürzer und besser lesbar */
			return t.replace(typeof window.autoFormatMaskedLinks === 'undefined' || window.autoFormatMaskedLinks ?
				/\[\[([^\n:[\]|]+)\|\1([^\n[\]|]*)\]\]/g :
				/\[\[([^\n:[\]|]+)\|\1([a-zßäöü]* *)\]\]/g, '[[$1]]$2');
		},
		cleanDuplicateLinks: function(t)
		{
			/* Remove links from dates that start with a year (e.g. ISO) */
			t = t.replace(/\[+([12]\d{3}\W+(?:3[01]|[12]\d|0?[1-9])\W+(?:3[01]|[12]\d|0?[1-9]))\]+/g, '$1');
 
			/* Never link dates and years in Persondata templates */
			var re = /\{\{\s*P(erson(?:endaten|data)\b[^{}]*\|\s*(?:GEBURTSD|STERBED|DATE)[\s\w]*=[^\n=[\]{|}]*)\[+([^\n=[\]{|}]+)\]+/i;
			while (re.test(t)) {
				t = t.replace(re, '{{P$1$2');
			}
 
			if (/\[\[[CK]ategor[iy]e?:(?:Tag|Days of the year)[|\]]|\{\{(?:Artikel Jahr|Year nav)\s*[|}]/i.test(t)) {
				return t;
			}
			/* Exclude files and infoboxes from the start of the article */
			var m = /^(?:\s*\[\[\w+:(?:\[[^\]]*\]\]|[^\]])*\]\])*(?:\s*\{\{(?:\{[^}]*\}\}|[^}])*\}\})+/.exec(t);
			var start = m ? m[0].length : 0, found = [], a = [];
			/* Unlink years that are linked more than one time */
			re = /\[\[ *([12]\d{3}) *\]\]/g;
			/* Jeweils ersten Fund eines Jahres merken, danach entlinken */
			while (m = re.exec(t)) {
				if (m.index >= start) {
					found[m[1]] ? a.push(m) : found[m[1]] = true;
				}
			}
			var r = '', p = 0;
			for (var i = 0; i < a.length; i++)
			{
				r += t.slice(p, a[i].index) + a[i][1];
				p = a[i].index + a[i][0].length;
			}
			return p ? r + t.slice(p) : t;
		},
		cleanDates: function(t)
		{
			var months = mw.config.get('wgMonthNames') || ['', 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni',
				'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
 
			/* Add missing space between day and month */
			t = t.replace(new RegExp('(\\b(?:3[01]|[12]\\d|0?[1-9])\\.?)(?=(?:' +
				months.slice(1).join('|') + ')\\b)', 'g'), '$1 ');
			/* No non-breaking space between month and year */
			t = t.replace(new RegExp('(\\b(?:3[01]|[12]\\d|0?[1-9])\\.?(?:&nbsp;|\\s)+(?:' +
				months.slice(1).join('|') + '))(?:\xA0|&nbsp;)(?=[12]\\d{3}\\b)', 'g'), '$1 ');
			/* Missverständliches deutsches Datumsformat durch Langform ersetzen */
			var separator = this.lang === 'en' ? ' ' : '. ';
			t = t.replace(
				/([\s'(>„])(3[01]|[12]\d|0?[1-9])\. *(1[012]|0?[1-9])\. *(?=[12]\d{3}[!,.:;?]?[\s')<\]“])/g,
				function($0, $1, $2, $3)
				{
					return $1 + ($2 | 0) + separator + months[$3 | 0] + ' ';
				});
			/* Unspaced dashes in "1850–14 January" are bad style in German and English */
			separator = this.lang === 'de' ? ' bis ' : ' – ';
			t = t.replace(/(\s[12]\d{3}'*) *[–—−-] *('*(?:3[01]|[12]\d|0?[1-9])\.?) *([A-S][a-zä]{2,}\b)/g,
				function($0, $1, $2, $3)
				{
					for (var i = months.length; --i; )
						if ($3 === months[i]) return $1 + separator + $2 + ' ' + $3;
					return $0;
				});
			/* Bis-Striche in 4-stellige Jahreszahlenbereiche einsetzen */
			t = t.replace(
				/([\s!'(>|„])(?:\[\[ *([12]\d{3}) *\]\]|([12]\d{3})) *[–—-] *(?:\[\[ *([12]\d{3}) *\]\]|([12]\d{3}))(?=[!,.:;?]?[\s!')\/<\]|}“])/g,
				function($0, $1, $2, $3, $4, $5)
				{
					return ($2 || $3) < ($4 || $5) ? $1 + ($2 || $3) + '–' + ($4 || $5) : $0;
				});
			/* Bis-Striche in 2-stellige Jahreszahlenbereiche einsetzen */
			t = t.replace(/([\s!'(>|„][12]\d(\d\d)) *[—-] *(?=(1[3-9]|[2-9]\d)[!,.:;?]?(?:[\s!')\/<\]|“]|$))/g,
				function($0, $1, $2, $3) { return $2 < $3 ? $1 + '–' : $0; });
			/* "1980 – 90" becomes "1980–1990" in the German Wikipedia, "1980–90" otherwise */
			var full = typeof window.autoFormatShortYearRanges !== 'undefined' ? window.autoFormatShortYearRanges :
				this.localisation === 'de';
			t = t.replace(
				/([\s!'(>|„]([12]\d)(\d\d)) *– *(?!(?:3[01]|[12]\d|0[1-9])\.? [A-S][a-zä]{2,}\b)(?=(\d\d)[!,.:;?]?(?:[\s!')\/<|“]|$))/g,
				function($0, $1, $2, $3, $4) { return $3 < $4 ? $1 + '–' + (full ? $2 : '') : $0; });
			/* ISSNs aber ohne Bis-Striche, wichtig nach den Jahreszahlen */
			return t.replace(/(IS\wN\W*\d+)–(?=\d)/g, '$1-');
		},
		cleanTypography: function(t)
		{
			var de = this.lang === 'de';
 
			/* Double quotes */
			if (de)
			{
				t = t.replace(/(^|[\s!#'(*+\/:;>[|-])(?:"|,,)(?!\s)([^\n"“”„]*[^\s"“”„])"(?=[\s!'),.\/:;<?\]}-]|$)/g,
					'$1„$2“');
			}
			t = t.replace(/(\{\{(?:Zitat|")\s*\|\s*(?:(?:1|Text)\s*=)?[^={|}„]*)„([^\n{|}‘‚“”„]+)“/gi, '$1‚$2‘');
			/* Auslassungspunkte */
			t = t.replace(/(^|[ '(>[|„])\.\.\.(?=[ '),<?\]}“]|$)/gm, '$1…');
			t = t.replace(/[,;](?: |&nbsp;)*†(?: |&nbsp;)*(?=[\w[])/gi, '; † ');
			t = t.replace(/\( *([\d,.]*\d(?: |&nbsp;)*[KMk]i?B)(?:ytes?)?([,;]) *([A-Z]{3,4}(?:\W+Datei)?) *\)/g,
				'($3$2 $1)');
			t = t.replace(/\( *([A-Z]{3,4}(?:\W+Datei)?)([,;]) *([\d,.]*\d)(?: |&nbsp;)*([KMk]i?B)(?:ytes?)? *\)/g,
				function($0, $1, $2, $3, $4)
				{
					$3 = $3.replace(de ? /\b\.(?=\d{3}\b)/g : /\b,(?=\d{3}\b)/g, '');
					$3 = $3.replace(/^(\d*),(?=\d*$)/, '$1.');
					$3 = ($4.charAt() === 'M' ? Math.round($3 * 10) / 10 : Math.round($3)) || $3;
					return '(' + $1 + (de ? ('; ' + $3).replace(/\./, ',') : $2 + ' ' + $3) + '&nbsp;' + $4 + ')';
				});
			/* Bis-Striche bei Seitenzahlen */
			t = t.replace(/\b(Sp?\.|Seiten?|Spalten?) *(\d+) *[–—−-] *(?=\d+[\s!),.\/:;<?\]|}“])/g, '$1 $2–');
			/* English Wikipedia also uses en dashes */
			return t.replace(/([\w'\)>\]\xC0-\u024F“]) +-(,?) +(?=[\w'\(\[\xC0-\u024F„])/g, '$1 –$2 ');
		},
		cleanUnits: function(t)
		{
			/* Prozentwerte erhalten seit Mitte 2007 automatisch ein geschütztes Leerzeichen */
			t = t.replace(/(\S)(?:\xA0|&nbsp;)(?=%)/gi, '$1 ');
			if (this.lang === 'de')
			{
				t = t.replace(/([\s'(*+\/:;„][\u2212-]?\d+(?:[,–]\d+)?)(?=%[\s!'),.\/:<?\]|“])/gi, '$1 ');
				t = t.replace(/((?:\d|\b)[cmk]?m) *<sup\s*>\s*([23²³])\s*<\/sup\s*>(?!\/)/g, function($0, $1, $2)
				{
					return $1 + ({ '2': '²', '3': '³' }[$2] || $2);
				});
			}
			/* Maßeinheiten immer mit Leerzeichen */
			t = t.replace(
				/([ '(*+:;„][\u2212-]?\d+(?:[,–]\d+)?) ?(k[Bgm]|Ki?B|k?Hz|[MGT](?:i?B|Hz)|cm|ha|m[lm]|EUR|CHF|US[D$]|JPY|[gm€¥])(?=[²³]?[ !'),.\/:;<?“])/g,
				'$1&nbsp;$2');
			return t;
		},
		cleanISBNs: function(t)
		{
			/* ISBNs mit Bindestrichen gliedern */
			return t.replace(
				/(^|[\s#'(*>|])(?:(ISBN\d?\s*=\s*)|ISBN(?:-?1[03]| *1[03]:)?:?\s*)(9-?7-?[89]-?)?([013][\d\u2010-\u2012\u2212-]{8,}[\dX]\b)/gim,
				function($0, $1, $2, $3, $4)
				{
					return $1 + ($2 || 'ISBN ') + ($3 || '').replace(/^9\D*7\D*(\d)\D*/, '97$1-') + $4.
						/* Remove all dashes */
						replace(/[^\dX]+/gi, '').
						/* Group 0 for English books */
						replace(/^0([01]\d)(\d{6})\B/, '0$1-$2-').
						replace(/^0([2-6]\d\d)(\d{5})\B/, '0$1-$2-').
						replace(/^0(7\d{3}|8[0-4]\d\d)(\d{4})\B/, '0$1-$2-').
						replace(/^0(8[5-9]\d{3})(\d{3})\B/, '0$1-$2-').
						replace(/^0(9[0-4]\d{4})(\d\d)\B/, '0$1-$2-').
						replace(/^0(9[5-9]\d{5})(\d)\B/, '0$1-$2-').
						/* Group 1 for English books */
						replace(/^1(0\d)(\d{6})\B/, '1$1-$2-').
						replace(/^1([1-3]\d\d)(\d{5})\B/, '1$1-$2-').
						replace(/^1(4\d{3}|5[0-4]\d\d)(\d{4})\B/, '1$1-$2-').
						replace(/^1(5[5-9]\d{3}|[67]\d{4}|8[0-5]\d{3}|86[0-8]\d\d|869[0-7]\d)(\d{3})\B/, '1$1-$2-').
						replace(/^1(869[89]\d\d|8[7-9]\d{4}|9[0-8]\d{4}|99[0-8]\d{3})(\d\d)\B/, '1$1-$2-').
						replace(/^1(999\d{4})(\d)\B/, '1$1-$2-').
						/* Group 3 for German books */
						replace(/^3(0[0-24-9]|1\d)(\d{6})\B/, '3$1-$2-').
						replace(/^3(03[0-3]|[2-6]\d\d)(\d{5})\B/, '3$1-$2-').
						replace(/^3(03[4-6]\d|7\d{3}|8[0-4]\d\d)(\d{4})\B/, '3$1-$2-').
						replace(/^3(03[7-9]\d\d|8[5-9]\d{3}|95[4-9]\d\d|9[69]\d{3})(\d{3})\B/, '3$1-$2-').
						replace(/^3(9[0-4]\d{4})(\d\d)\B/, '3$1-$2-').
						replace(/^3(95[0-3]\d{4}|9[78]\d{5})(\d)\B/, '3$1-$2-').
						/* Add missing dash after group */
						replace(/^([0-57]|6\d\d|8\d|9[0-4]|9[5-8]\d|99[0-8]\d|999\d\d)\B/, '$1-');
				});
		},
		cleanReferences: function(t)
		{
			t = t.replace(/<\s*references\s*(\s\b[^<>]*?)?\s*(?:\/|>\s*<\s*\/\s*references)\s*>/gi, '<references$1 />');
			t = t.replace(/<\s*references\s*(\s\b[^<\/>]*?)?\s*>/gi, '<references$1>');
			t = t.replace(/<\s*\/\s*references\s*>/gi, '<\/references>');
			if (this.isAll)
			{
				var re = /(<references[^<\/>]*)>/g, m;
				while (m = re.exec(t))
					if (t.indexOf('<\/references>', m.index) < 0)
						t = t.slice(0, m.index) + m[1] + ' />' + t.slice(m.index + m[0].length);
			}
			t = t.replace(/<\s*ref\s*(\s\b[^<>]*?)\s*(?:\/|>\s*<\s*\/\s*ref)\s*>/gi, '<ref$1 />');
 
			/* Zeilenumbrüche in Einzelnachweisen nur oben im Artikel entfernen */
			var i = t.indexOf('<references'), slice;
			if (i > 0)
			{
				slice = t.slice(i);
				slice = slice.replace(/<\s*ref\s*(\s\b[^<\/>]*?)?\s*>[\t ]*/gi, '<ref$1>');
				slice = slice.replace(/(?:(\n[\t ]*)|[\t ]*)<\s*\/\s*ref\s*>/gi, '$1<\/ref>');
				t = t.slice(0, i);
			}
			t = t.replace(/<\s*ref\s*(\s\b[^<\/>]*?)?\s*>\s*/gi, '<ref$1>');
			t = t.replace(/\s*<\s*\/\s*ref\s*>/gi, '<\/ref>');
			if (slice) t += slice;
 
			/* Leerzeichen zwischen Satzende und <ref> oder zwei <ref> entfernen */
			t = t.replace(/([!,.;?]|<ref\b[^<>]*(?:\/|>[^<>]*<\/ref)>) +(?=<ref[ >])/gi, '$1');
			/* Zwei gleiche Satzzeichen vor und nach einem <ref> auf eins kürzen */
			return t.replace(/([!,.:;?])(<ref\b[^<>]*(?:\/|>[^<>]*<\/ref)>)\1/gi, '$1$2');
		},
		cleanCategories: function(t)
		{
			t = t.replace(/\{\{\s*(SORTIERUNG|DEFAULT ?\w*SORT\w*)\s*[:|]\s*/gi,
				this.localisation === 'de' ? '{{SORTIERUNG:' : this.localisation ? '{{DEFAULTSORT:' : '{{$1:');
 
			/* Match every character thats in one of the two replacement maps or should be deleted */
			var re = /["&'\-\/?`¡-¥©-´·-ſǍ-\u01ED\u01F8-\u021B\u02B0-\u036FΆ-ώ\u0400-Ј\u040D-ј\u045DўҐ-ғҚқҢңҮ-ұҺһ\u04D0-\u04D7\u1E00-ỹ\u2010-•′″‹›−]/g;
			/* Unicodeblock Lateinisch-1, Ergänzung (U+0080 bis U+00FF) */
			var trSet1 = '"/?¡¢£¤¥©ª«¬®°±²³·¹º»¿ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõö÷øùúûüýÿ';
			var trSet2 = '    cL YCa  R  23 1o  AAAAAACEEEEIIIIDNOOOOOxOUUUUYaaaaaaceeeeiiiidnooooo ouuuuyy';
			/* Unicodeblock Lateinisch, erweitert-A (U+0100 bis U+017F) */
			trSet1 += 'ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŔŕŖŗŘř';
			trSet2 += 'AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnnNnOoOoOoRrRrRr';
			trSet1 += 'ŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ';
			trSet2 += 'SsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs';
			/* Unicodeblock Lateinisch, erweitert-B (U+0180 bis U+024F) */
			trSet1 += 'ǍǎǏǐǑǒǓǔǕǖǗǘǙǚǛǜǝǞǟǠǡǤǥǦǧǨǩǪǫǬǭǸǹǺǻǾǿȀȁȂȃȄȅȆȇȈȉȊȋȌȍȎȏȐȑȒȓȔȕȖȗȘșȚț';
			trSet2 += 'AaIiOoUuUuUuUuUueAaAaGgGgKkOoOoNnAaOoAaAaEeEeIiIiOoOoRrRrUuUuSsTt';
			/* Unicodeblock Kyrillisch (U+0400 bis U+04FF) */
			trSet1 += '\u0400ІЈ\u040DЎАБВГДЕЗИЙКЛМНОПРСТУФЦЪЫЭабвгдезийклмнопрстуфцъыэ\u0450іј\u045DўҐґҚқҮүҰұҺһӐӑӒӓӖӗ';
			trSet2 += 'EIJIUABWGDESIJKLMNOPRSTUFZAYEabwgdesijklmnoprstufzayeeijiuGgQqUuUuHhAaAaEe';
			/* Unicodeblock Lateinisch, weiterer Zusatz (U+1E00 bis U+1EFF) */
			trSet1 += 'ḀḁḂḃḄḅḆḇḈḉḊḋḌḍḎḏḐḑḒḓḔḕḖḗḘḙḚḛḜḝḞḟḠḡḢḣḤḥḦḧḨḩḪḫḬḭḮḯḰḱḲḳḴḵḶḷḸḹḺḻḼḽḾḿṀṁṂṃṄṅṆṇṈṉṊṋṌṍṎṏṐṑṒṓṔṕṖṗ';
			trSet2 += 'AaBbBbBbCcDdDdDdDdDdEeEeEeEeEeFfGgHhHhHhHhHhIiIiKkKkKkLlLlLlLlMmMmMmNnNnNnNnOoOoOoOoPpPp';
			trSet1 += 'ṘṙṚṛṜṝṞṟṠṡṢṣṤṥṦṧṨṩṪṫṬṭṮṯṰṱṲṳṴṵṶṷṸṹṺṻṼṽṾṿẀẁẂẃẄẅẆẇẈẉẊẋẌẍẎẏẐẑẒẓẔẕẖẗẘẙẚẛ\u1E9C\u1E9D\u1E9F';
			trSet2 += 'RrRrRrRrSsSsSsSsSsTtTtTtTtUuUuUuUuUuVvVvWwWwWwWwWwXxXxYyZzZzZzhtwyasssd';
			trSet1 += 'ẠạẢảẤấẦầẨẩẪẫẬậẮắẰằẲẳẴẵẶặẸẹẺẻẼẽẾếỀềỂểỄễỆệỈỉỊịỌọỎỏỐốỒồỔổỖỗỘộỚớỜờỞởỠỡỢợỤụỦủỨứỪừỬửỮữỰựỲỳỴỵỶỷỸỹ';
			trSet2 += 'AaAaAaAaAaAaAaAaAaAaAaAaEeEeEeEeEeEeEeEeIiIiOoOoOoOoOoOoOoOoOoOoOoOoUuUuUuUuUuUuUuYyYyYyYy';
			/* Unicodeblock Allgemeine Interpunktion (U+2000 bis U+206F) */
			trSet1 += '\u2012—―\u2016‗‘‚\u201B“”„\u201F†‡•′″‹›−';
			trSet2 += '                    ';
			var trMap = { '&': 'und', '¼': '14', '½': '12', '¾': '34',
				'Æ': 'Ae', 'Þ': 'Th', '\u1E9E': 'SS', 'ß': 'ss', 'æ': 'ae', 'þ': 'th', 'IJ': 'Ij', 'ij': 'ij',
				'Œ': 'Oe', 'œ': 'oe', 'Ǣ': 'Ae', 'ǣ': 'ae', 'Ǽ': 'Ae', 'ǽ': 'ae',
				/* Unicodeblock Griechisch und Koptisch (U+0370 bis U+03FF) */
				'Ά': 'Alpha', 'Έ': 'Epsilon', 'Ή': 'Eta', 'Ί': 'Iota', 'Ό': 'Omikron', 'Ύ': 'Ypsilon', 'Ώ': 'Omega',
				'ΐ': 'iota',
				'Α': 'Alpha', 'Β': 'Beta', 'Γ': 'Gamma', 'Δ': 'Delta', 'Ε': 'Epsilon', 'Ζ': 'Zeta', 'Η': 'Eta',
				'Θ': 'Theta', 'Ι': 'Iota', 'Κ': 'Kappa', 'Λ': 'Lambda', 'Μ': 'My', 'Ν': 'Ny', 'Ξ': 'Xi',
				'Ο': 'Omikron', 'Π': 'Pi', 'Ρ': 'Rho', 'Σ': 'Sigma', 'Τ': 'Tau', 'Υ': 'Ypsilon',
				'Φ': 'Phi', 'Χ': 'Chi', 'Ψ': 'Psi', 'Ω': 'Omega', 'Ϊ': 'Iota', 'Ϋ': 'Ypsilon',
				'ά': 'alpha', 'έ': 'epsilon', 'ή': 'eta', 'ί': 'iota', 'ΰ': 'ypsilon',
				'α': 'alpha', 'β': 'beta', 'γ': 'gamma', 'δ': 'delta', 'ε': 'epsilon', 'ζ': 'zeta', 'η': 'eta',
				'θ': 'theta', 'ι': 'iota', 'κ': 'kappa', 'λ': 'lambda', 'μ': 'my', 'ν': 'ny', 'ξ': 'xi',
				'ο': 'omikron', 'π': 'pi', 'ρ': 'rho', 'ς': 'sigma', 'σ': 'sigma', 'τ': 'tau', 'υ': 'ypsilon',
				'φ': 'phi', 'χ': 'chi', 'ψ': 'psi', 'ω': 'omega', 'ϊ': 'iota', 'ϋ': 'ypsilon', 'ό': 'omikron',
				'ύ': 'ypsilon', 'ώ': 'omega',
				/* Unicodeblock Kyrillisch (U+0400 bis U+04FF) */
				'Ё': 'Jo', 'Ђ': 'Dje', 'Ѓ': 'Gje', 'Є': 'Je', 'Ѕ': 'Dze', 'Ї': 'Ji', 'Џ': 'Dsche', 'Ж': 'Sch',
				'Х': 'Ch', 'Ч': 'Tsch', 'Ш': 'Sch', 'Щ': 'Schtsch', 'Ю': 'Ju', 'Я': 'Ja', 'ж': 'sch', 'х': 'ch',
				'ч': 'tsch', 'ш': 'sch', 'щ': 'schtsch', 'ю': 'ju', 'я': 'ja', 'ё': 'jo', 'ђ': 'dje', 'ѓ': 'gje',
				'є': 'je', 'ѕ': 'dze', 'ї': 'ji', 'Ғ': 'Gh', 'ғ': 'gh', 'Ң': 'Ng', 'ң': 'ng', 'Ӕ': 'Ae', 'ӕ': 'ae' };
			trSet1 += this.localisation === 'de' ? "–" : "'-–";
			trSet2 += this.localisation === 'de' ? " " : "'--";
			var trReplace = function($0, $1, $2)
			{
				return $1 + $2.replace(/&#?\w+;/g, ' ').replace(re, function($0)
				{
					/* Some characters are replaced with the empty charAt(-1) on purpose */
					return trMap[$0] || trSet2.charAt(trSet1.indexOf($0));
				}).replace(/(\S) +(?= |$)/g, '$1').replace(/(\S)# */g, '$1 #');
			};
			t = t.replace(/(\{\{(?:SORTIERUNG|DEFAULT\w*SORT\w*):)([^\n{}]+)(?=\}\})/g, trReplace);
			t = t.replace(/(\[\[[CK]ategor[iy]e?:[^\n[\]|]+\|)([^\n[\]|]+)(?=\]\])/g, trReplace);
 
			/* Groß-/Kleinschreibung wird seit dem 8. März 2011 ignoriert */
			var title = $.escapeRE(mw.config.get('wgTitle'));
			t = t.replace(new RegExp('\\{\\{(?:SORTIERUNG|DEFAULT\\w*SORT\\w*):\\s*' + title + '\\}\\}\\s*', 'gi'), '');
			var m = /\{\{(?:SORTIERUNG|DEFAULT\w*SORT\w*):([^\n{}]*)/.exec(t);
			t = t.replace(new RegExp('(\\[\\[[CK]ategor[iy]e?:[^[\\]|]*)\\|' + (m && $.escapeRE(m[1]) || title) +
				'\\s*(?=\\]\\])', 'gi'), '$1');
			return t.replace(/(\[\[[CK]ategor[iy]e?:)([a-z])/g, function($0, $1, $2) { return $1 + $2.toUpperCase(); });
		},
		cleanNewlines: function(t)
		{
			/* Mehrfache Leerzeilen auf einzelne reduzieren */
			t = t.replace(this.isDisambiguation ? /\n{3,}(?=\n)/g : /\n{3,}/g, '\n\n');
			/* Keine Leerzeile vor einzeiligen <references /> */
			t = t.replace(/(==\n)\n+(?=<references[^\n<>]*\/>\n\n)/gi, '$1');
			/* Leerzeile nach Einzelnachweisen */
			t = t.replace(
				/(<\/?references[^\n<>]*>)\s*(?=\{\{Navi(?:gationsleiste |Block)|\{\{SORTIERUNG:|\{\{DEFAULT\w*SORT\w*:|\[\[[CK]ategor[iy]e?:)/gi,
				'$1\n\n');
			/* Leerzeile zwischen Listen/bestimten Vorlagen und Kategorienblock */
			t = t.replace(
				/(\{\{(?:Begriffsklärung|Coordinate|Navi(?:gationsleiste |Block)|Normdaten)[^{}]*\}\}|^\* *[h[{][^\n]*)\s*(?=\{\{SORTIERUNG:|\{\{DEFAULT\w*SORT\w*:|\[\[[CK]ategor[iy]e?:)/gim,
				'$1\n\n');
			/* Split categories into separate lines (don't make this a look-ahead, it's slow!) */
			t = t.replace(/([^\s>-]) *(\[\[[CK]ategor[iy]e?:[^\n[\]]*\]\])/gi, '$1\n$2');
			t = t.replace(/(\[\[[CK]ategor[iy]e?:[^\n[\]]*\]\]) *(?![\s<-]|$)/gi, '$1\n');
			t = t.replace(/(\[\[[CK]ategor[iy]e?:[^\n[\]]*\]\]\n) *(?!\[\[[CK]ategor[iy]e?:|[\s<-]|$)/gi, '$1\n');
			/* Keine Leerzeile zwischen SORTIERUNG und Kategorie */
			t = t.replace(/(\{\{(?:SORTIERUNG|DEFAULT\w*SORT\w*):[^\n{}]*\}\})\s*(?=\[\[[CK]ategor[iy]e?:)/gi, '$1\n');
			/* Two empty lines in front of English stub templates */
			return t.replace(/(\[\[[CK]ategor[iy]e?:[^\n[\]]*\]\])\s*(?=\{\{[\w-]+-stub\b)/gi, '$1\n\n\n');
		},
		cleanTemplates: function(t)
		{
			var de = this.lang === 'de';
 
			t = t.replace(/\{\{\s*:?\s*(?:Vorlage|Template)\s*:\s*/gi, '{{');
			/* Unterstriche aus allen Vorlagennamen entfernen */
			t = t.replace(/(?:^|[^{])\{\{[ 0-9a-z\xC0-\u024F-]*_[ \w\xC0-\u024F-]*/gi, function($0)
			{
				return $0.replace(/_+$/, '').replace(/[ _]+/g, ' ').replace(/\{ +/, '{');
			});
			/* Wirkungslose Leerzeilen aus Vorlagen entfernen */
			while (/^\{\{(?:<(?:br|file>)[^>]*>|[^<>{}])*\n\n+ *[|}]/m.test(t))
				t = t.replace(/^(\{\{(?:<(?:br|file>)[^>]*>|[^<>{}])*\n)\n+(?= *[|}])/gm, '$1');
 
			/* Use a {{Commons category|…}} template instead of {{Commons|Category:…}} */
			t = t.replace(/\{\{\s*Commons *(?:cat|category)?\s*\|\s*[CK]ategor[iy]e?\s*:\s*/gi,
				de ? '{{Commonscat|' : '{{Commons category|');
 
			/* Projektweit einheitliche Schreibweisen für häufig verwendete Vorlagen */
			t = t.replace(/\{\{\s*(-|Br|Breakafterimages|Clr)[\s|]*(?=\}\})/gi, de ? '{{Absatz' : '{{$1');
			t = t.replace(/\{\{\s*(?:Absatz|(Clear)(?:[ |]*(?:all|both))?)[\s|]*(?=\}\})/gi,
				de ? '{{Absatz' : function($0, $1) { return '{{' + ($1 || 'Clear'); });
			t = t.replace(/\{\{\s*(?:Artikel über lebende Pe\w*|BLP)[\s|]*(?=\}\})/gi, '{{Artikel über lebende Person');
			t = t.replace(/\{\{\s*(?:Belege|Quellen?)(?: *fehlen)?(?:[\s|]*(?=\}\})| *(?=\s*\|))/gi, '{{Belege fehlen');
			t = t.replace(/\{\{\s*(?:Benutzer(?:in)?|IP|User|Vandale)\s*\|\s*/gi,
				de ? '{{Benutzer|' : '{{User|');
			t = t.replace(/\{\{\s*cite +(?=\w+\s*\|)/gi, '{{cite ');
			t = t.replace(/\{\{\s*Commons(?:[\s|]*(?=\}\})|\s*(\|)\s*)/gi, '{{Commons$1');
			t = t.replace(/\{\{\s*Commons *cat(?:egory)?(?:[\s|]*(?=\}\})|\s*(\|)\s*)/gi,
				de ? '{{Commonscat$1' : '{{Commons category$1');
			t = t.replace(/\{\{\s*Dieser *Artikel\s*\|\s*/gi, '{{Dieser Artikel|');
			t = t.replace(/\{\{\s*DOI\s*\|\s*/gi, '{{DOI|');
			t = t.replace(/\{\{\s*dts(x?)\s*\|\s*/gi, '{{dts$1|');
			t = t.replace(/\{\{\s*Erledigt[\s|~]*\}\}/gi, '{{Erledigt|[[User:Krinkle|Krinkle]] ([[User talk:Krinkle|talk]]) 02:43, 20 January 2019 (UTC)}}');
			t = t.replace(/\{\{\s*(?:Gefallen|Fallen|Verlust|Verschlechtert|Decrease|Down|Loss)[\s|]*(?=\}\})/gi,
				de ? '{{Gefallen' : '{{decrease');
			t = t.replace(/\{\{\s*(?:Gestiegen|Steigen|Gewinn|Profit|Verbessert|Increase|Gain)[\s|]*(?=\}\})/gi,
				de ? '{{Gestiegen' : '{{increase');
			t = t.replace(/\{\{\s*(?:Hauptartikel|Hauptseite|Main|Main *articles?|See *main)\s*\|\s*/gi,
				de ? '{{Hauptartikel|' : '{{Main|');
			t = t.replace(/\{\{\s*(?:Internetquelle|Weblink)(?=\s*\|)/gi, '{{Internetquelle');
			t = t.replace(/\{\{\s*(?:In *TeX *konvertieren|TeX)(?:[\s|]*(?=\}\})|\s*(\|)\s*)/gi, '{{In TeX konvertieren$1');
			t = t.replace(/\{\{\s*lang\s*\|\s*/gi, '{{lang|');
			t = t.replace(/\{\{\s*Link *([FG]A)\s*\|\s*/gi, '{{Link $1|');
			t = t.replace(/\{\{\s*nts\s*\|\s*/gi, '{{nts|');
			t = t.replace(/\{\{\s*(?:Nur *Liste|Liste)(?:[\s|]*(?=\}\})| *(?=\s*\|))/gi, '{{Nur Liste');
			t = t.replace(/\{\{\s*Okina[\s|]*\}\}/gi, '\u02BB');
			t = t.replace(/\{\{\s*Rotten *Tomatoes\s*\|\s*/gi, '{{Rotten Tomatoes|');
			t = t.replace(/\{\{\s*S(?:iehe *auch|ee[ -]*also)\s*\|\s*/gi,
				de ? '{{Siehe auch|' : '{{See also|');
			t = t.replace(/\{\{\s*(?:SortDate|Datesort)\d*\s*\|\s*/gi,
				de ? '{{SortDate|' : '{{dts|');
			t = t.replace(/\{\{\s*SortKey(Name)?\s*\|\s*/gi,
				de ? '{{SortKey$1|' : function($0, $1) { return $1 ? '{{sortname|' : '{{sort|'; });
			t = t.replace(/\{\{\s*(?:(?:Toter|Bad|Broken|Dead)[ -]*Link|404|Dead|DL)[\s|]*(?=[|}])/gi,
				de ? '{{Toter Link' : '{{dead link');
			t = t.replace(/\{\{\s*(u)nsign?(?:iert|ed)?\s*\|\s*/gi,
				de ? '{{$1nsigniert|' : '{{$1nsigned|');
			t = t.replace(/\{\{\s*(?:Unverändert|Stabil|Steady|Nochange|Unchanged)[\s|]*(?=\}\})/gi,
				de ? '{{Unverändert' : '{{steady');
			t = t.replace(/\{\{\s*(?:Vorlage|Tl?1?|Temp|Template(?: *link)?)\s*\|\s*/gi,
				de ? '{{Vorlage|' : '{{tl|');
			t = t.replace(/\{\{\s*Wik(ibooks|inews|iquote|isource|ivoyage|tionary)[\s|]*(?=[|}])/gi, '{{Wik$1');
 
			/* Einheitliche Kleinschreibung für Sprachvorlagen wie {{enS|…}} */
			t = t.replace(/\{\{\s*([A-Za-z])([a-z]+S)(?:[\s|]*(?=\}\})|\s*(\|)\s*)/g, function($0, $1, $2, $3)
			{
				return '{{' + $1.toLowerCase() + $2 + ($3 || '');
			});
			t = t.replace(/\{\{\s*IMDb *([a-z])(\w+)\s*\|\s*/gi, function($0, $1, $2)
			{
				return '{{IMDb ' + (de ? $1.toUpperCase() : $1.toLowerCase()) + $2 + '|';
			});
 
			t = t.replace(/\(\{\{\s*B\s*((?:\|[^\n{|}]*){2,4})\}\}\)/gi, '{{Bibel$1}}');
			/* Remove navigation bar wrapper if it contains a single navigation bar only */
			t = t.replace(/\{\{\s*NaviBlock\s*\|[\s|]*([^\n<>{|}]+)[\s|]*(?=\}\})/gi, '{{$1');
			t = t.replace(/\{\{\s*(NaviBlock[^<>{}]*?)(?:[\s|]-*)*(?=\}\})/gi, function($0, $1)
			{
				return '{{' + $1.replace(/\s*\|(?:-*[\s|])*/g, '\n|') + '\n';
			});
			t = t.replace(/\{\{\s*Normdaten\s*\|\s*PND\s*=\s*/g, '{{Normdaten|TYP=p|GND=');
			t = t.replace(/\{\{\s*WBA\s*\|\s*/gi, '{{Waybackarchiv|');
			t = t.replace(
				/\[ *\{\{\s*Wayback\w*\s*\|\s*url\s*=\s*[^\s\d{|}]*(\d{1,14})\/(\w+:[^\s{|}]*)[^{}]*\}\}\s+([^[\]|]*)\]/gi,
				'{{Webarchiv | url=$2 | wayback=$1 | text=$3}}');
 
			return t.replace(/(\|\s*(?:Breit|Läng)engrad\s*=\s*[\d.\/]*?)\/[\/0]*(?=[\n|}])/g, '$1');
		},
		cleanRedundantTemplateParameters: function(t)
		{
			var parameters = window.redundantTemplateParameters || [
				'(?:IMDb Name|IMDb Titel|OFDb|Rotten Tomatoes)|2',
				'Infobox (?:Arcade|Computer- und Videospiel|Musikalbum)|Titel',
				'Infobox (?:Band|Burg|Chemikalie|Eishockeyspieler|Flughafen|Flugzeug|Gemeinde in ' +
					'(?:Deutschland|Österreich)|Gemeindeverband in Deutschland|Landkreis|Ort in den ' +
					'(?:Niederlanden|Vereinigten Staaten)|Schiff|Schutzgebiet|Software|Stadion|Unternehmen)|Name',
				'Infobox (?:Berg|Fluss|Insel|See)|NAME',
				'Infobox Fußballspieler|kurzname',
				'Infobox Gemeinde in Italien|nomeComune',
				'Infobox Nationalpark|title',
				'Infobox Ort in der Schweiz|NAME_ORT',
				'Infobox Ort in (?:Polen|Tschechien)|Ort',
				'Infobox Ortsteil einer Gemeinde(?: in Deutschland)?|Ortsteil',
				'Infobox PKW-Modell|Modell',
				'Infobox Publikation|titel'];
			var title = '\\s*(?:' +
				$.escapeRE(mw.config.get('wgTitle')).replace(/\s+/g, '\\s+') +
				'|\\{+\\w*\\}+)?\\s*';
			for (var i = parameters.length; i--; )
			{
				var m = /^(.+)\|(\d+)$/.exec(parameters[i]);
				var re = m ? m[1] + '\\s*(?:\\|[^{|}]*){' + (m[2] - 1) + '})\\|' + title + '(?=\\}\\})' :
					parameters[i].replace(/[\s_]+/g, '[\\s_]+').replace(/\|(?=[^|]*$)/, '\\s*(?:\\|[^{}]*)?)\\|\\s*') +
					'\\s*=' + title + '(?=\\||\\}\\})';
				t = t.replace(new RegExp('(\\{\\{\\s*' + re, 'g'), '$1');
			}
			return t;
		},
		cleanTemplatesByRules: function(t)
		{
			var rules = window.autoFormatTemplates || [ { name: 'Personendaten', format: '|_=_\n' } ];
			for (var rule in rules)
			{
				if (!rules[rule] || !rules[rule].name) continue;
				rule = rules[rule];
				/* Format muss minimalst |_=_ lauten */
				if (!rule.format) rule.format = '';
				if (rule.format.indexOf('|') < 0) rule.format = '|' + rule.format;
				if (rule.format.indexOf('_') < 0) rule.format = rule.format.replace('|', '|_');
				if (rule.format.indexOf('=') < 0) rule.format += '=';
				if (rule.format.match(/_+/g).length < 2) rule.format += '_';
				var re = new RegExp('\\{\\{\\s*' + rule.name.replace(/[\s_]+/g, '[\\s_]+') + '(\\s*<![^>|}]*>)?\\s*\\|', 'gi');
				var m, a = [];
				while (m = re.exec(t)) a.push(m);
				for (var i = a.length; i--; ) t = this.cleanTemplateByRule(t, rule, a[i].index + 2, a[i][1]);
			}
			return t;
		},
		cleanTemplateByRule: function(t, rule, start, comment)
		{
			var parameters, p = '', pos = start - 1;
			var nesting = { '[': 0, '{': 0 };
			while (++pos < t.length)
			{
				var c = t.charAt(pos);
				if (c === '[' || c === '{') nesting[c]++;
				else if (c === ']' && nesting['[']-- <= 0) return t;
				/* Parsing hatte nach den öffnenden {{ begonnen, also vor den schließenden }} aufhören */
				else if (c === '}' && nesting['{']-- <= 0)
				{
					if (t.charAt(pos + 1) !== '}') return t;
					if (parameters) parameters.push(p);
					break;
				}
				else if (c === '|' && nesting['['] <= 0 && nesting['{'] <= 0)
				{
					if (parameters) parameters.push(p);
					else parameters = [];
					p = '';
				}
				p += c;
			}
			if (pos >= t.length || nesting['['] > 0) return t;
 
			var m = /((_+)#*)( *)[^_]*((_+)#*)( *)/.exec(rule.format);
			var kMax = m ? m[1].length : 0, kMin = m ? m[2].length : 0, kFix = m ? m[3].length : 0;
			var vMax = m ? m[4].length : 0, vMin = m && m[5].length > 1 ? m[5].length : 0, vFix = m ? m[6].length : 0;
			var result = rule.name + (comment || '') + (/\n$/.test(rule.format) ? '\n' : '');
			for (var i = 0; parameters && i < parameters.length; i++)
			{
				p = parameters[i];
				if (!(m = /^\s*\|\s*(([^=|]*?) *)\s*=[\t \xA0]*([\s\S]*? *)\s*$/.exec(p)))
				{
					/* Leere unbenannte Parameter verwerfen, wenn ein benannter folgt */
					if (!/^\s*\|-*\s*$/.test(p) || (parameters[i + 1] && parameters[i + 1].indexOf('=') < 1))
						result += p;
					continue;
				}
				p = rule.parameters && typeof rule.parameters[m[2]] !== 'undefined' ? rule.parameters[m[2]] : m[1];
				/* Parameter verwerfen, die in den Regeln mit false oder ähnlich markiert sind */
				if (!p) continue;
				for (var f = 0; (f < kFix || kMax && p.length > kMax) && /\s$/.test(p); f++)
					p = p.slice(0, -1);
				for (var f = 0; (f < vFix || vMax && m[3].length > vMax) && /\s$/.test(m[3]); f++)
					m[3] = m[3].slice(0, -1);
				while (p.length < kMin) p += ' ';
				while (m[3].length < vMin) m[3] += ' ';
				result += rule.format.replace(/_+#*([^_]*)_+#*/, p.replace(/\$/g, '$$$$') + '$1' +
					m[3].replace(/\$/g, '$$$$'));
			}
			if (rule.format.indexOf('\n') >= 0)
			{
				if (typeof rule.trim === 'undefined' || rule.trim) result = result.replace(/[\t\r ]+$/gm, '');
				/* Schließendes }} immer auf eine eigene Zeile, wenn irgendein Umbruch im Spiel ist */
				result = result.replace(/\n+\s*$/, '') + '\n';
			}
			return t.slice(0, start) + result + t.slice(pos);
		},
		executeUserReplacements: function(t)
		{
			var from, replacements = window.autoFormatReplacements || {};
			for (from in replacements)
			{
				var to = replacements[from];
				/* Wenn die Ersetzungen kein assoziatives Objekt sondern ein 2-dimensionales Array sind */
				if (typeof to === 'object' && to.length > 1) from = to[0], to = to[1];
				/* If the search pattern is a regular expression already, 'function' is for older Chrome */
				if (typeof from === 'object' || typeof from === 'function')
				{
					t = t.replace(from, to);
					continue;
				}
				/* Leere Suchmuster sicherheitshalber nicht zulassen */
				if (/^\s*$/.test(from) || typeof to !== 'string') continue;
 
				/* Die meisten Regex-Zeichen maskieren, außer Zeichenklassen */
				from = from.replace(/([$()*+.?^{|}])/g, '\\$1');
				to = to.replace(/\$/g, '$$$$');
				/* Wortgrenzen beachten */
				from = from.replace(/^(?=\w|\\d)/, '\\b').replace(/(\w)$/, '$1\\b');
				var a = [];
				for (var re = /\\[dw]/g, m, i = 1; m = re.exec(from); a.push(m))
					to = to.replace(m[0], '$' + i++);
				for (var i = a.length; i--; )
					from = from.slice(0, a[i].index) + (a[i][0] === '\\d' ? '(\\d+)' :
						'([A-Za-z\xB5\xC0-\xD6\xD8-\xF6\xF8-\u024F]+)') +
						from.slice(a[i].index + 2);
				/* Look-ahead verwenden, wenn ein Platzhalter in Suchmuster und Ersatz am Ende steht */
				if (/\+\)\\b$/.test(from) && new RegExp('\\$' + a.length + '$').test(to))
				{
					from = from.replace(/([^()]+)\)\\b$/, '?=$1\\b)');
					to = to.replace(/\$\d+$/, '');
				}
				/* Allow optional spaces after dots in the search pattern */
				from = from.replace(/\\\.(?=[(\w\xC0-\u024F])/g, '\\.(?:[ \xA0]|&nbsp;)*');
				t = t.replace(new RegExp(from, 'g'), to);
			}
			return t;
		},
		backupNowikis: function(t)
		{
			this.nowikis = [];
			var re = /<(nowiki|includeonly|syntaxhighlight|source|html|pre|code|score|timeline|hiero|math)\b(?!\s*\/>)[\s\S]*?<\/\1\s*>/gi;
			var m;
			while (m = re.exec(t))
			{
				delete m.input;
				this.nowikis.push(m);
			}
			for (var i = this.nowikis.length; i--; )
			{
				var placeholder = '<nowiki>' + i + '<\/nowiki>';
				t = t.slice(0, this.nowikis[i].index) + placeholder +
					t.slice(this.nowikis[i].index + this.nowikis[i][0].length);
				if (/^<\w+\s*>\s*<\/\w+\s*>$/.test(this.nowikis[i][0]))
					this.nowikis[i][0] = /^no/i.test(this.nowikis[i][1]) ? '<nowiki />' : '';
				else if (/^s[oy]/i.test(this.nowikis[i][1]))
					this.nowikis[i][0] = this.nowikis[i][0].replace(/^(<)\w+|\w+\s*(?=>$)/g, '$1syntaxhighlight');
				this.nowikis[i][1] = placeholder;
				delete this.nowikis[i].index;
			}
			return t;
		},
		restoreNowikis: function(t)
		{
			for (var i = 0, len = this.nowikis.length, index = 0; i < len; i++)
			{
				index = t.indexOf(this.nowikis[i][1], index);
				if (index >= 0)
					t = t.slice(0, index) + this.nowikis[i][0] +
						t.slice(index + this.nowikis[i][1].length);
			}
			delete this.nowikis;
			return t;
		},
		backupFilenames: function(t)
		{
			/* Dateinamen retten incl. Vereinheitlichung als "Datei:" */
			this.files = [];
			/* Match <gallery> lines, [[File:Thumbnails]] and {{Template|Parameters.jpg}} */
			var re = /(^ *|\[\[:?)\s*(Bild|Datei|File|Image) *: *([^\n[\]|]*?) *(?=[\n\]|])|(^ *|\|\n?(?:[^=[\]{|}]*=)? *)\s*([^\n\/[\]{|}]*\.(?:gif|jpe?g|og\w|pdf|png|svg|tiff?))(?= *[\n|}])/gim;
			var m;
			while (m = re.exec(t))
			{
				var o = (m[5] ? m[4] : m[1]).length;
				m.index += o;
				m.l = m[0].length - o;
				/* Multiple underscores and spaces never have a meaning in filenames */
				m[3] = (m[5] || m[3]).replace(/(?:[ _\xA0]|%20|%5F|%C2%A0|&nbsp;)+/gi, ' ');
				this.files.push(m);
			}
			var r = '', p = 0;
			for (var i = 0; i < this.files.length; i++)
			{
				this.files[i][0] = '<file>' + i + '<\/file>';
				/* Einheitliche Schreibweise und Leerzeichenausgleich */
				r += t.slice(p, this.files[i].index) + (this.files[i][2] ? (this.localisation === 'de' ?
					'Datei' : this.localisation ? 'File' : this.files[i][2]) + ':' : '') + this.files[i][0];
				p = this.files[i].index + this.files[i].l;
			}
			return p ? r + t.slice(p) : t;
		},
		restoreFilenames: function(t)
		{
			/* Gerettete Dateinamen wieder einsetzen */
			var r = '', p = 0;
			for (var index, i = 0; i < this.files.length; i++)
			{
				if ((index = t.indexOf(this.files[i][0], p)) < 0) continue;
				r += t.slice(p, index) + this.files[i][3];
				p = index + this.files[i][0].length;
				delete this.files[i];
			}
			if (p) t = r + t.slice(p);
			/* Fehlschläge nochmal versuchen, passiert bspw. bei umsortierten Galeriezeilen */
			for (var i = this.files.length; i--; )
			{
				if (this.files[i])
					t = t.replace(this.files[i][0], this.files[i][3]);
			}
			delete this.files;
			return t;
		}
	};
 
	/* mw.loader.using('user.options') notwendig? */
	if (mw.user.options.get('usebetatoolbar'))
	{
		mw.loader.using('ext.wikiEditor', function()
		{
			$(document).ready(function()
			{
				$('#wpTextbox1').wikiEditor('addToToolbar', {
					'section': 'main',
					'group': 'format',
					'tools': {
						'autoFormatter': {
							'label': 'Auto-Format',
							'type': 'button',
							'icon': '//upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Broom_icon.svg/22px-Broom_icon.svg.png',
							'action': {
								'type': 'callback',
								'execute': function() { return autoFormatter.click(this); }
							}
						}
					}
				});
			});
		});
	}
	else if (mw.user.options.get('showtoolbar'))
	{
		mw.loader.using('mediawiki.action.edit', function()
		{
			mw.toolbar.addButton('//upload.wikimedia.org/wikipedia/commons/2/2e/Button_broom.png',
				'Auto-Format', '', '', '', 'mw-customeditbutton-autoFormatter');
			$(document).ready(function()
			{
				$('#mw-customeditbutton-autoFormatter').click(function() { return autoFormatter.click(this); });
			});
		});
	}
	else
	{
		$(document).ready(function()
		{
			/* Notfalls als Link unter dem Bearbeitungsfenster */
			var b = $('.editButtons'), c = b.children().last();
			(c.is('span') ? c : b).append($('.mw-editButtons-pipe-separator', b).first().clone());
			var a = $('<a href="#">Auto-Format</a>');
			a.click(function() { return autoFormatter.click(this); });
			b.append(a);
		});
	}
})(jQuery, mediaWiki);
// </nowiki>
importScript('User:Qwerfjkl/scripts/script_manager.js'); // Backlink: [[User:Qwerfjkl/scripts/script_manager.js]]