বিষয়বস্তুতে চলুন

ব্যবহারকারী:রবি/common.js: সংশোধিত সংস্করণের মধ্যে পার্থক্য

ভারতপিডিয়া থেকে
রবি (আলোচনা | অবদান)
সম্পাদনা সারাংশ নেই
রবি (আলোচনা | অবদান)
সম্পাদনা সারাংশ নেই
ট্যাগ: মোবাইল সম্পাদনা মোবাইল ওয়েব সম্পাদনা উচ্চতর মোবাইল সম্পাদনা
 
(একই ব্যবহারকারী দ্বারা সম্পাদিত ১৫৯টি মধ্যবর্তী সংশোধন দেখানো হচ্ছে না)
১ নং লাইন: ১ নং লাইন:
mw.loader.load( 'https://bn.bharatpedia.org.in/w/index.php?title=ব্যবহারকারী:রবি/নতুন পাতা সৃষ্টিকারী.js&action=raw&ctype=text/javascript' );
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/রোলব্যাক নিশ্চিতকারক.js&action=raw&ctype=text/javascript');
/**
mw.loader.load('//commons.m.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript');
* 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.
$(document).ready(function() {
* (<nowiki> zur Umgehung von [[bugzilla:8761]].)
*/
( function( $, mw ) {
if ( !document.forms['editform']
|| ( mw.config.get( 'wgAction' ) !== 'edit' && mw.config.get( 'wgAction' ) !== 'submit' )
) {
return;
}


function escapeRE( s ) {
function customAlert(msg,duration){
return s.replace( /([$()*+\-.?[\\\]^{|}])/g, '\\$1' );
var pageId = mw.config.get('wgArticleId');
}
var div = document.createElement('div');
div.style ='position: fixed; right:500px; top:100px;height:51px;padding-top:13px;width:300px;font-size:25px; display:block;border: solid 1px black;background-color:white';
div.innerHTML = "<center><img src='https://upload.wikimedia.org/wikipedia/commons/thumb/a/a1/Chulito_verde.jpg/21px-Chulito_verde.jpg'>"+"  "+msg+"</center>";
setTimeout(function() {
div.parentNode.removeChild(div);
},duration);
document.body.appendChild(div);};
var bnSpellChecker = function() {
$('#wpTextbox1').wikiEditor('addToToolbar', {
            'section': 'main',
            'group': 'insert',
            'tools': {
                'bnSpellChecker': {
                  label: 'বানান শুদ্ধি করুন',
                  type: 'button',
          icon: '//upload.wikimedia.org/wikipedia/commons/thumb/0/01/Lachit_SpellChecker.png/25px-Lachit_SpellChecker.png',
                  action: {
                        type: 'callback',
                        execute: function() {
                       
  getText = $('#wpTextbox1').val();
  x = getText.replace(/  +/g, " ");


mw.libs = mw.libs || {};
  //wiki special
  x = x.replace(/\u09DF/g, 'য়');
  x = x.replace(/{{ /g, '{{');
//  x = x.replace(/ডঃ/g, 'ড°');
  x = x.replace(/ঐতিয্য/g, 'ঐতিহ্য');
  x = x.replace(/নিম্নপ্রদত্ব/g, 'নিম্নপ্রদত্ত');
  x = x.replace(/কাহানি/g, 'কাহিনী');
  x = x.replace(/মনোনিত/g, 'মনোনীত');


mw.libs.autoFormatter = {
  // From Dibya Dutta's Pratishapan
/**
  x = x.replace(/৷/g, "।");
* @param {HTMLAnchorElement} [clickedElement]
  x = x.replace(/ ।/g, "।");
* @return {boolean}
  x = x.replace(/ ৷/g, "।");
*/
  x = x.replace(/ \?/g, "?");
click: function( clickedElement ) {
  x = x.replace(/ ॥/g, "॥");
var e = document.forms['editform'].elements,
  x = x.replace(/ !/g, "!");
textbox = e['wpTextbox1'],
  x = x.replace(/ ;/g, ";");
summaryElement = e['wpSummary'];
  x = x.replace(/ ,/g, ',');
if ( !textbox ) {
  x = x.replace(/।।/g, '');
return false;
  x = x.replace(/৷৷/g, "॥");
}
  x = x.replace(/াে/g, "ো");
  x = x.replace(/ো/g, "ো");
  x = x.replace(/অাা/g, '');
  x = x.replace(/অা/g, '');
  x = x.replace(/আা/g, 'আ');


/* Reset the button as fast as possible, even before triggering WikEd */
  //Lachit Spellchecker
this.updateButton( clickedElement );
    x = x.replace(/য়/g, 'য়');
//  x = x.replace(/ন্ট/g, 'ণ্ট');
    x = x.replace(/থ্থ/g, 'ত্থ');
    x = x.replace(/ট্ন/g, 'ত্ন');
    x = x.replace(/ধ্ধ/g, 'দ্ধ');
    x = x.replace(/ন্ঠ/g, 'ণ্ঠ');
  //  x = x.replace(/ন্ড/g, 'ণ্ড');
    x = x.replace(/ণ্দ/g, 'ন্দ');
    x = x.replace(/ণ্ধ/g, 'ন্ধ');
    x = x.replace(/ন্ঢ/g, 'ণ্ঢ');
    x = x.replace(/ণ্ত/g, 'ন্ত');
    x = x.replace(/ণ্জ/g, 'ঞ্জ');
    x = x.replace(/ন্জ/g, 'ঞ্জ');
    x = x.replace(/ন্চ/g, 'ঞ্চ');
    x = x.replace(/ন্ছ/g, 'ঞ্ছ');
    x = x.replace(/ণ্চ/g, 'ঞ্চ');
    x = x.replace(/ণ্ছ/g, 'ঞ্ছ');
    x = x.replace(/ণ্স/g, 'ন্স');
    x = x.replace(/ষ্ন/g, 'ষ্ণ');
//  x = x.replace(/স্ট/g, 'ষ্ট'); (প্রতিবর্ণীতে ভুল ফলাফল দিচ্ছে)
    x = x.replace(/স্হ/g, 'স্থ');
    x = x.replace(/ষ্হ/g, 'স্থ');
    x = x.replace(/ন্হ/g, 'ন্থ');
    x = x.replace(/স্ঠ/g, 'ষ্ঠ');
    x = x.replace(/ঙঁ/g, 'ঙ');
    x = x.replace(/ঞঁ/g, 'ঞ');
    x = x.replace(/নঁ/g, 'ন');
    x = x.replace(/ণঁ/g, 'ণ');
    x = x.replace(/মঁ/g, 'ম');
    x = x.replace(/অা/g, 'আ');
    x = x.replace(/অাা/g, 'আ');
    x = x.replace(/অাা/g, 'আ');


if ( window.wikEd && window.wikEd.useWikEd ) {
wikEd.UpdateTextarea();
}


this.clickedElement = clickedElement;
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;


var hasChanges = this.cleanElement( textbox );
    //crucial part starts
summaryElement.value = this.cleanSummary( summaryElement.value );
    // do not fiddle here
    //removes multiple question marks, exclamation


if ( window.wikEd && window.wikEd.useWikEd ) {
    x = x.replace(/\?\?\?/g, '?'); //removes triple question marks with spaces
wikEd.UpdateFrame();
    x = x.replace(/\?\?/g, '?'); //removed double question marks with spaces
}
    // x = x.replace(/!!!/g, '!'); //removes triple exclamation with spaces NOT FOR WIKI
if ( hasChanges ) {
    // x = x.replace(/!!/g, '!'); //removes double exclamation with spaces NOT FOR WIKI
mw.hook( 'AutoFormatterDoneWithChange' ).fire();
}


/* Do not follow the links href if the clicked element was a link */
    // crucial part ends
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( /[\r ]+\n/g, '\n' ) !== newValue.replace( /[\r ]+\n/g, '\n' );
this.updateButton( this.clickedElement, changed );


/* Normalisierte Zeilenumbrüche nie als Änderung werten, das vermeidet Flackern */
    // brings the question marks, exclamation, full stop before inverted comma
return changed || oldValue.replace( /\r+$/gm, '' ) !== newValue;
    // new in Version 3.0
},
//    x = x.replace(/"। /g, '।" '); // = RIGHT DOUBLE QUOTATION MARK “ = LEFT DOUBLE QUOTATION MARK
/**
    x = x.replace(/"\?/g, '?"'); // ” = RIGHT DOUBLE QUOTATION MARK “ = LEFT DOUBLE QUOTATION MARK
* @param {HTMLAnchorElement} [a]
    x = x.replace(/"! /g, '!" '); // ” = RIGHT DOUBLE QUOTATION MARK “ = LEFT DOUBLE QUOTATION MARK
* @param {boolean} [changed]
*/
updateButton: function( a, changed ) {
if ( !a || !a.nodeType || a.rel === 'autoFormatter' ) {
$( a && a.nodeType ? a : '[rel=autoFormatter]' ).css( {
backgroundColor: changed ? '#DEF740' : '',
borderRadius: changed ? '3px' : '',
opacity: changed === false ? '.4' : ''
} );
} else if ( a && a.style ) {
a.style.color = changed === false ? 'silver' : ( changed ? 'green' : '' );
}
},
cleanElement: function( e ) {
var t;


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 ) ) {
    //corrects commonly mistaken words
t = this.cleanText( e.value.substring( s1, s2 ) );
if ( t === false ) {
return false;
}
var newValue = e.value.substr( 0, s1 ) + t + e.value.substr( s2 );
e.value = newValue;
/* Fix for Opera */
s2 = s1 + t.length + ( e.value.length - newValue.length );
} else if ( !this.cleanAll( e ) ) {
return false;
}
e.selectionStart = s1;
e.selectionEnd = s2;
e.scrollTop = scroll;
return true;
} else if ( typeof document.selection === 'object' ) {
var range = document.selection.createRange();
if ( range.text.length ) {
t = this.cleanText( range.text );
if ( t !== false ) {
range.text = t;
}
return t !== false;
} else {
return this.cleanAll( e );
}
} else {
return this.cleanAll( e );
}
},
cleanAll: function( e ) {
this.isAll = true;
var t = this.cleanText( $( e ).val() );
if ( t !== false ) {
$( e ).val( t.replace( /^\s*\n/, '' ) );
}
return t !== false;
},
/**
* @param {string} summary
* @return {string}
*/
cleanSummary: function( summary ) {
summary = this.cleanWikimediaLinks( summary );
summary = this.cleanInternalLinks( summary );
return this.cleanTypography( summary );
},
/**
* @param {string} t
* @return {string|boolean}
*/
cleanText: function( t ) {
var oldValue = t;


/* Remove control characters, undefined code points, LINE/PARAGRAPH SEPARATOR, BOM */
  x = x.replace(/অংক/g, 'অঙ্ক');
t = t.replace( /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F\u2028\u2029\uFEFF]+/g, '' );
  x = x.replace(/অংকন/g, 'অঙ্কন');
t = t.replace(
  x = x.replace(/অংকুর/g, 'অঙ্কুর');
/[\t ]*[\t\xA0\xAD\u1680\u180E\u2000-\u200D\u202F\u205F\u2060\u3000]+[\t\r ]*\n/g,
  x = x.replace(/অংগ /g, 'অঙ্গ ');
'\n'
  x = x.replace(/অংগন/g, 'অঙ্গন');
);
  x = x.replace(/অংগাংগী/g, 'অঙ্গাঙ্গি');
t = t.replace( /(^|==|[^=\\]) +\n/g, '$1\n' );
  x = x.replace(/অকল্যান/g, 'অকল্যাণ');
  x = x.replace(/অকারন/g, 'অকারণ');
  x = x.replace(/অগ্রগন্য/g, 'অগ্রগণ্য');
  x = x.replace(/অগ্রহায়ন/g, 'অগ্রহায়ণ');
  x = x.replace(/অচিন্ত/g, 'অচিন্ত্য');
  x = x.replace(/অচিন্ত্যনীয়/g, 'অচিন্তনীয়');
  x = x.replace(/অঞ্জলী/g, 'অঞ্জলি');
  x = x.replace(/অণ্বেষণ/g, 'অন্বেষণ');
  x = x.replace(/অতিথী/g, 'অতিথি');
  x = x.replace(/অতিব /g, 'অতীব ');
  x = x.replace(/অতিষ্ট/g, 'অতিষ্ঠ');
  x = x.replace(/অত্যাধিক/g, 'অত্যধিক');
  x = x.replace(/অত্যান্ত/g, 'অত্যন্ত');
  x = x.replace(/অদ্ভূত/g, 'অদ্ভুত');
  x = x.replace(/অদ্যপি/g, 'অদ্যাপি');
  x = x.replace(/অদ্যবদি/g, 'অদ্যাবধি');
  x = x.replace(/অধঃস্তন/g, 'অধস্তন');
  x = x.replace(/অধিকরন/g, 'অধিকরণ');
  x = x.replace(/অধীনস্ত/g, 'অধীনস্থ');
  x = x.replace(/অধ্যাবসায়/g, 'অধ্যবসায়');
  x = x.replace(/অধ্যায়ণ/g, 'অধ্যয়ন');
  x = x.replace(/অধ্যূষিত/g, 'অধ্যুষিত');
  x = x.replace(/অনিন্দসুন্দর/g, 'অনিন্দ্যসুন্দর');
  x = x.replace(/অনিষ্ঠ/g, 'অনিষ্ট');
  x = x.replace(/অনু /g, 'অণু ');
  x = x.replace(/অনুকুল/g, 'অনুকূল');
  x = x.replace(/অনুর্ধ্ব/g, 'অনূর্ধ্ব');
  x = x.replace(/অনুসঙ্গ/g, 'অনুষঙ্গ');
  x = x.replace(/অন্তঃসত্তা/g, 'অন্তসত্ত্বা');
  x = x.replace(/অন্তকরণ/g, 'অন্তঃকরণ');
  x = x.replace(/অন্তর্ভূক্ত/g, 'অন্তর্ভুক্ত');
  x = x.replace(/অন্তর্মুখি/g, 'অন্তর্মুখী');
  x = x.replace(/অন্যমনষ্ক/g, 'অন্যমনস্ক');
  x = x.replace(/অপসৃয়মান/g, 'অপসৃয়মাণ');
  x = x.replace(/অপাংক্তেয়/g, 'অপাঙ্‌ক্তেয়');
  x = x.replace(/অপেক্ষমান/g, 'অপেক্ষমাণ');
  x = x.replace(/অভিভুত/g, 'অভিভূত');
  x = x.replace(/অভিমুখি /g, 'অভিমুখী ');
  x = x.replace(/অভ্যন্তরিক/g, 'আভ্যন্তরিক');
  x = x.replace(/অভ্যস্থ/g, 'অভ্যস্ত');
  x = x.replace(/অমানুসিক/g, 'অমানুষিক');
  x = x.replace(/অমাবশ্যা/g, 'অমাবস্যা');
  x = x.replace(/অমিতাক্ষর/g, 'অমিত্রাক্ষর');
  x = x.replace(/অর্ধ্ব/g, 'অর্ধ');
  x = x.replace(/অর্পণা/g, 'অপর্ণা');
  x = x.replace(/অলংঘ/g, 'অলঙ্ঘ্য');
  x = x.replace(/অশিরিরী/g, 'অশরীরী');
  x = x.replace(/অসুয়া/g, 'অসূয়া');
  x = x.replace(/অস্তমান/g, 'অস্তায়মান');
  x = x.replace(/অহঃরহ/g, 'অহরহ');
  x = x.replace(/আঁড়াআড়ি/g, 'আড়াআড়ি');
  x = x.replace(/আঁড়িপাতা/g, 'আড়িপাতা');
  x = x.replace(/আকষ্কিক/g, 'আকস্মিক');
  x = x.replace(/আকাংখা/g, 'আকাঙ্ক্ষা');
  x = x.replace(/আকাবাকা/g, 'আঁকাবাঁকা');
  x = x.replace(/আকুতি/g, 'আকূতি');
  x = x.replace(/আকূল/g, 'আকুল');
  x = x.replace(/আক্রমন/g, 'আক্রমণ');
  x = x.replace(/আটপৌড়ে/g, 'আটপৌরে');
  x = x.replace(/আড়ষ্ঠ/g, 'আড়ষ্ট');
  x = x.replace(/আড়ৎ/g, 'আড়ত');
  x = x.replace(/আতংক/g, 'আতঙ্ক');
  x = x.replace(/আত্মস্যাৎ/g, 'আত্মসাৎ');
  x = x.replace(/আদ্যান্ত/g, 'আদ্যন্ত');
  x = x.replace(/আদ্র/g, 'আর্দ্র');
  x = x.replace(/আনবিক/g, 'আণবিক');
  x = x.replace(/আনুষাঙ্গিক/g, 'আনুষঙ্গিক');
  x = x.replace(/আপাতঃদৃষ্টে/g, 'আপাতদৃষ্টে');
  x = x.replace(/আপাততঃ/g, 'আপাতত');
  x = x.replace(/আপোষ/g, 'আপোস');
  x = x.replace(/আভ্যন্তরীণ/g, 'অভ্যন্তরীণ');
  x = x.replace(/আয়ত্ব/g, 'আয়ত্ত');
  x = x.replace(/আয়ত্বাধীন/g, 'আয়ত্তাধীন');
  x = x.replace(/আরাম্ভ/g, 'আরম্ভ');
  x = x.replace(/আলিংগন/g, 'আলিঙ্গন');
  x = x.replace(/আলোচ্যমান/g, 'আলোচ্য');
  x = x.replace(/আশংকা/g, 'আশঙ্কা');
  x = x.replace(/আশক্তি/g, 'আসক্তি');
  x = x.replace(/আশ্বস্থ/g, 'আশ্বস্ত');
  x = x.replace(/আস্তাকুঁড়/g, 'আঁস্তাকুড়');
  x = x.replace(/ইংগিত/g, 'ইঙ্গিত');
  x = x.replace(/ইতঃস্তত/g, 'ইতস্তত');
  x = x.replace(/ইতিপূর্বে/g, 'ইতঃপূর্বে');
  x = x.replace(/ইতিমধ্যে/g, 'ইতোমধ্যে');
  x = x.replace(/ইদানিং/g, 'ইদানীং');
  x = x.replace(/ইয়ত্বা/g, 'ইয়ত্তা');
  x = x.replace(/ইষ্ঠ/g, 'ইষ্ট');
  x = x.replace(/ইষৎ/g, 'ঈষৎ');
  x = x.replace(/ঈস্পিত/g, 'ঈপ্সিত');
  x = x.replace(/উচিৎ/g, 'উচিত');
  x = x.replace(/উচ্চৈস্বরে/g, 'উচ্চৈঃস্বরে');
  x = x.replace(/উচ্ছ্বল/g, 'উচ্ছল');
  x = x.replace(/উজ্বল/g, 'উজ্জ্বল');
  x = x.replace(/উত্তরন/g, 'উত্তরণ');
  x = x.replace(/উত্তরসুরী/g, 'উত্তরসূরি');
  x = x.replace(/উত্তলন/g, 'উত্তোলন');
  x = x.replace(/উত্যক্ত/g, 'উত্ত্যক্ত');
  x = x.replace(/উদীচি/g, 'উদীচী');
  x = x.replace(/উদ্দান/g, 'উদ্যান');
  x = x.replace(/উদ্দ্যোগ/g, 'উদ্যোগ');
  x = x.replace(/উদ্ধত্য/g, 'ঔদ্ধত্য');
  x = x.replace(/উদ্বিঘ্ন/g, 'উদ্বিগ্ন');
  x = x.replace(/উদ্ভিজ/g, 'উদ্ভিজ্জ');
  x = x.replace(/উদ্ভুত/g, 'উদ্ভূত');
  x = x.replace(/উনবিংশ/g, 'ঊনবিংশ');
  x = x.replace(/উপকুল/g, 'উপকূল');
  x = x.replace(/উপচার্য/g, 'উপাচার্য');
  x = x.replace(/উপরোক্ত/g, 'উপরিউক্ত');
  x = x.replace(/উপলক্ষ্য/g, 'উপলক্ষ');
  x = x.replace(/উভয়চর/g, 'উভচর');
  x = x.replace(/উর্ধ্ব/g, 'ঊর্ধ্ব');
  x = x.replace(/উর্মি/g, 'ঊর্মি');
  x = x.replace(/উশৃঙ্খল/g, 'উচ্ছৃঙ্খল');
  x = x.replace(/উষর/g, 'ঊষর');
  x = x.replace(/উহ্য/g, 'ঊহ্য');
  x = x.replace(/উৎকর্ষতা/g, 'উৎকর্ষ');
  x = x.replace(/ঊনিশ/g, 'উনিশ');
  x = x.replace(/এককৃত/g, 'একীকৃত');
  x = x.replace(/একনিষ্ট/g, 'একনিষ্ঠ');
  x = x.replace(/একভূত/g, 'একীভূত');
  x = x.replace(/একাধিক্রমে/g, 'একাদিক্রমে');
  x = x.replace(/এক্ষুণি/g, 'এক্ষুনি');
  x = x.replace(/এতদ্‌সঙ্গে/g, 'এতৎসঙ্গে');
  x = x.replace(/এতদ্‌সত্ত্বেও/g, 'এতৎসত্ত্বেও');
  x = x.replace(/এশিয় /g, 'এশীয় ');
  x = x.replace(/ঐকবদ্ধ/g, 'ঐক্যবদ্ধ');
  x = x.replace(/ঐক্যতা/g, 'একতা');
  x = x.replace(/ঐক্যতান/g, 'ঐকতান');
  x = x.replace(/ঐক্যমত/g, 'ঐকমত্য');
  x = x.replace(/ওতঃপ্রোত/g, 'ওতপ্রোত');
  x = x.replace(/ঔচিত্ত/g, 'ঔচিত্য');
  x = x.replace(/কংকণ/g, 'কঙ্কণ');
  x = x.replace(/কংকাল/g, 'কঙ্কাল');
  x = x.replace(/কচিৎ/g, 'ক্বচিৎ');
  x = x.replace(/কটুক্তি/g, 'কটূক্তি');
  x = x.replace(/কতৃক/g, 'কর্তৃক');
  x = x.replace(/কতৃত্ত্ব/g, 'কর্তৃত্ব');
  x = x.replace(/কতৃপক্ষ/g, 'কর্তৃপক্ষ');
  x = x.replace(/কথপোকথন/g, 'কথোপকথন');
  x = x.replace(/কদাচিত/g, 'কদাচিৎ');
  x = x.replace(/ কনা/g, ' কণা');
  x = x.replace(/কনিষ্ট/g, 'কনিষ্ঠ');
  x = x.replace(/কন্ঠশিল্পী/g, 'কণ্ঠশিল্পী');
  x = x.replace(/কন্ঠস্ত/g, 'কণ্ঠস্থ');
  x = x.replace(/কয়েদী/g, 'কয়েদি');
  x = x.replace(/করনিক/g, 'করণিক');
  x = x.replace(/কর্তী/g, 'কর্ত্রী');
  x = x.replace(/কর্মচারি/g, 'কর্মচারী');
  x = x.replace(/কলংক/g, 'কলঙ্ক');
  x = x.replace(/কলসী/g, 'কলসি');
  x = x.replace(/কল্যান/g, 'কল্যাণ');
  x = x.replace(/কল্যানীয়াষু/g, 'কল্যাণীয়াসু');
  x = x.replace(/কল্যানীয়েসু/g, 'কল্যাণীয়েষু');
  x = x.replace(/কষ্ঠি/g, 'কষ্টি');
  x = x.replace(/কাঁচ/g, 'কাচ');
  x = x.replace(/কাঁছাকাছি/g, 'কাছাকাছি');
  x = x.replace(/কাংখিত/g, 'কাঙ্খিত');
  x = x.replace(/কাকলী/g, 'কাকলি');
  x = x.replace(/কাচা/g, 'কাঁচা');
  x = x.replace(/কাতলা/g, 'কাৎলা');
  x = x.replace(/কার্যতঃ/g, 'কার্যত');
  x = x.replace(/কিংবদন্তী/g, 'কিংবদন্তি');
  x = x.replace(/কিম্বা/g, 'কিংবা');
  x = x.replace(/কুটনীতি/g, 'কূটনীতি');
  x = x.replace(/কুৎসিৎ/g, 'কুৎসিত');
  x = x.replace(/কূটিল/g, 'কুটিল');
  x = x.replace(/কৃচ্ছতা/g, 'কৃচ্ছ্রতা');
  x = x.replace(/কৃচ্ছসাধন/g, 'কৃচ্ছ্রসাধন');
  x = x.replace(/কৃষিজীবি/g, 'কৃষিজীবী');
  x = x.replace(/কৃষ্টিবান/g, 'কৃষ্টিমান');
  x = x.replace(/কেন্দ্রিয়/g, 'কেন্দ্রীয়');
  x = x.replace(/কেরাণী/g, 'কেরানি');
  x = x.replace(/কোণাকুণি/g, 'কোনাকুনি');
  x = x.replace(/কৌতুহল/g, 'কৌতূহল');
  x = x.replace(/কৌতূক/g, 'কৌতুক');
  x = x.replace(/ক্রুর/g, 'ক্রূর');
  x = x.replace(/ক্ষীয়মান/g, 'ক্ষীয়মাণ');
  x = x.replace(/ক্ষুন্ন/g, 'ক্ষুণ্ণ');
  x = x.replace(/ক্ষুব্দ/g, 'ক্ষুব্ধ');
  x = x.replace(/ক্ষেপন/g, 'ক্ষেপণ');
  x = x.replace(/ক্ষেপনাস্ত্র/g, 'ক্ষেপণাস্ত্র');
  x = x.replace(/খঞ্জনী/g, 'খঞ্জনি');
  x = x.replace(/খুটিনাটি/g, 'খুঁটিনাটি');
  x = x.replace(/খুড়ী/g, 'খুড়ি');
  x = x.replace(/খুশী/g, 'খুশি');
  x = x.replace(/খেতমজুর/g, 'ক্ষেতমজু');
  x = x.replace(/খেলাধূলা/g, 'খেলাধুলা');
  x = x.replace(/খেলোয়ার/g, 'খেলোয়াড়');
  x = x.replace(/খোজ/g, 'খোঁজ');
  x = x.replace(/খোলাখোলি/g, 'খোলাখুলি');
  x = x.replace(/গংগা/g, 'গঙ্গা');
  x = x.replace(/গগণ/g, 'গগন');
  x = x.replace(/গড্ডালিকা/g, 'গড্ডলিকা');
  x = x.replace(/গত্যান্তর/g, 'গত্যন্তর');
  x = x.replace(/ গন /g, ' গণ ');
  x = x.replace(/গননা/g, 'গণনা');
  x = x.replace(/গনিত/g, 'গণিত');
  x = x.replace(/গন্য /g, 'গণ্য ');
  x = x.replace(/গন্‌জ/g, 'গঞ্জ');
  x = x.replace(/গবেষনা/g, 'গবেষণা');
  x = x.replace(/গরীব/g, 'গরিব');
  x = x.replace(/গর্ধব/g, 'গর্ধভ');
  x = x.replace(/গাড়ী/g, 'গাড়ি');
  x = x.replace(/গার্হস্থ /g, 'গার্হস্থ্য ');
  x = x.replace(/গীর্জা/g, 'গির্জা');
  x = x.replace(/গুড়া/g, 'গুঁড়া');
  x = x.replace(/গুড়ো/g, 'গুঁড়ো');
  x = x.replace(/গুণে গুণে/g, 'গুনে গুনে');
  x = x.replace(/গৃহস্ত/g, 'গৃহস্থ');
  x = x.replace(/গৃহিত/g, 'গৃহীত');
  x = x.replace(/গোধুলি/g, 'গোধূলি');
  x = x.replace(/গোষ্ঠি/g, 'গোষ্ঠী');
  x = x.replace(/গোস্পদ/g, 'গোষ্পদ');
  x = x.replace(/গ্রন্থী/g, 'গ্রন্থি');
  x = x.replace(/গ্রহন/g, 'গ্রহণ');
  x = x.replace(/গ্রহিতা/g, 'গ্রহীতা');
  x = x.replace(/গ্রামীন/g, 'গ্রামীণ');
  x = x.replace(/গ্রীক/g, 'গ্রিক');
  x = x.replace(/গ্রীস/g, 'গ্রিস');
  x = x.replace(/ঘনিষ্ট/g, 'ঘনিষ্ঠ');
  x = x.replace(/ঘরণী/g, 'ঘরনি');
  x = x.replace(/ ঘাটি/g, ' ঘাঁটি');
  x = x.replace(/ঘুরাঘুরি/g, 'ঘোরাঘুরি');
  x = x.replace(/ঘুর্ণীয়মান/g, 'ঘূর্ণায়মান');
  x = x.replace(/ঘুর্নি/g, 'ঘূর্ণি');
  x = x.replace(/ঘুসখোর/g, 'ঘুষখোর');
  x = x.replace(/ঘূণ/g, 'ঘুণ');
  x = x.replace(/ঘোষনা/g, 'ঘোষণা');
  x = x.replace(/ঘ্রান/g, 'ঘ্রাণ');
  x = x.replace(/চত্তর/g, 'চত্বর');
  x = x.replace(/চরক/g, 'চড়ক');
  x = x.replace(/চাকরানী/g, 'চাকরানি');
  x = x.replace(/চাকরী/g, 'চাকরি');
  x = x.replace(/চাকুরী/g, 'চাকুরী');
  x = x.replace(/চাতুর্যতা/g, 'চাতুর্য');
  x = x.replace(/চীৎকার/g, 'চিৎকার');
  x = x.replace(/চুড়মার/g, 'চুরমার');
  x = x.replace(/চুড়ান্ত/g, 'চূড়ান্ত');
  x = x.replace(/চূষ্য/g, 'চোষ্য');
  x = x.replace(/চৌচিড়/g, 'চৌচির');
  x = x.replace(/ছাকনি/g, 'ছাঁকনি');
  x = x.replace(/ ছাকা/g, ' ছাঁকা');
  x = x.replace(/ছাত্রীবাস/g, 'ছাত্রীনিবাস');
  x = x.replace(/ছোওয়া/g, 'ছোঁয়া');
  x = x.replace(/ছোকড়া/g, 'ছোকরা');
  x = x.replace(/ছোটখাট /g, 'ছোটোখাটো ');
  x = x.replace(/ছোটাছোটি/g, 'ছোটাছুটি');
  x = x.replace(/জংগল/g, 'জঙ্গল');
  x = x.replace(/জগত/g, 'জগৎ');
  x = x.replace(/জঘণ্য/g, 'জঘন্য');
  x = x.replace(/জটীল/g, 'জটিল');
  x = x.replace(/জবানবন্দী/g, 'জবানবন্দি');
  x = x.replace(/জরুরী/g, 'জরুরি');
  x = x.replace(/জাগরুক/g, 'জাগরূক');
  x = x.replace(/জাতিয়/g, 'জাতীয়');
  x = x.replace(/জাতী /g, 'জাতি ');
  x = x.replace(/জাতীয়করন/g, 'জাতীয়করণ');
  x = x.replace(/জানুয়ারী/g, 'জানুয়ারি');
  x = x.replace(/জিনিষ/g, 'জিনিস');
  x = x.replace(/জীবীকা/g, 'জীবিকা');
  x = x.replace(/জেষ্ঠ্য/g, 'জ্যেষ্ঠ');
  x = x.replace(/জৈষ্ঠ্য/g, 'জ্যৈষ্ঠ');
  x = x.replace(/জ্বরাজীর্ণ/g, 'জরাজীর্ণ');
  x = x.replace(/টাকশাল/g, 'টাঁকশাল');
  x = x.replace(/টেঁকসই/g, 'টেকসই');
  x = x.replace(/ডাইনী/g, 'ডাইনি');
  x = x.replace(/তক্ষুণি/g, 'তক্ষুনি');
  x = x.replace(/তছরূপ/g, 'তছরুপ');
  x = x.replace(/তড়িত/g, 'তড়িৎ');
  x = x.replace(/ততক্ষণাৎ/g, 'তৎক্ষণাৎ');
  x = x.replace(/ততধিক/g, 'ততোধিক');
  x = x.replace(/তত্তজ্ঞান/g, 'তত্ত্বজ্ঞান');
  x = x.replace(/তত্তাবদায়ক/g, 'তত্ত্বাবধায়ক');
  x = x.replace(/তত্তাবধান/g, 'তত্ত্বাবধান');
  x = x.replace(/তদসংক্রান্ত/g, 'তৎসংক্রান্ত');
  x = x.replace(/তদানুসারে/g, 'তদনুসারে');
  x = x.replace(/তদ্রুপ/g, 'তদ্রূপ');
  x = x.replace(/তফাত/g, 'তফাৎ');
  x = x.replace(/তরংগ/g, 'তরঙ্গ');
  x = x.replace(/তরান্বিত/g, 'ত্বরান্বিত');
  x = x.replace(/তর্জনি/g, 'তর্জনী');
  x = x.replace(/তষ্কর/g, 'তস্কর');
  x = x.replace(/তাঁতী/g, 'তাঁতি');
  x = x.replace(/তাবত/g, 'তাবৎ');
  x = x.replace(/তিতীক্ষা/g, 'তিতিক্ষা');
  x = x.replace(/তিরষ্কার/g, 'তিরস্কার');
  x = x.replace(/ত্বরিৎ/g, 'ত্বরিত');
  x = x.replace(/ত্যজ্য/g, 'ত্যাজ্য');
  x = x.replace(/ত্রান/g, 'ত্রাণ');
  x = x.replace(/ত্রিভূজ/g, 'ত্রিভুজ');
  x = x.replace(/তৎবিষয়ক/g, 'তদ্বিষয়ক');
  x = x.replace(/থুত্থুরে/g, 'থুত্থুড়ে');
  x = x.replace(/দক্ষিন/g, 'দক্ষিণ');
  x = x.replace(/দণ্ডবত/g, 'দণ্ডবৎ');
  x = x.replace(/দরকারী/g, 'দরকারি');
  x = x.replace(/দরুণ/g, 'দরুন');
  x = x.replace(/দারিদ্রতা/g, 'দরিদ্রতা, দারিদ্র');
  x = x.replace(/দারুন/g, 'দারুণ');
  x = x.replace(/দিকভ্রান্ত/g, 'দিগভ্রান্ত');
  x = x.replace(/দিক্ষা/g, 'দীক্ষা');
  x = x.replace(/দিঘী/g, 'দিঘি');
  x = x.replace(/দীর্ঘসূত্রিতা/g, 'দীর্ঘসূত্রতা');
  x = x.replace(/দুতাবাস/g, 'দূতাবাস');
  x = x.replace(/দুরবীক্ষন/g, 'দূরবীক্ষণ');
  x = x.replace(/দুরাবস্থা/g, 'দুরবস্থা');
  x = x.replace(/দুষ /g, 'দোষ ');
  x = x.replace(/দুষ্কৃতীকারী/g, 'দুষ্কৃতকারী');
  x = x.replace(/দূরবীক্ষন/g, 'দূরবীক্ষণ');
  x = x.replace(/দূরবীণ/g, 'দূরবীন');
  x = x.replace(/দূরারোগ্য/g, 'দুরারোগ্য');
  x = x.replace(/দূরুহ/g, 'দুরূহ');
  x = x.replace(/দূর্গ/g, 'দুর্গ');
  x = x.replace(/দৃঢ়করণ/g, 'দৃঢ়ীকরণ');
  x = x.replace(/দৃষ্টিকোন/g, 'দৃষ্টিকোণ');
  x = x.replace(/দৃষ্ঠিভঙ্গি/g, 'দৃষ্টিভঙ্গি');
  x = x.replace(/দেদীপ্যমাণ/g, 'দেদীপ্যমান');
  x = x.replace(/দেরী/g, 'দেরি');
  x = x.replace(/দৈনতা/g, 'দীনতা, দৈন্য');
  x = x.replace(/দোষনীয়/g, 'দূষণীয়');
  x = x.replace(/দৌরাত্ম/g, 'দৌরাত্ম্য');
  x = x.replace(/দ্বন্দ/g, 'দ্বন্দ্ব');
  x = x.replace(/দ্বিতীয়তঃ/g, 'দ্বিতীয়ত');
  x = x.replace(/ধজা/g, 'ধ্বজা');
  x = x.replace(/ধরণ/g, 'ধরন');
  x = x.replace(/ধাধা/g, 'ধাঁধা');
  x = x.replace(/ধারন/g, 'ধারণ');
  x = x.replace(/ধারনা/g, 'ধারণা');
  x = x.replace(/ধুমপান/g, 'ধূমপান');
  x = x.replace(/ধুর্ত/g, 'ধূর্ত');
  x = x.replace(/ধুলি/g, 'ধূলি');
  x = x.replace(/ধুসর/g, 'ধূসর');
  x = x.replace(/ধূলা/g, 'ধুলা');
  x = x.replace(/ধ্বনী/g, 'ধ্বনি');
  x = x.replace(/ধ্বস/g, 'ধ্স');
  x = x.replace(/ধ্বস্তাধ্বস্তি/g, 'ধ্স্তাধস্তি');
  x = x.replace(/নচেত/g, 'নচেৎ');
  x = x.replace(/নচ্ছাড়/g, 'নচ্ছাড়');
  x = x.replace(/নবীণ/g, 'নবীন');
  x = x.replace(/নমষ্কার/g, 'নমস্কার');
  x = x.replace(/নিক্কন/g, 'নিক্বণ');
  x = x.replace(/নিন্দ্যনীয়/g, 'নিন্দনীয়');
  x = x.replace(/নিরব/g, 'নীরব');
  x = x.replace(/নিরস /g, 'নীরস ');
  x = x.replace(/নিরুপন/g, 'নিরূপণ');
  x = x.replace(/নিরোগ/g, 'নীরোগ');
  x = x.replace(/নির্দোষী/g, 'নির্দোষ');
  x = x.replace(/নির্ধনী/g, 'নির্ধন');
  x = x.replace(/নির্নয়/g, 'নির্ণয়');
  x = x.replace(/নিস্কাশন/g, 'নিষ্কাশন');
  x = x.replace(/নিস্প্রভ/g, 'নিষ্প্রভ');
  x = x.replace(/নিস্প্রয়োজন/g, 'নিষ্প্রয়োজন');
  x = x.replace(/নিহারীকা/g, 'নীহারিকা');
  x = x.replace(/নীচে/g, 'নিচে');
  x = x.replace(/নীজ/g, 'নিজ');
  x = x.replace(/নীরলস/g, 'নিরলস');
  x = x.replace(/নূন্যতম/g, 'ন্যূনতম');
  x = x.replace(/নৃসংশ/g, 'নৃশংস');
  x = x.replace(/নৈশব্দ্য/g, 'নৈঃশব্দ্য');
  x = x.replace(/ন্যয়/g, 'ন্যায়');
  x = x.replace(/ন্যয্য/g, 'ন্যায্য');
  x = x.replace(/পংক/g, 'পঙ্ক');
  x = x.replace(/পংক্তি/g, 'পঙক্তি');
  x = x.replace(/পক্ক/g, 'পক্ব');
  x = x.replace(/পড়শী/g, 'পড়শি');
  x = x.replace(/পড়াশুনা/g, 'পড়াশোনা');
  x = x.replace(/পথমধ্যে/g, 'পথিমধ্যে');
  x = x.replace(/পথিকৃত/g, 'পথিকৃৎ');
  x = x.replace(/পন্য /g, 'পণ্য ');
  x = x.replace(/পরবর্তীতে /g, 'পরবর্তীকালে ');
  x = x.replace(/পরমানু/g, 'পরমাণু');
  x = x.replace(/পরষ্পর/g, 'পরস্পর');
  x = x.replace(/পরাস্থ/g, 'পরাস্ত');
  x = x.replace(/পরিনাম/g, 'পরিণাম');
  x = x.replace(/পরিবহণ/g, 'পরিবহন');
  x = x.replace(/পরিমান/g, 'পরিমাণ');
  x = x.replace(/পরিষ্ফুট/g, 'পরিস্ফুট');
  x = x.replace(/পরিস্কার/g, 'পরিষ্কার');
  x = x.replace(/পশ্চাদপট/g, 'পশ্চাৎপট');
  x = x.replace(/পশ্চাদপদ/g, 'পশ্চাৎপদ');
  x = x.replace(/পশ্চাৎগামী/g, 'পশ্চাদগামী');
  x = x.replace(/পশ্চাৎভূমি/g, 'পশ্চাদভূমি');
  x = x.replace(/পারদর্শীতা/g, 'পারদর্শিতা');
  x = x.replace(/পারমানবিক/g, 'পারমাণবিক');
  x = x.replace(/পার্বন/g, 'পার্বণ');
  x = x.replace(/পালংক/g, 'পালঙ্ক');
  x = x.replace(/পাষান/g, 'পাষাণ');
  x = x.replace(/পিচাশ/g, 'পিশাচ');
  x = x.replace(/পিঠস্থান/g, 'পীঠস্থান');
  x = x.replace(/পিপিলিকা/g, 'পিপীলিকা');
  x = x.replace(/পুংখানুপুংখ/g, 'পুঙ্খানুপুঙ্খ');
  x = x.replace(/পুজা/g, 'পূজা');
  x = x.replace(/পুণবিবেচনা/g, 'পুনর্বিবেচনা');
  x = x.replace(/পুন্য/g, 'পুণ্য');
  x = x.replace(/পুরষ্কার/g, 'পুরস্কার');
  x = x.replace(/পুর্ন/g, 'পূর্ণ');
  x = x.replace(/পুস্করিনী/g, 'পুষ্করিণী');
  x = x.replace(/পূজো/g, 'পুজো');
  x = x.replace(/পূবালী/g, 'পুবালি');
  x = x.replace(/পূর্ণগঠন/g, 'পুনর্গঠন');
  x = x.replace(/পৈত্রিক/g, 'পৈতৃক');
  x = x.replace(/পোষাক/g, 'পোশাক');
  x = x.replace(/পৌনঃপৌনিক/g, 'পৌনঃপুনিক');
  x = x.replace(/পৌরহিত্য/g, 'পৌরোহিত্য');
  x = x.replace(/প্রজ্জলন/g, 'প্রজ্বলন');
  x = x.replace(/প্রজ্জলিত/g, 'প্রজ্বলিত');
  x = x.replace(/প্রণয়ণ/g, 'প্রণয়ন');
  x = x.replace(/প্রতিকুল/g, 'প্রতিকূল');
  x = x.replace(/প্রতিযোগীতা/g, 'প্রতিযোগিতা');
  x = x.replace(/প্রত্যয়ণ/g, 'প্রত্যায়ন');
  x = x.replace(/প্রথমতঃ/g, 'প্রথমত');
  x = x.replace(/প্রধানতঃ/g, 'প্রধানত');
  x = x.replace(/প্রনালী/g, 'প্রণালী');
  x = x.replace(/প্রনিধান/g, 'প্রণিধান');
  x = x.replace(/প্রবাহমাণ/g, 'প্রবাহমান');
  x = x.replace(/প্রবীন/g, 'প্রবীণ');
  x = x.replace(/প্রভুত/g, 'প্রভূত');
  x = x.replace(/প্রয়ান/g, 'প্রয়াণ');
  x = x.replace(/প্রশস্থ/g, 'প্রশস্ত');
  x = x.replace(/প্রসংগ/g, 'প্রসঙ্গ');
  x = x.replace(/প্রসংশা/g, 'প্রশংসা');
  x = x.replace(/প্রাংগন/g, 'প্রাঙ্গণ');
  x = x.replace(/প্রাণপন/g, 'প্রাণপণ');
  x = x.replace(/প্রানীজগৎ/g, 'প্রাণীজগৎ');
  x = x.replace(/প্রানীবিদ্যা/g, 'প্রাণীবিদ্যা');
  x = x.replace(/ফলতঃ/g, 'ফলত');
  x = x.replace(/ফলপ্রসু/g, 'ফলপ্রসূ');
  x = x.replace(/ফাল্গুণ/g, 'ফাল্গুন');
  x = x.replace(/ফেব্রুয়ারী/g, 'ফেব্রুয়ারি');
  x = x.replace(/বংগ/g, 'বঙ্গ');
  x = x.replace(/বনষ্পতি/g, 'বনস্পতি');
  x = x.replace(/বনিক/g, 'বণিক');
  x = x.replace(/বন্টন/g, 'বণ্টন');
  x = x.replace(/বন্দোপাধ্যায়/g, 'বন্দ্যোপাধ্যায়');
  x = x.replace(/বয়ষ্ক/g, 'বয়স্ক');
  x = x.replace(/বয়োকনিষ্ট/g, 'বয়ঃকনিষ্ঠ');
  x = x.replace(/বর্ণালী/g, 'বর্ণালি');
  x = x.replace(/বর্ত্তমান/g, 'বর্তমান');
  x = x.replace(/বর্ষন/g, 'বর্ষণ');
  x = x.replace(/বাঁশী/g, 'বাঁশি');
  x = x.replace(/বাকদত্তা/g, 'বাগদত্তা');
  x = x.replace(/বাঞ্চনীয়/g, 'বাঞ্ছনীয়');
  x = x.replace(/বাঞ্চা/g, 'বাঞ্ছা');
  x = x.replace(/ বাড়ী/g, ' বাড়ি');
  x = x.replace(/বাদুর/g, 'বাদুড়');
  x = x.replace(/বানিজ্য/g, 'বাণিজ্য');
  x = x.replace(/বিদ্যান/g, 'বিদ্বান');
  x = x.replace(/বিপদগ্রস্থ/g, 'বিপদগ্রস্ত');
  x = x.replace(/বিপদজনক/g, 'বিপজ্জনক');
  x = x.replace(/বিপনন/g, 'বিপণন');
  x = x.replace(/বিপনী/g, 'বিপণী');
  x = x.replace(/বিশ্বস্থ/g, 'বিশ্বস্ত');
  x = x.replace(/বিষ্ফোরণ/g, 'বিস্ফোরণ');
  x = x.replace(/বীভৎস্য/g, 'বীভৎস');
  x = x.replace(/বুদ্ধিজীবি/g, 'বুদ্ধজীবী');
//  x = x.replace(/বেশী/g, 'বেশি'); দ্ব্যর্থক শব্দ, দুটো ভিন্ন অর্থ প্রকাশ করে
  x = x.replace(/ব্যকরণ/g, 'ব্যাকরণ');
  x = x.replace(/ব্যপক/g, 'ব্যাপক');
  x = x.replace(/ব্যহত/g, 'ব্যাহত');
  x = x.replace(/ব্যাতিক্রম/g, 'ব্যতিক্রম');
  x = x.replace(/ব্যাথা/g, 'ব্যথা');
  x = x.replace(/ব্যাপি/g, 'ব্যাপী');
  x = x.replace(/ব্যাবধান/g, 'ব্যবধান');
  x = x.replace(/ব্যাবহার/g, 'ব্যবহার');
  x = x.replace(/ব্যাভিচার/g, 'ব্যভিচার');
  x = x.replace(/ব্যায় /g, 'ব্যয় ');
  x = x.replace(/ব্যার্থ/g, 'ব্যর্থ');
  x = x.replace(/ব্যুৎপত্তি/g, 'বুৎপত্তি');
  x = x.replace(/ব্রাক্ষণ/g, 'ব্রাহ্মণ');
  x = x.replace(/ভংগ/g, 'ভঙ্গ');
  x = x.replace(/ভংগী/g, 'ভঙ্গি');
  x = x.replace(/ভংগুর/g, 'ভঙ্গুর');
  x = x.replace(/ভনিতা/g, 'ভণিতা');
  x = x.replace(/ভবিষ্যৎবাণী/g, 'ভবিষ্যদ্বাণী');
  x = x.replace(/ভরনপোষণ/g, 'ভরণপোষণ');
  x = x.replace(/ভষ্ম/g, 'ভস্ম');
  x = x.replace(/ভাষ্কর/g, 'ভাস্কর');
  x = x.replace(/ভিখারী/g, 'ভিখারি');
  x = x.replace(/ভিরু/g, 'ভীরু');
  x = x.replace(/ভীড়/g, 'ভিড়');
  x = x.replace(/ভুড়ি/g, 'ভুঁড়ি');
  x = x.replace(/ভুতপূর্ব/g, 'ভূতপূর্ব');
  x = x.replace(/ভুমিষ্ট/g, 'ভূমিষ্ঠ');
  x = x.replace(/ভুয়সী/g, 'ভূয়সী');
  x = x.replace(/ভুরিভোজন/g, 'ভূরিভোজন');
  x = x.replace(/ভূবন/g, 'ভুবন');
  x = x.replace(/ভূয়া/g, 'ভুয়া');
  x = x.replace(/ভূল/g, 'ভুল');
  x = x.replace(/ভৌগলিক/g, 'ভৌগোলিক');
  x = x.replace(/ভ্রমন/g, 'ভ্রমণ');
  x = x.replace(/ভ্রাম্যমান/g, 'ভ্রাম্যমাণ');
  x = x.replace(/ভ্রুক্ষেপ/g, 'ভ্রূক্ষেপ');
  x = x.replace(/মজুরী/g, 'মজুরি');
  x = x.replace(/মণিষা/g, 'মনীষা');
  x = x.replace(/মনমালিন্য/g, 'মনোমালিন্য');
  x = x.replace(/মনিষী/g, 'মনীষী');
  x = x.replace(/মন্ত্রনালয়/g, 'মন্ত্রণালয়');
  x = x.replace(/ময়ুর/g, 'ময়ূর');
  x = x.replace(/মরুদ্যান/g, 'মরূদ্যান');
  x = x.replace(/মশারী/g, 'মশারি');
  x = x.replace(/মস্তিস্ক/g, 'মস্তিষ্ক');
  x = x.replace(/মহত্ত/g, 'মহত্ত্ব');
  x = x.replace(/মহামতী/g, 'মহামতি');
  x = x.replace(/মহামারি/g, 'মহামারী');
  x = x.replace(/মহিয়সী/g, 'মহীয়সী');
  x = x.replace(/ মাংশ /g, ' মাংস ');
  x = x.replace(/মানিক্য/g, 'মানিক');
  x = x.replace(/মাসী/g, 'মাসি');
  x = x.replace(/মাহাত্ম/g, 'মাহাত্ম্য');
  x = x.replace(/মিতালী/g, 'মিতালি');
  x = x.replace(/মিমাংসা/g, 'মীমাংসা');
  x = x.replace(/মিরিচিকা/g, 'মরীচিকা');
  x = x.replace(/মুখস্ত/g, 'মুখস্থ');
  x = x.replace(/মুঢ়/g, 'মূঢ়');
  x = x.replace(/মুত্র/g, 'মূত্র');
  x = x.replace(/মুদ্রন/g, 'মুদ্রণ');
  x = x.replace(/মুমুর্ষ/g, 'মুমূর্ষু');
  x = x.replace(/মুর্খ/g, 'মূর্খ');
  x = x.replace(/মুর্তি/g, 'মূর্তি');
  x = x.replace(/মুর্ধন্য/g, 'মূর্ধন্য');
  x = x.replace(/মুষ্ঠি/g, 'মুষ্টি');
  x = x.replace(/মুহুর্ত/g, 'মুহূর্ত');
  x = x.replace(/মুহূর্মুহু/g, 'মুহুর্মুহু');
  x = x.replace(/মুহ্যবান/g, 'মোহ্যমান/মুহ্যমান');
  x = x.replace(/মূখ্য/g, 'মুখ্য');
  x = x.replace(/মূল্যায়ণ/g, 'মূল্যায়ন');
  x = x.replace(/মৃয়মান/g, 'ম্রিয়মাণ');
  x = x.replace(/মোটামোটি/g, 'মোটামুটি');
  x = x.replace(/মৌনতা/g, 'মৌন');
  x = x.replace(/যক্ষা/g, 'যক্ষ্মা');
  x = x.replace(/যথেষ্ঠ/g, 'যথেষ্ট');
  x = x.replace(/যদ্যাপি/g, 'যদ্যপি');
  x = x.replace(/যন্ত্রনা/g, 'যন্ত্রণা');
  x = x.replace(/যাদুঘর/g, 'জাদুঘর');
  x = x.replace(/রংগ/g, 'রঙ্গ');
  x = x.replace(/রঙিণ/g, 'রঙিন');
  x = x.replace(/রঙ্গিণ/g, 'রঙ্গিন');
  x = x.replace(/রথি/g, 'রথী');
  x = x.replace(/রসায়ণ/g, 'রসায়ন');
  x = x.replace(/রাংগামাটি/g, 'রাঙ্গামাটি');
  x = x.replace(/রামায়ন/g, 'রামায়ণ');
  x = x.replace(/রাষ্ট্রিয়/g, 'রাষ্ট্রীয়');
  x = x.replace(/রূপায়ন/g, 'রূপায়ণ');
  x = x.replace(/রোপন/g, 'রোপণ');
  x = x.replace(/লংকা/g, 'লঙ্কা');
  x = x.replace(/লংঘন/g, 'লঙ্ঘন');
  x = x.replace(/লক্ষী/g, 'লক্ষ্মী');
  x = x.replace(/লক্ষ্যণীয়/g, 'লক্ষণীয়');
  x = x.replace(/লঘুকরণ/g, 'লঘূকরণ');
  x = x.replace(/লজ্জাষ্কর/g, 'লজ্জাকর');
  x = x.replace(/লবন/g, 'লবণ');
  x = x.replace(/লাইব্রেরী/g, 'লাইব্রেরি');
  x = x.replace(/লাবন্য/g, 'লাবণ্য');
  x = x.replace(/শংকর/g, 'শঙ্কর');
  x = x.replace(/শংকা/g, 'শঙ্কা');
  x = x.replace(/শংকিত/g, 'শঙ্কিত');
  x = x.replace(/শরীক/g, 'শরিক');
  x = x.replace(/শশাংক/g, 'শশাঙ্ক');
  x = x.replace(/শশুর/g, 'শ্বশুর');
  x = x.replace(/শশ্মান/g, 'শ্মশান');
  x = x.replace(/শাড়ী/g, 'শাড়ি');
  x = x.replace(/শাষণ/g, 'শাসন');
  x = x.replace(/শারীরীক/g, 'শারীরিক');
  x = x.replace(/শাশুড়ী/g, 'শাশুড়ি');
  x = x.replace(/শিক্ষাঙ্গন/g, 'শিক্ষাঙ্গণ');
  x = x.replace(/শিরচ্ছেদ/g, 'শিরশ্ছেদ');
  x = x.replace(/শিরধার্য/g, 'শিরোধার্য');
  x = x.replace(/শিরনাম/g, 'শিরোনাম');
  x = x.replace(/শিরমণি/g, 'শিরোমণি');
  x = x.replace(/শুভাকাংখী/g, 'শুভাকাঙ্খী');
  x = x.replace(/শুশ্রুষা/g, 'শুশ্রূষা');
  x = x.replace(/শূণ্য/g, 'শুন্য');
  x = x.replace(/শৃংখলা/g, 'শৃঙ্খলা');
  x = x.replace(/শ্বাশত/g, 'শাশ্বত');
  x = x.replace(/শ্রদ্ধাঞ্জলী/g, 'শ্রদ্ধাঞ্জলি');
  x = x.replace(/শ্রদ্ধাভাজনীয়/g, 'শ্রদ্ধাভাজন');
  x = x.replace(/শ্রদ্ধাষ্পদ/g, 'শ্রদ্ধাস্পদ');
  x = x.replace(/শ্রমজীবি/g, 'শ্রমজীবী');
  x = x.replace(/শ্রাবন/g, 'শ্রাবণ');
  x = x.replace(/শ্রীমতি/g, 'শ্রীমতী');
  x = x.replace(/শ্রেষ্ট/g, 'শ্রেষ্ঠ');
  x = x.replace(/ষষ্ট/g, 'ষষ্ঠ');
  x = x.replace(/ষষ্ঠদশ/g, 'ষোড়শ');
  x = x.replace(/সংগা/g, 'সংজ্ঞা');
  x = x.replace(/সংগী/g, 'সঙ্গী');
  x = x.replace(/সখ/g, 'শখ');
  x = x.replace(/সতীন/g, 'সতিন');
  x = x.replace(/সত্বেও/g, 'সত্ত্বেও');
  x = x.replace(/সত্যয়িত/g, 'সত্যায়িত');
  x = x.replace(/সদ্যজাত/g, 'সদ্যোজাত');
  x = x.replace(/সদ্যস্নাত/g, 'সদ্যঃস্নাত');
  x = x.replace(/সনাক্ত/g, 'শনাক্ত');
  x = x.replace(/সন্মান/g, 'সম্মান');
  x = x.replace(/সন্মানীত/g, 'সম্মানীত');
  x = x.replace(/সন্মুখ/g, 'সম্মুখ');
  x = x.replace(/সন্মেলন/g, 'সম্মেলন');
  x = x.replace(/সমীচিন/g, 'সমীচীন');
  x = x.replace(/সম্বরণ/g, 'সংবরণ');
  x = x.replace(/সম্বর্ধনা/g, 'সংবর্ধনা');
  x = x.replace(/সম্বলিত/g, 'সংবলিত');
  x = x.replace(/সরকারী/g, 'সরকারি');
  x = x.replace(/সরণী/g, 'সরণি');
  x = x.replace(/সরনী/g, 'সরণি');
  x = x.replace(/সর্বাঙ্গীন/g, 'সর্বাঙ্গীণ');
  x = x.replace(/সলজ্জিত/g, 'সলজ্জ');
  x = x.replace(/সশংকিত/g, 'সশঙ্ক');
  x = x.replace(/সহকারি/g, 'সহকারী');
  x = x.replace(/সাংগ/g, 'সাঙ্গ');
  x = x.replace(/সাক্ষাতকার/g, 'সাক্ষাৎকার');
  x = x.replace(/সাড়াশী/g, 'সাঁড়াশি');
  x = x.replace(/সাধারন/g, 'সাধারণ');
  x = x.replace(/সান্তনা/g, 'সান্ত্বনা');
  x = x.replace(/সামগ্রীক/g, 'সামগ্রিক');
  x = x.replace(/সৌখিন/g, 'শৌখিন');
  x = x.replace(/স্বচ্ছল/g, 'সচ্ছল');
  x = x.replace(/স্বরস্বতী/g, 'সরস্বতী');
  x = x.replace(/স্বস্ত্রীক/g, 'সস্ত্রীক');
  x = x.replace(/স্বাতন্ত্র/g, 'স্বাতন্ত্র্য');
  x = x.replace(/স্বাধীকার/g, 'স্বাধিকার');
  x = x.replace(/স্বায়ত্ত্বশাসন/g, 'স্বায়ত্তশাসন');
  x = x.replace(/স্মরন/g, 'স্মরণ');
  x = x.replace(/স্রোতঃস্বতী/g, 'স্রোতস্বতী');
  x = x.replace(/হীনমন্যতা/g, 'হীনম্মন্যতা');
  x = x.replace(/হৃদপিণ্ড/g, 'হৃৎপিণ্ড');
  x = x.replace(/হৃদস্পন্দন/g, 'হৃৎস্পন্দন');
  x = x.replace(/হৃৎরোগ/g, 'হৃদরোগ');


/* Unsichtbares weiches Trennzeichen sichtbar machen, egal wo */
//added by YAHYA
t = t.replace( /(?:\xAD|&#*(?:shy|x0*AD\b|0*173\b);?)+/gi, '&shy;' );
    x = x.replace(/আঘাট/g, 'আঘাত');
/* ZERO WIDTH SPACE nur im Lateinischen entfernen */
    x = x.replace(/সাংঘাটিক/g, 'সাংঘাতিক');
t = t.replace( /([\x00-\u024F])\u200B+(?=[\x00-\u024F])/g, '$1' );
    x = x.replace(/আবিস্কার/g, 'আবিষ্কার');
/* LRM ist wirkungslos, wenn es neben einem LR-Zeichen steht */
    x = x.replace(/আনুসংগিক/g, 'আনুষঙ্গিক');
t = t.replace( /\u200E+(?=[A-Z\]ªµºÀ-ÖØ-öø-\u02B8])/gi, '' );
    x = x.replace(/শীততাপ/g, 'শীতাতপ');
t = t.replace( /([A-ZªµºÀ-ÖØ-öø-\u02B8])\u200E+/gi, '$1' );
    x = x.replace(/অতীষ্ঠ/g, 'অতিষ্ঠ');
t = t.replace( /\u200E+/g, '&lrm;' );
    x = x.replace(/আষ্ফালন/g, 'আস্ফালন');
    x = x.replace(/আয়ত্ব/g, 'আয়ত্ত');
    x = x.replace(/ঐশ্চর্য/g, 'ঐশ্বর্য');
    x = x.replace(/ক্রুটি/g, 'ত্রুটি');
    x = x.replace(/অংকণ/g, 'অঙ্কন');
    x = x.replace(/কোরাণ/g, 'কোরান');
    x = x.replace(/খরছ/g, 'খরচ');
    x = x.replace(/আরো /g, 'আরও ');
    x = x.replace(/বাহ্যিক লিঙ্ক/g, 'বহিঃসংযোগ');
    x = x.replace(/বাহ্যিক লিংক/g, 'বহিঃসংযোগ');


t = this.backupNowikis( t );
//নতুন শব্দ এই লাইনের উপরে যোগ হবে।
t = this.cleanCharacterEntities( t );
t = this.cleanGalleries( t );
t = this.backupFilenames( t );
t = this.cleanHeadlines( t );


/* Einheitliche Schreibweisen für Schlüsselwörter incl. Leerzeichenausgleich */
    // wiki formatting
t = t.replace(
  x = x.replace(/। </g, '।<');
/\{\{\s*(SEITENTITEL|DISPLAYTITLE):\s*/gi,
  x = x.replace(/! -/g, '!-');
this.localisation === 'de' ? '{\{SEITENTITEL:' : this.localisation
  x = x.replace(/“।/g, '।”');
? '{\{DISPLAYTITLE:'
  x = x.replace(/। ”/g, '।”');
: '{\{$1:'
  x = x.replace(/! \|/g, '!|');
);
  x = x.replace(/! }/g, '!}');
t = t.replace(
  x = x.replace(/! !/g, '!!');
/#(WEITERLEITUNG|REDIRECT)[\s:=]*\[+\s*([^[\]|]*[^\s[\]|])(?:\s*\|[^[\]]*)?\]+/gi,
  x = x.replace(/। "/g, '।" ');
this.localisation === 'de' ? '#WEITERLEITUNG [[$2]]' : this.localisation
  x = x.replace(/! "/g, '!" ');
? '#REDIRECT [[$2]]'
: '#$1 [[$2]]'
);
t = t.replace(
/\[\[ *(Category|Kategorie)\s*:\s*([^[\]|]*[^\s[\]|])\s*(?=[\]|])/gi,
this.localisation === 'de' ? '[[Kategorie:$2' : this.localisation
? '[[Category:$2'
: '[[$1:$2'
);


t = this.cleanThumbnails( t );
// some more formatting for bnwiki
t = this.cleanReferences( t );
  x = x.replace(/ <ref>/g, '<ref>');
t = this.cleanTags( t );
  x = x.replace(/ <ref /g, '<ref ');
t = this.cleanExternalLinks( t );
  x = x.replace(/{{reflist/g, '{{সূত্র তালিকা');
t = this.cleanWikimediaLinks( t );
  x = x.replace(/{{Reflist/g, '{{সূত্র তালিকা');
t = this.cleanInternalLinks( t );
  x = x.replace(/<\/references>/g, '{{সূত্র তালিকা}}');
t = this.cleanTemplates( t );
t = this.cleanISSNs( t );


t = t.replace(
  // fixing error
/\bclass\s*=\s*(?:(") *([ \w-]*? ?))?(?: *\bprettytable\b)+/g,
'class=$1$2wikitable'
);
/* Unnötige Leerzeichen bei HTML-Attributen, wichtig vor den Anführungszeichen */
t = t.replace( /[!<|][ \w"-;=?[\]]*\b *= +"/g, function( $0 ) {
return $0.replace( /(\b[a-z]+\b) *= *"/g, '$1="' );
} );


/* Ersten Interlanguage-Link suchen; 9 wegen [[zh-classical:…]] */
    x = x.replace(/বৈচিত্র/g, 'বৈচিত্র্য');
var i = t.search( /^\[\[ *[a-z]{2,3}(?:-[a-z-]{2,9})? *:/m ),
    x = x.replace(/বৈচিত্র্য্য/g, 'বৈচিত্র্য');
slice;
    x = x.replace(/তামুল/g, 'তামোল');
if ( i > 0 ) {
    x = x.replace(/ফূর্তি/g, 'স্ফূর্তি');
i = Math.max( i, t.indexOf( '<references', i ) );
    x = x.replace(/স্ফুর্তি/g, 'স্ফূর্তি');
slice = t.slice( i );
    x = x.replace(/স্স্স্ফূর্তি/g, 'স্ফূর্তি');
t = t.slice( 0, i );
    x = x.replace(/স্স্ফূর্তি/g, 'স্ফূর্তি');
}
    x = x.replace(/নৈশব্দ/g, 'নৈঃশব্দ্য');
t = this.cleanTypography( t );
    x = x.replace(/নৈঃশব্দ/g, 'নৈঃশব্দ্য');
t = this.cleanDates( t );
    x = x.replace(/নৈঃশব্দ্য্য্য/g, 'নৈঃশব্দ্য');
if ( slice ) {
    x = x.replace(/নৈঃশব্দ্য্য/g, 'নৈঃশব্দ্য');
t += slice;
    x = x.replace(/নৈঃশব্দ্যতা/g, 'নৈঃশব্দ্য');
}
    x = x.replace(/বৈশিষ্ট্য্য/g, 'বৈশিষ্ট্য');
    x = x.replace(/নিরালস্য্য/g, 'নিরালস্য');
    x = x.replace(/দৈর্ঘ্য্য/g, 'দৈর্ঘ্য');
    x = x.replace(/কেচাঁ/g, 'কেঁচা');
    x = x.replace(/কেঁচাঁ/g, 'কেঁচা');
    x = x.replace(/অন্তঃসত্বা/g, 'অন্তঃসত্ত্বা');
    x = x.replace(/অন্তসত্তা/g, 'অন্তঃসত্ত্বা');
    x = x.replace(/অন্তঃসত্তা/g, 'অন্তঃসত্ত্বা');
    x = x.replace(/ন্দ্ব্ব/g, 'ন্দ্ব');
    x = x.replace(/ধ্ব্ব/g, 'ধ্ব');
    x = x.replace(/ত্ব্ব/g, 'ত্ব');
    x = x.replace(/ঁঁ/g, '');
    x = x.replace(/মাননি\u09DF/g, 'মাননী\u09DF');
    x = x.replace(/মাননিয়/g, 'মাননীয়');
    x = x.replace(/বিদূষী/g, 'বিদুষী');
    x = x.replace(/বয়সীয়াল/g, 'বয়সিয়াল');
    x = x.replace(/রিস্কা/g, 'রিক্সা');
    //x = x.replace(/অনসুয়া/g, 'অনসূয়া');
    x = x.replace(/অনুসূয়া/g, 'অনসুয়া');
    x = x.replace(/মুমূর্ষুু/g, 'মুমূর্ষু');
    x = x.replace(/নিরবিচ্ছিন্ন/g, 'নিরবচ্ছিন্ন');
    x = x.replace(/ণ্ধ/g, 'ন্ধ');


t = this.cleanDuplicateLinks( t );
    // removes double space between anything
t = this.cleanUnits( t );
    x = x.replace(/  /g, ' '); // makes double space into one
t = this.cleanNonBreakingSpaces( t );
    x = x.replace(/  /g, ' '); //makes triple space into one
t = this.cleanISBNs( t );
t = this.cleanPMIDs( t );
t = this.cleanCategories( t );
t = this.cleanNewlines( t );


t = this.cleanRedundantTemplateParameters( t );
    x = x.replace(/য়/g, '\u09DF');
t = this.cleanTemplatesByRules( t );
t = this.executeUserReplacements( t );


t = this.restoreFilenames( t );
  $('#wpTextbox1').val(x);
t = this.restoreNowikis( t );
    customAlert('বানান শুদ্ধি সম্পন্ন!','3000');
                        }
                    }
                }
            }
        });


var changed = this.isChanged( oldValue, t );
    };
return changed ? t : false;
   
},
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
cleanCharacterEntities: function( t ) {
    if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
var entities = {
        $.when(mw.loader.using('ext.wikiEditor'), $.ready)
/* Unicodeblock Basis-Lateinisch (U+0000 bis U+007F) */
            .then(bnSpellChecker);
'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,})|(\d{3,})|[a-z]{2,9}\d{0,2}\b)(?![\dA-F=]);?/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)\b;?/gi, '&amp;' );
t = t.replace( /&amp;(?![#\w])/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' );
t = t.replace(
/<sub\s*(>[^<>]*<)\s*(?:su[bp]\s*[.\/\\]+|[.\/\\]+\s*su[bp])\s*>/gi,
'<sub$1/sub>'
);
t = t.replace(
/<sup\s*(>[^<>]*<)\s*(?:su[bp]\s*[.\/\\]+|[.\/\\]+\s*su[bp])\s*>/gi,
'<sup$1/sup>'
);


/* 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 */
// This script aligns dates into one of two formats allowed by [[WP:MOSNUM]].
t = t.replace( /<(?:[\s\/\\]*br\b)+\s*(\s\w[^<>]*?)?[\s.\/\\]*>/gi, '<br$1 />' );
// PLEASE READ THE DOCUMENTATION at [[User:Ohconfucius/script/MOSNUM dates]] (click on the link above) before using.
/* 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'
);
},
cleanGalleries: function( t ) {
return t.replace(
/<gallery\b([^<>]*)>([^<>]+)<\/gallery\b[^<>]*>/gi,
function( $0, $1, $2 ) {
return '<gallery' + $1 + '>' + $2
.replace( /^(\s*)\[+([^[\]]*)\]\]?\s*$/gm, '$1$2' )
.replace( /^(\s*)\[+/gm, '$1' ) + '<\/gallery>';
}
);
},
cleanHeadlines: function( t ) {
/* 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)?(?:&nbsp;|\s)*(?: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 */
return t.replace( /\bhttps?:\/\/\b[0-9a-z.-]*[A-Z][\w.-]*/g, function( $0 ) {
return $0.toLowerCase();
} );
},
cleanWikimediaLinks: function( t ) {
if ( typeof window.autoFormatWikimediaLinks !== 'undefined'
&& !window.autoFormatWikimediaLinks
) {
return t;
}


var wiki = mw.config.get( 'wgDBname' ).replace( /wiki$/i, '' ),
// Feedback and constructive criticism are welcome
ns = mw.config.get( 'wgFormattedNamespaces' )[-1];


/* Permanente Weblinks in Spezialseiten-Syntax umwandeln */
/**
var permaLinkReplace = function( $0, $1, $2, $3, $4 ) {
* TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
var m = /^(\d*([^#]*))(.*)$/.exec( $3 );
* @see https://meta.wikimedia.org/wiki/TemplateScript
/* Must use {{fullurl:…}} when there are more parameters than title and oldid */
*/
if ( m && m[2] ) {
// <pre>
/* {{fullurl::|oldid=…}} with no page name is not possible any more */
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
if ( !$2 ) {
$.ajax(
return $0;
'//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js',
}
{dataType: 'script', cache: true}
return '[{\{fullurl:' + ( $1 === wiki ? '' : $1 + ':' )
).done(function () {
+ $2.replace( /_/g, ' ' ) + '|oldid=' + m[1] + '}}' + m[3]
$.when(
+ ( typeof $4 === 'string' ? ' ' + $4 : '' ) + ']';
mw.loader.using(['mediawiki.util']),
} else {
$.ajax('//en.wikipedia.org/w/index.php?title=User:Ohconfucius/script/MOSNUM_utils.js&action=raw&ctype=text/javascript',
return '[[:' + $1 + ':' + ( $1 === wiki ? ns : 'Special' )
{dataType: 'script', cache: true}),
+ ':Permanent' + ( $1 === 'de' ? 'er ' : '' ) + 'Link/' + $3
$.ready
+ ( typeof $4 === 'string' ? '|' + $4 : '' ) + ']]';
).done(function () {
}
var add = function() {
};
            return mw.util.addPortletLink.apply(mw.util, arguments);
/* 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;
}
};
};
/* Alle projektinternen Weblinks protokollrelativ machen */
t = t.replace( /\[ *https?:\/+(?=[a-z-]+\.wikipedia\.org\b)/gi, '[//' );
/* Schreibweise [[Weblink#Anker mit Leerzeichen|Beschriftung]] reparieren */
t = t.replace(
/\[+\/\/([a-z-]+)\.wikipedia\.org\/w\/[\w.]*\?(?:title=([^\s&[\]|]*)&)?oldid=([^\n?[\]|]+?) *\|+ *([^\n[\]|]*?) *\]+/gi,
permaLinkReplace
);
t = t.replace(
/\[+\/\/([a-z-]+)\.wikipedia\.org\/wiki\/([^\n[\]|]*?) *\|+ *([^\n[\]|]*?) *\]+/gi,
interWikiReplace
);
/* Schreibweise [Weblink#Anker Beschriftung] umwandeln */
t = t.replace(
/\[+\/\/([a-z-]+)\.wikipedia\.org\/w\/[\w.]*\?(?:title=([^\s&[\]|]*)&)?oldid=([^\s?[\]|]+) +([^\n[\]|]+?) *\]+/gi,
permaLinkReplace
);
t = t.replace(
/\[+\/\/([a-z-]+)\.wikipedia\.org\/wiki\/([^\s[\]|]*) +([^\n[\]|]+?) *\]+/gi,
interWikiReplace
);
/* Schreibweise [Weblink#Anker] umwandeln */
t = t.replace(
/\[+\/\/([a-z-]+)\.wikipedia\.org\/w\/[\w.]*\?(?:title=([^\s&[\]|]*)&)?oldid=([^\s?[\]|]+) *\]+/gi,
permaLinkReplace
);
t = t.replace(
/\[+\/\/([a-z-]+)\.wikipedia\.org\/wiki\/([^\s[\]|]*) *\]+/gi,
interWikiReplace
);
/* Verbliebene projektinterne Weblinks ohne eckige Klammern ebenfalls umwandeln */
t = t.replace(
/\bhttps?:\/\/([a-z-]+)\.wikipedia\.org\/w\/[\w.]*\?(?:title=([^\s&[\]|]*)&)?oldid=([^\s?<>[\]{|}]*[^\s!"),.:;<>?[\\\]{|}])(?=[\s!),.:;<]|$)/gim,
permaLinkReplace
);
return t.replace(
/\bhttps?:\/\/([a-z-]+)\.wikipedia\.org\/wiki\/([^\s<>\[\]{|}]*[^\s!",.:;<>?\[\\\]{|}])(?=[\s!,.;<]|$)/gim,
interWikiReplace
);
},
cleanInternalLinks: function( t ) {
var wiki = mw.config.get( 'wgDBname' ).replace( /wiki$/i, '' ),
ns = mw.config.get( 'wgFormattedNamespaces' )[-1];


/* Unnötig gewordene Vorlage in Spezialseiten-Syntax umwandeln */
$(add('p-tb', '#', 'DATES to dmy', 'dmy-unitfixer', 'Align all dates to dmy', '', '')).click(ohc_all_to_dmy_driver);
t = t.replace(
$(add('p-tb', '#', 'DATES to mdy', 'mdy-unitfixer', 'Align all dates to mdy', '', '')).click(ohc_all_to_mdy_driver);
/\{\{\s*Permalink\s*\|[^{|}]*\|\s*(\d+(?: ?#[^{|}]*?)?)\s*(?:(\|)\s*([^{|}]*?))?\s*\}\}/gi,
// $(add('p-tb', '#', 'Expand ref dates', 't-expandref', 'Expand month names within refs', '', '')).click(ohc_expand_ref_dates_driver);
'[[' + ns + ':Permanent' + ( wiki === 'de' ? 'er ' : '' ) + 'Link/$1$2$3]]'
// $(add('p-tb', '#', 'Expand all dates', 't-expandall', 'Expand month names throughout', '', '')).click(ohc_expand_all_dates_driver);
);
$( add('p-tb', '#', 'US-slash dates', 't-US', 'US-slash', '', '') ).click(ohc_US_slash_dates_driver);
/* Make selected "fullurl" parser function calls more compact */
$( add('p-tb', '#', 'UK-slash dates', 't-UK', 'UK-slash', '', '') ).click(ohc_UK_slash_dates_driver);
t = t.replace(
});
/\{\{\s*fullurl:\s*([^\n{|}]+)\|\s*(?:diff=prev&oldid=(\d+)|oldid=(\d+)&diff=prev)\s*\}\}/gi,
});
'{\{fullurl:$1|diff=$2$3}}'
}
);


/* https://www.mediawiki.org/wiki/Help:Lint_errors/multi-colon-escape */
function ohc_fix_unambiguous_dates()
t = t.replace( /\[\[::+/gi, '[[:' );
{
// resolvable ambiguous date formats
// UK style
ohc_regex(/([^-\w/:\.])@DD\.@MM\.@YYYY(?=[^-–/\w&])/gi, "$1@Day @Month @YYYY", function(d) {
if (d.d == d.m) return true;
if (d.d > 12) return true;
return false;
});
ohc_regex(/([^-\w/:\.])@DD\/@MM\/@YYYY(?=[^-–/\w&])/gi, "$1@Day @Month @YYYY", function(d) {
if (d.d == d.m) return true;
if (d.d > 12) return true;
return false;
});


/* Wikilinks mit unnötigem Präfix ":w:de:", "w:de:" oder ":de:" vereinfachen */
// US style
t = t.replace(
ohc_regex(/([^-\w/:\.])@MM\.@DD\.@YYYY(?=[^-/\w&])/gi, "$1@Month @Day, @YYYY", function(d) {
new RegExp(
if (d.d > 12) return true;
'\\[\\[ *(?::? *w *)?: *' + wiki
return false;
+ ' *: *(((?:Bild|Datei|File|Image|[CK]ategor[iy]e?) *:)?[^\\n[\\]]*\\S) *\\]\\]',
});
'gi'
ohc_regex(/([^-\w/:\.])@MM\/@DD\/@YYYY(?=[^-/\w&])/gi, "$1@Month @Day, @YYYY", function(d) {
),
if (d.d > 12) return true;
function( $0, $1, $2 ) {
return false;
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, ' ' );
}
);
 
/* Save relevant spaces at the beginning of links */
t = t.replace( /(?: +|(\S))(\[\[[^\n[\]|]\|) +/g, '$1 $2' );
/* Save relevant spaces at the end of links */
t = t.replace( /(\[\[[^\n[\]|]\|[^\n[\]|]*[^\s[\]|]) +]](?: +|(?=\S))/g, '$1]] ' );
/* [[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[\]|]+?)(?:(-+)]](?![^\w"'(<[«\xC0-\u024F‚„‹])|]]([a-zßäöü]*))/g,
'[[$1$2$4]]$3'
);
t = t.replace( /(^|[^'])\[\[([^\n:[\]|]+)\|('{2,5}) *\2 *\3]](?!')/g, '$1$3[[$2]]$3' );
 
var unmaskLinks = typeof window.autoFormatMaskedLinks === 'undefined'
|| window.autoFormatMaskedLinks,
capitalLinks = /^\w+wiki$/.test( mw.config.get( 'wgDBname' ) );
/* [[Link|Link]]s werden zu [[Link]]s weil kürzer und besser lesbar */
return t.replace(
new RegExp(
'\\[\\[([^\\n:[\\]|])([^\\n:[\\]|]*)\\| *([^\\n:[\\]|]\\2)('
+ ( unmaskLinks ? '[^\\n[\\]|]' : '[a-zßäöü]' )
+ '*?) *]]',
'g'
),
function( $0, $1, $2, $3, $4 ) {
return ( capitalLinks
? $1.toLowerCase() !== $3.charAt().toLowerCase()
: $1 !== $3.charAt() )
? $0
: '[[' + $3 + ']]' + $4;
}
);
},
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' );
}
 
/* Exclude articles with titles like "1. März" or "March 1" */
if ( /^(3[01]|[12]\d|[1-9])\.? \S+$/.test( mw.config.get( 'wgTitle' ) )
|| /^\w+ (3[01]|[12]\d|[1-9])$/.test( mw.config.get( 'wgTitle' ) )
|| /\[\[[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+:(?:\[\[[^\n\]]*\]\]|[^\n\]])*\]\])*(?:\s*\{\{(?:\{\{[^}]*\}\}|[^}])*\}\})+/.exec( t ),
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'];
if ( this.lang === 'de' && /österreichbezogen\b/i.test( t ) ) {
months[1] = 'Jänner';
}
 
/* Add missing space between day and month */
t = t.replace( new RegExp( '([\\s!\'(>|„](?: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])\\.?(?:[\\s\\xA0]|&nbsp;)+(?:' +
months.slice( 1 ).join( '|' ) + '))(?:\xA0|&nbsp;)(?=[12]\\d{3}\\b)', 'g' ), '$1 ' );
if ( this.lang !== 'fi' ) {
/* 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')<\]“](?!\w*\d))/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 */
var dash = this.lang === 'ru' ? '—' : '–';
separator = this.lang === 'de' ? ' bis ' : ' – ';
t = t.replace(
/(\b +[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 ) + dash + ( $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 !$3 || $2 < $3 ? $1 + dash : $0;
}
);
/* "1980 – 90" becomes "1980–1990" in the German Wikipedia, "1980–90" otherwise */
var full = typeof window.autoFormatShortYearRanges !== 'undefined'
? window.autoFormatShortYearRanges : this.lang === '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{4})–(?=\d)/g, '$1-' );
},
/**
* @param {string} t
* @return {string}
*/
cleanTypography: function( t ) {
var de = this.lang === 'de',
ru = this.lang === 'ru';
 
/* Double quotes */
if ( de || ru ) {
t = t.replace(
/(^|[\s!#'(*+\/:;>[|-])(?:"|,,)(?![\s>])([^\n"“”„]*[^\s"(;=“”„])"(?=[\s!'),.\/:;<?\]}-]|$)/g,
ru || /\bschweizbezogen\b/i.test( t )
&& ( t.indexOf( '«' ) !== -1 || t.indexOf( '„' ) === -1 )
? '$1«$2»'
: '$1„$2“'
);
}
t = t.replace(
/\{\{\s*((?:Zitat|")\s*\|\s*(?:(?:1|Text)\s*=)?[^={|}]*)/gi,
function( $0, $1 ) {
return '{\{' + $1.replace( /„([^\n‘‚“”„]+)“/g, '‚$1‘' );
}
);
if ( this.lang !== 'en' ) {
/* Replace exactly three dots with ellipsis */
t = t.replace( /(^|[ '(>[|„])\.\.\.(?=[ '),<?\]}“]|$)/gm, '$1…' );
}
t = t.replace( /[,;](?:[ \xA0]|&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–'
);
if ( this.lang !== 'it' ) {
t = t.replace(
/([\w"')>\]\xC0-\u024F“]) +-(,?) +(?=[\w"'(\[\xC0-\u024F„])/g,
'$1 –$2 '
);
}
return t;
},
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' || this.lang === 'ru' ) {
t = t.replace(
/([\s'(*+;«„][\u2212-]?\d+(?:[,–]\d+)?)(?=%[\s!'),.:<?\]|»“](?! *[\d"#);]))/gi,
'$1 '
);
t = t.replace(
/((?:\d|\b)[cmk]?m) *<[Ss][Uu][Pp]\s*>\s*([23²³])\s*<\/[Ss][Uu]\w\s*>(?=[\s!"'),\-.:;<?\]{|}–“])/g,
function( $0, $1, $2 ) {
return $1 + ( { '2': '²', '3': '³' }[$2] || $2 );
}
);
}
/* Maßeinheiten immer mit Leerzeichen */
return t.replace(
/([ '(*+:;„][\u2212-]?\d+(?:[,–]\d+)?) ?(k[Bgm]|Ki?B|k?Hz|[MGT](?:i?B|Hz)|cm|ha|m[lm]|[gm€¥])(?=[²³]?[ !'),.\/:;<?“])/g,
'$1&nbsp;$2'
);
},
cleanNonBreakingSpaces: function( t ) {
/* Paragraf, Abs. und Satz mit geschützten Leerzeichen */
t = t.replace(
/§(?: *|&nbsp;)(\d\w* +Ab?s?\.)(?: *|&nbsp;)(\d+ +S\.) *(?=\d)/gi,
'§&nbsp;$1&nbsp;$2&nbsp;'
);
t = t.replace( /§(?: *|&nbsp;)(\d\w* +Ab?s?\.) *(?=\d)/gi, '§&nbsp;$1&nbsp;' );
t = t.replace( /§ *(?=\d)/gi, '§&nbsp;' );
 
/* No non-breaking spaces in headlines */
return t.replace( /^=.*&nbsp;.*=$/gim, function( $0 ) {
return $0.replace( /(?:&nbsp;|\s)+/gi, ' ' );
} );
},
cleanISBNs: function( t ) {
t = t.replace( /\bISBN\W*(?:\d+&shy;(?=\d))+/gi, function ( $0 ) {
return $0.replace( /&shy;/g, '' );
} );
/* ISBNs mit Bindestrichen gliedern */
return t.replace(
/(^|[\s#'(*>|])(?:(ISBN\d?\s*=\s*)|ISBN(?:-?1[03]\b| *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-' );
}
);
},
cleanISSNs: function( t ) {
return t.replace(
/(^|[\s#'(*>{|])ISSN *(\|?)[ #:\u2010-\u2014\u2212-]*((?:\d[ \u2010-\u2014\u2212-]*){7}[\dX]\b)/gi,
function( $0, $1, $2, $3 ) {
return $1 + 'ISSN' + ( $2 || ' ' ) + $3.replace( /[^\dX]+/gi, '' )
.replace( /^(.{4})/, '$1-' );
}
);
},
cleanPMIDs: function( t ) {
return t.replace(
/(^|[\s#'(*=>|])PMID[ #:\u2010-\u2014\u2212-]*(?=\d+\b)/gi,
'$1PMID '
);
},
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( /< *ref\s*(\s\b[^<>]*?)\s*(?:\/+|>\s*<\s*\/+\s*ref) *>/gi, '<ref$1 />' );


/* Zeilenumbrüche in Einzelnachweisen nur oben im Artikel entfernen */
function ohc_US_slash_dates_to_mdy()
var i = t.indexOf( '<references' ),
{
slice;
//ranges
if ( i > 0 ) {
ohc_regex(/([^-\d/:\.])@MM\/@DD\/@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@MM\/@DD\/@YYNN(?=[^-–/\w&])/gi, "$1@Mon1 @Day1, @Year1$2 – @Mon2 @Day2, @Year2");
slice = t.slice( i );
ohc_regex(/([^-\d/:\.])@MM\.@DD\.@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@MM\.@DD\.@YYNN(?=[^-–/\w&])/gi, "$1@Mon1 @Day1, @Year1$2 – @Mon2 @Day2, @Year2");
slice = slice.replace( /< *ref\s*(\s\b[^<\/>]*?)?\s*>[\t ]*/gi, '<ref$1>' );
ohc_regex(/(\| ?)@MM\/@DD\/@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@MM\/@DD\/@YYNN(?=\s*\|)/gi, "$1@Mon1 @Day1, @Year1$2 – @Mon2 @Day2, @Year2");
slice = slice.replace( /(?:(\n[\t ]*)|[\t ]*)<\s*\/+\s*ref\s*>/gi, '$1<\/ref>' );
ohc_regex(/(\| ?)@MM\.@DD\.@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@MM\.@DD\.@YYNN(?=\s*\|)/gi, "$1@Mon1 @Day1, @Year1$2 – @Mon @Day2, @Year2");
t = t.slice( 0, i );
}
t = t.replace( /< *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 */
// resolvable ambiguous date formats
t = t.replace( /([!,.;?]|<ref\b[^<>]*(?:\/|>[^<>]*<\/ref)>) +(?=<ref[ >])/gi, '$1' );
ohc_regex(/([^-\d/:\.])@MM\/@DD\/@YYNN(?=[^-–/\w&])/gi, '$1@Month @Day, @YYYY');
/* Zwei gleiche Satzzeichen vor und nach einem <ref> auf eins kürzen */
ohc_regex(/([^-\d/:\.])@MM\.@DD\.@YYNN(?=[^-–/\w&])/gi, '$1@Month @Day, @YYYY');
return t.replace( /([!,.:;?])(<ref\b[^<>]*(?:\/|>[^<>]*<\/ref)>)\1/gi, '$1$2' );
ohc_regex(/([^-\d/:\.])@MM[-–]@DD[-–]@YYNN(?=[^-–/\w&])/gi, '$1@Month @Day, @YYYY');
},
ohc_regex(/(\| ?)@MM\/@DD\/@YYNN(?=\s*\|)/gi, '$1@Month @Day, @YYYY');
cleanCategories: function( t ) {
ohc_regex(/(\| ?)@MM\.@DD\.@YYNN(?=\s*\|)/gi, '$1@Month @Day, @YYYY');
if ( this.lang !== 'de' && this.lang !== 'en' ) {
// ohc_regex(/(\| ?)@MM[-–]@DD[-–]@YYNN(?=\s*\|)/gi, '$1@Month @Day, @YYYY');
return t;
}
}
function ohc_UK_slash_dates_to_dmy()
{
//ranges
ohc_regex(/([^-\d/:\.])@DD\/@MM\/@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@DD\/@MM\/@YYNN(?=[^-–/\w&])/gi, "$1@Day1 @Mon1 @Year1$2 – @Day2 @Mon2 @Year2");
ohc_regex(/([^-\d/:\.])@DD\.@MM\.@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@DD\.@MM\.@YYNN(?=[^-–/\w&])/gi, "$1@Day1 @Mon1 @Year1$2 – @Day2 @Mon2 @Year2");
ohc_regex(/(\| ?)@DD\/@MM\/@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@DD\/@MM\/@YYNN(?=\s*\|)/gi, "$1@Day1 @Mon1 @Year1$2 – @Day2 @Mon2 @Year2");
ohc_regex(/(\| ?)@DD\.@MM\.@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@DD\.@MM\.@YYNN(?=\s*\|)/gi, "$1@Day1 @Mon1 @Year1$2 – @Day2 @Mon2 @Year2");


t = t.replace(
// resolvable ambiguous date formats
/\{\{\s*(SORTIERUNG|DEFAULT ?\w*SORT\w*)\s*[:|][\s\xA0]*/gi,
ohc_regex(/([^-\d/:\.])@DD\/@MM\/@YYNN(?=[^-–/\w&])/gi, '$1@Day @Month @YYYY');
this.localisation === 'de' ? '{\{SORTIERUNG:' : this.localisation ? '{\{DEFAULTSORT:' : '{\{$1:'
ohc_regex(/([^-\d/:\.])@DD\.@MM\.@YYNN(?=[^-–/\w&])/gi, '$1@Day @Month @YYYY');
);
ohc_regex(/([^-\d/:\.])@DD[-–]@MM[-–]@YYNN(?=[^-–/\w&])/gi, '$1@Day @Month @YYYY');
ohc_regex(/(\| ?)@DD\/@MM\/@YYNN(?=\s*\|)/gi, '$1@Day @Month @YYYY');
ohc_regex(/(\| ?)@DD\.@MM\.@YYNN(?=\s*\|)/gi, '$1@Day @Month @YYYY');
// ohc_regex(/(\| ?)@DD[-–]@MM[-–]@YYNN(?=\s*\|)/gi, '$1@Day @Month @YYYY');
}


/* Match every character thats in one of the two replacement maps or should be deleted */
function ohc_remove_leading_zeroes()
var re = /["&'\-\/?`¡-¥©-´·-ſǍ-\u01ED\u01F8-\u021B\u02B0-\u036FΆ-ώ\u0400-Ј\u040D-ј\u045DўҐ-ғҚқҢңҮ-ұҺһ\u04D0-\u04D7\u1E00-ỹ\u2010-•′″‹›−ff-st]/g;
{
/* Unicodeblock Lateinisch-1, Ergänzung (U+0080 bis U+00FF) */
ohc_regex(/(\D[^\w\/])@Month\s@ZD@th?,?\s@YYYY(?=\W\D)/gi, "$1@LMonth @Day, @LYear");
var trSet1 = '"/?¡¢£¤¥©ª«¬®°±²³·¹º»¿ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝàáâãäåçèéêëìíîïðñòóôõö÷øùúûüýÿ';
ohc_regex(/(\D[^\w\/])@Month\s@ZD@th?(?=\W\D)/gi, "$1@LMonth @Day");
var trSet2 = '    cL YCa  R  23 1o  AAAAAACEEEEIIIIDNOOOOOxOUUUUYaaaaaaceeeeiiiidnooooo ouuuuyy';
ohc_regex(/(\D[^\w\/])@ZD@th?\s@Month\s@YYYY(?=\W\D)/gi, "$1@Day @LMonth @LYear");
/* Unicodeblock Lateinisch, erweitert-A (U+0100 bis U+017F) */
ohc_regex(/(\D[^\w\/])@ZD@th?\s@Month(?=\W\D)/gi, "$1@Day @LMonth");
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',
/* Unicodeblock Alphabetische Präsentationsformen (U+FB00 bis U+FB4F) */
'ff': 'ff', 'fi': 'fi', 'fl': 'fl', 'ffi': 'ffi', 'ffl': 'ffl', 'ſt': 'st', 'st': 'st'
};
trSet1 += this.lang === 'de' ? "–" : "'-–";
trSet2 += this.lang === '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 */
function ohc_delink_dates()
var title = escapeRE( mw.config.get( 'wgTitle' ) );
{
t = t.replace(
//add missing space between wikilinks
new RegExp( '\\{\\{(?:SORTIERUNG|DEFAULT\\w*SORT\\w*):\\s*' + title + '\\}\\}\\s*', 'gi' ),
regex(/(\]\])(\[\[)/gi, '$1 $2'); //remove (?!file:) to ensure a space between all links
''
);
// rem redundant quote marks and parentheses
var m = /\{\{(?:SORTIERUNG|DEFAULT\w*SORT\w*):([^\n{}]*)/.exec( t );
regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)\'\'\'([^|}\[\]]*)\'\'\'(?=\s*[|}])/gi, "$1$2");
t = t.replace( new RegExp( '(\\[\\[[CK]ategor[iy]e?:[^[\\]|]*)\\|'
regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)\'\'([^|}\[\]]*)\'\'(?=\s*[|}])/gi, "$1$2");
+ ( m && escapeRE( m[1] ) || title ) + '\\s*(?=\\]\\])', 'gi' ), '$1' );
regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)\"([^|}\[\]]*)\"(?=\s*[|}])/gi, "$1$2");
return t.replace(
regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)\(([^|}\[\]]*)\)(?=\s*[|}])/gi, "$1$2");
/(\[\[[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, '{\{' );
//delink unpiped dates
/* Unterstriche aus allen Vorlagennamen entfernen */
//delink full dates
t = t.replace(
ohc_regex(/\[\[@Day[\s_](?:of[\s_])?@Month(?:\]\]\s?\[\[\| )@YYYY\]\]/gi, "@Day @LMonth @YYYY");
/(?:^|[^{])\{\{([ \da-z\xC0-\u024F-]*_[ \w\xC0-\u024F-]*[|}])/gi,
ohc_regex(/\[\[@Month (?:the\s)?@Day(?:\]\],? \[\[|, )@YYYY\]\]/gi, "@LMonth @Day, @YYYY");
function( $0, $1 ) {
return /^[A-Z_]+\}$/.test( $1 )
? $0
: $0.replace( /_+(?=[|}])/, '' ).replace( /[ _]+/g, ' ' ).replace( /\{ +/, '{' );
}
);
/* Drop empty templates */
t = t.replace(
/\{\{(?:Datum|e?dtsx?|Format(?:Date\d*|Num\w*|Zahl\w*)|Literatur|nts|Sort(?:Date\d*|Key\w*))[\s|]*\}\}(?!\})/gi,
''
);
/* Wirkungslose Leerzeilen aus Vorlagen entfernen */
while ( /^\{\{(?:<(?:br|file>)[^>]*>|[^<>{}])*\n\n+ *[|}]/m.test( t ) ) {
t = t.replace( /^(\{\{(?:<(?:br|file>)[^>]*>|[^<>{}])*\n)\n+(?= *[|}])/gm, '$1' );
}


/* Use the "Commons category" template instead of "Commons" with a category */
//delink yyyy-mm-dd dates
t = t.replace( /\{\{\s*Commons *(?:cat|category)?\s*\|\s*[CK]ategor[iy]e?\s*:\s*/gi,
ohc_regex(/\[\[@YYYY(?:\]\]-\[\[|-)@MM-@DD\]\]/gi, "@YYYY-@MM-@DD");
de ? '{\{Commonscat|' : '{\{Commons category|' );
ohc_regex(/@YYYY-\[\[@MM-@DD\]\]/gi, "@YYYY-@MM-@DD");


/* Projektweit einheitliche Schreibweisen für häufig verwendete Vorlagen */
//underscore and nbsp in linked dates
t = t.replace(
ohc_regex(/\[\[@DD@th?(?:\s|_|&nbsp;)@Month\]\]/gi, "@Day @LMonth");
/\{\{\s*(-|Br|Breakafterimages|Clr)[\s|]*(?=\}\})/gi,
ohc_regex(/\[\[@Month(?:\s|_|&nbsp;)@DD@th?\]\]@th?/gi, "@LMonth @Day"); //consolidated regex with flexible removal of ordinal simple date
de ? '{\{Absatz' : '{\{$1'
ohc_regex(/\[\[@Day @Month\]\]/gi, "@Day @LMonth");
);
ohc_regex(/\[\[@Month @YYYY\]\]/gi, "@LMonth @YYYY");
t = t.replace(
ohc_regex(/\[\[@YYYY\]\]/gi, "@YYYY");
/\{\{\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,
de ? '{\{Artikel über lebende Person' : '{\{BLP'
);
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*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|~~\~~}}' );
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*IMDb\s*\|\s*(\w+)\s*/gi, '{\{IMDb|$1' );
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'
);


/* Lower case German language template names "enS" and so on */
//remove leading zero and links from linked date
t = t.replace(
ohc_regex(/\[\[@Month(?:[ _]|&nbsp;)@ZD@th\]\]/gi, "@LMonth @Day");
/\{\{\s*([A-Za-z])([a-z]+S)(?:[\s|]*(?=\}\})|\s*(\|)\s*)/g,
ohc_regex(/\[\[@ZD@th(?:[ _]|&nbsp;)@Month\]\]/gi, "@Day @LMonth");
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 nowrap template from dm and md dates
/* Remove navigation bar wrapper if it contains a single navigation bar only */
ohc_regex(/(date[ ]*=[ ]*)\{\{(?:j|no ?(?:break|wrap))\|(?:@DD(?:[ _]|&nbsp;)@Month)( @yyyy|)\}\}/gi, '$1@DD @LMonth$2');
t = t.replace( /\{\{\s*NaviBlock\s*\|[\s|]*([^\n<>{|}]+)[\s|]*(?=\}\})/gi, '{\{$1' );
ohc_regex(/(date[ ]*=[ ]*)\{\{(?:j|no ?(?:break|wrap))\|(?:@Month(?:[ _]|&nbsp;)@DD)( @yyyy|)\}\}/gi, '$1@LMonth @DD$2');
t = t.replace(
/\{\{\s*(NaviBlock[^<>{}]*?)(?:[\s|]-*)*(?=\}\})/gi,
//delink single dm or 'dth the m'
function( $0, $1 ) {
ohc_regex(/(?:the\s)?\[\[@Day@th?[\s_](?:of[\s_])?@Month\]\]/gi, "@Day @LMonth");
return '{\{' + $1.replace( /\s*\|(?:-*[\s|])*/g, '\n|' ) + '\n';
//delink single md or 'm the dth'
}
ohc_regex(/\[\[@Month[\s_](?:the[\s_])?@Day@th?\]\](?=\W)/gi, "@LMonth @Day");
);
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' );
//month+day piped
},
ohc_regex(/\[\[(?:@dd@th?[\s_](?:of[\s_])?@month|@month[\s_]@dd@th?)\|((?:@month |)@day)@th?\]\]/gi, "$1");
cleanRedundantTemplateParameters: function( t ) {
ohc_regex(/\[\[(?:@dd@th?[\s_](?:of[\s_])?@month|@month[\s_]@dd@th?)\|@Day@th?[\s_](@month|)\]\]/gi, "@Day $1");
var parameters = window.redundantTemplateParameters || [
'(?:IMDb(?: Name| Titel)?|OFDb|Rotten Tomatoes)|2',
'Infobox (?:Arcade|Computer- und Videospiel|Musikalbum)|Titel',
'Infobox (?:Bahnhof|Band|Burg|Chemikalie|County \\(Vereinigte Staaten\\)|Eishockeyspieler|Flug(?:gesellschaft|hafen|zeug)|Fußballsaison|Gemeinde in '
+ '(?:Deutschland|Österreich)|Gemeindeverband in Deutschland|Hochschule|Landkreis|Medaillen|Militärische Einheit|Ort in '
+ '(?:den Niederlanden|den Vereinigten Staaten|der Türkei|Portugal)|Schiff|Schutzgebiet|Software|Stadion|Tennis(?:spieler|turnierjahrgang)|Unternehmen)|Name',
'Infobox (?:Berg|Burg|Fluss|Gebirgsgruppe|Insel|Ort|See|Stadt in Lateinamerika|Stausee|Verwaltungseinheit)|NAME',
'Infobox Brücke|BEZEICHNUNG',
'Infobox Fußballspieler|kurzname',
'Infobox Galaxie|Caption',
'Infobox Gemeinde in Italien|nomeComune',
'Infobox Gemeinde in Spanien|Gemeinde',
'Infobox Gemeinde in Spanien|nombre',
'Infobox Militärischer Konflikt|KONFLIKT',
'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|Nationalpark)|titel',
'Infobox Schule|Schulname'
];
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\\xA0]*' + rule.name.replace( /[\s_]+/g, '[\\s_]+' )
+ '(\\s*<![^>|}]*>)?[\\s\\xA0]*\\|', 'gi' ),
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,
nesting = { '[': 0, '{': 0 };


while ( ++pos < t.length ) {
// ohc_regex(/\[\[@month @dd(?:#[^|]+|)\|([^|\]]+)@th?\]\]/gi, "$1");
var c = t.charAt( pos );
// ohc_regex(/\[\[@dd @month(?:#[^|]+|)\|([^|\]]+)@th?\]\]/gi, "$1");
if ( c === '[' || c === '{' ) {
ohc_regex(/\[\[@month @yyyy(?:#[^|]+|)\|([^|\]]+)\]\]/gi, "$1");
nesting[c]++;
} else if ( c === ']' && nesting['[']-- <= 0 ) {
return t;
} else if ( c === '}' && nesting['{']-- <= 0 ) {
/* Parsing started after opening brackets, so stop before closing */
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 );
//month+day+year pseudo-ISO dates
var kMax = m ? m[1].length : 0,
ohc_regex(/\[\[@Month @DD\|\d\d-\d\d\]\]-(?:\[\[)?(?:@yyyy[^|]*\|)?@YYYY(?:\]\])/gi, "@Day @LMonth @YYYY");
kMin = m ? m[2].length : 0,
ohc_regex(/\[\[@DD\s@Month\|\d\d-\d\d\]\]-(?:\[\[)?(?:@yyyy[^|]*\|)?@YYYY(?:\]\])/gi, "@Day @LMonth @YYYY");
kFix = m ? m[3].length : 0,
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 f, i = 0; parameters && i < parameters.length; i++ ) {
p = parameters[i];
if ( !( m = /^\s*\|[\s\xA0]*(([^=|]*?) *)[\s\xA0]*=[\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 ( f = 0; ( f < kFix || kMax && p.length > kMax ) && /\s$/.test( p ); f++ ) {
p = p.slice( 0, -1 );
}
for ( 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 ) {
//'[[month day|xxXxx]]Xyyyy ' to 'month day, year'
var to = replacements[from];
ohc_regex(/\[\[@Month\s@Day\|@dd.@dd\]\].@YYYY/gi, "@LMonth @Day, @YYYY");
/* Wenn die Ersetzungen kein assoziatives Objekt sondern ein 2-dimensionales Array sind */
//'[[day month|xxXxx]]Xyyyy' to 'day month year'
if ( typeof to === 'object' && to.length > 1 ) {
ohc_regex(/\[\[@Day\s@Month\|@dd.@dd\]\].@YYYY/gi, "@Day @LMonth @YYYY");
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 */
// century
from = from.replace( /([$()*+.?^{|}])/g, '\\$1' );
regex(/\[\[((?:first|second|third|(?:four|fif|six|seven|eigh|nin|ten|eleven|twelf|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twentie)th|twenty[\s\-]first[\s\-])centur(?:y|ies)(?:\s(?:AD|BC|CE|BCE))?)\]\]/gi, '$1');
to = to.replace( /\$/g, '$$$$' );
regex(/\[\[(?:first|second|third|(?:four|fif|six|seven|eigh|nin|ten|eleven|twelf|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twentie)th|twenty[\s\-]first)[\s\-_]centur(?:y|ies)(?:\s(?:AD|BC|CE|BCE))?\|([^\]]{1,30})\]\]/gi, '$1');
/* Wortgrenzen beachten */
regex(/\[\[(\d{1,2}(?:st|[nr]d|th))[\s\-_](centur(?:y|ies))(\s(?:AD|BC|CE|BCE)|)\]\]/gi, '$1 $2$3');
from = from.replace( /^(?=\w|\\d)/, '\\b' ).replace( /(\w)$/, '$1\\b' );
ohc_regex(/\[\[\d{1,2}@th[\s\-_]centur(?:y|ies)(?:\s(?:AD|BC|CE|BCE)|)\|([^\]]{1,30})\]\]/gi, '$1');
var a = [];
for ( var re = /\\[dw]/g, m, i = 1; m = re.exec( from ); a.push( m ) ) {
to = to.replace( m[0], '$' + i++ );
}
for ( 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|graph|mapframe|score|templatedata|templatestyles|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 = [];
var ns = mw.config.get( 'wgFormattedNamespaces' )[6],
ext = mw.config.get( 'wgFileExtensions' ) || ['png', 'gif', 'jpg', 'jpeg', 'tiff',
'tif', 'xcf', 'pdf', 'mid', 'ogg', 'ogv', 'svg', 'djvu', 'oga', 'flac', 'wav', 'webm'];
/* Match <gallery> lines, [[File:Thumbnails]] and template parameters with file names */
var m,
re = new RegExp(
'(^ *|\\[\\[:*(?:\\w+:)?)\\s*(' + ns + '|Bild|File|Image) *: *([^\\n[\\]|]*?) *(?=[\\n\\]|])|'
+ '(^ *|\\|\\n?(?:[^=[\\]{|}]*=)? *)\\s*([^\\n/[\\]{|}]*\\.(?:'
+ ext.join( '|' ) + '))(?= *[\\n|}])|'
+ '(\\|\\s*Commons(?:cat)? *= *)([^\\n/[\\]{|}]*)(?=[\\n|}])',
'gim'
);
while ( m = re.exec( t ) ) {
var o = ( m[6] || ( 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[6] ? m[7] : 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>';
r += t.slice( p, this.files[i].index );
if ( this.files[i][2] ) {
/* Einheitliche Schreibweise und Leerzeichenausgleich */
r += ( this.localisation && !/\w:$/.test( this.files[i][1] ) ? ns : this.files[i][2] ) + ':';
}
r += 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++ ) {
// months
if ( ( index = t.indexOf( this.files[i][0], p ) ) < 0 ) {
ohc_regex(/\[\[@Month\]\]/gi, "@LMonth");
continue;
ohc_regex(/\[\[@FullMonth\|([^\]]{1,30})\]\]/gi, "$1");
}
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 ( 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;
}
};


var label = window.autoFormatterButtonLabel || 'Auto-Format';
// decades and years
regex(/(\d{1,3}0)[‘`´’′]?s/g, '$1s');
regex(/\[\[(\d{1,3}0)\'?s\]\]/g, '$1s');
regex(/\[\[\d{1,3}0\'?s?\|([^\]]{1,30})\]\]/g, '$1');
regex(/\[\[(\d{1,3}0)\'?(s)?\s(AD|BC|CE|BCE)\]\]/gi, '$1$2 $3');
regex(/\[\[(\d{1,4}[\s_]?)(AD|BC|CE|BCE)\]\]/gi, '$1$2');
regex(/\[\[(AD|BC|CE|BCE)([\s_]?)(\d{1,4})\]\]/gi, '$1$2$3');
ohc_regex(/([-–])\[\[\s?@yyyy\s?\|\s?(\d{2,4})\s?\]\]/gi, '$1$2'); //piped year
regex(/\[\[([12]\d{3}|[1-9]\d{0,2})\]\]/gi, '$1');
regex(/\[\[\d{1,3}0\'?s?\s(?:AD|BC|CE|BCE)\|([^\]]{1,30})\]\]/gi, '$1');
regex(/\[\[\d{1,3}0\'?s?\s\(decade\)\|([^\]]{1,30})\]\]/gi, '$1');


mw.loader.using( 'user.options', function() {
//month+year
if ( mw.user.options.get( 'usebetatoolbar' ) ) {
//Identify surprise or 'Easter egg' diversions linking month+years to year articles. Turn them into month+year links to be dealt with below
mw.loader.using( 'ext.wikiEditor', function() {
ohc_regex(/\[\[@yyyy in[^|\]]+\|@Day @Month @YYYY\]\]/gi, "@Day @LMonth @YYYY");
$( function() {
ohc_regex(/\[\[@yyyy in[^|\]]+\|@Month @Day,? @YYYY\]\]/gi, "@LMonth @Day, @YYYY");
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
ohc_regex(/\[\[@yyyy#[^|\]]+\|(@month\s|)(@yyyy)\]\]/gi, "$1$2");
'section': 'main',
ohc_regex(/\[\[@yyyy#[^|\]]+\|(@month|@yyyy)\]\]/gi, "$1");
'group': 'format',
ohc_regex(/\[\[(@month\s@yyyy)\]\]/gi, "$1");
'tools': {
ohc_regex(/\[\[@month\s@yyyy\|([^\]]{1,30})\]\]/gi, "$1");
'autoFormatter': {
ohc_regex(/\[\[(?:List of |)Bollywood films of @yyyy\|@YYYY\]\](?= [^\[]{2}^B)/gi, "@YYYY");
'label': label,
'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 mw.libs.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',
label,
'', '', '',
'mw-customeditbutton-autoFormatter'
);
$( function() {
$( '#mw-customeditbutton-autoFormatter' ).click( function() {
return mw.libs.autoFormatter.click( this );
} );
} );
} );
} else {
$( function() {
/* Notfalls als Link unter dem Bearbeitungsfenster */
var b = $( '.editButtons' ),
c = b.children().last(),
a = $( '<a href="#">' + label + '<\/a>' );


( c.is( 'span' ) ? c : b ).append( $( '.mw-editButtons-pipe-separator', b ).first().clone() );
ohc_regex(/(\[\[@yyyy[^|\]]+\|@yyyy)(\]\])( season)/gi, "$1$3$2");
a.click( function() { return mw.libs.autoFormatter.click( this ); } );
b.append( a );
} );
}
} );
} )( jQuery, mediaWiki );
// </nowiki>
var autoFormatMaskedLinks = false;
var autoFormatReplacements = [
[' উইকিপিডিয়া ', ' ভারতপিডিয়া ']
];
/**
HotCat V2.43


Ajax-based simple Category manager. Allows adding/removing/changing categories on a page view.
//removed piped years when in full date (excepting disambiguated parentheses - updated 24/2/2012)
Supports multiple category changes, as well as redirect and disambiguation resolution. Also
// ohc_regex(/\[\[[^|\]\(\)]{1,32}\|@YYYY\]\]/gi, '@Year');  // 23/6/2021 – disabled delinking "other" year-in articles
plugs into the upload form. Search engines to use for the suggestion list are configurable, and
can be selected interactively.


Documentation: https://commons.wikimedia.org/wiki/Help:Gadget-HotCat
//Identify surprise or 'Easter egg' diversions linking months to year or "year in" articles.
List of main authors: https://commons.wikimedia.org/wiki/Help:Gadget-HotCat/Version_history
ohc_regex(/\[\[\d{1,4}#[^|\]]+\|@Month\]\]/gi, "@LMonth");
ohc_regex(/\[\[@yyyy \w[^|\]]{3,12}\|@Year\]\]/gi, '@Year');


License: Quadruple licensed GFDL, GPL, LGPL and Creative Commons Attribution 3.0 (CC-BY-3.0)
// month and day piped
ohc_regex(/\[\[@month[\s_]@day\|@MM-@DD\]\]/gi, "@MM-@DD");
ohc_regex(/\[\[@month[\s_]@day\|([^\]]{1,30})\]\]/gi, "$1");
ohc_regex(/\[\[@day(?:\s|_|@th )(?:of[\s_]|)?@month\|([^\]]{1,30})\]\]/gi, "$1");


Choose whichever license of these you like best :-)
//years piped
regex(/\[\[\d{1,4}\|([^\]]{1,30})\]\]/gi, '$1');
}


This code should run on any MediaWiki installation >= MW 1.27.
function ohc_fix_common_errors()
{
ohc_regex(/(\d)<sup>@th<\/sup>/gi, '$1th');
// remove dashbot comment from dates
regex(/<!-- ?DASHBot ?-->/gi, '');
ohc_regex(/(\|\s*(?:date|year)\s*=)\s*c(?:irca|a\.)?\s?((?:@day |)@month @year)(?=[\s\n]*[<|}])/gi, '$1c. $2'); //add space
//common cs1 errors
regex(/(\|\s*(?:date|year)\s*=)\s*(1[7-9]\d|20[0-1])\?(?=[\s\n]*[<|}])/gi, '$1c. $20');
regex(/(\|\s*(?:date|year)\s*=\s*(1[7-9])\d{2})[-–](\d{2})(?=[\s\n]*[<|}])/gi, '$1–$2$3');
// regex(/(\|\s*(?:date|year)\s*=\s*(20)[0-1]\d)[-–]([0-2]\d)(?=[\s\n]*[<|}])/gi, '$1–$2$3');
regex(/(\|\s*(?:date|year)\s*=\s*)@YYYY\s*[-–/]\s*@YYYY(?=[\s\n]*[<|}])/gi, '$1@YYYY1–@YYYY2'); //common cs1 error
regex(/(\|\s*(?:date)\s*=)\s*s(pring|ummer),?\s*((?:1[7-9]\d|20[0-1])\d)(?=[\s\n]*[<|}])/gi, '$1S$2 $3'); //common cs1 error
regex(/(\|\s*(?:date)\s*=)\s*a(utumn),?\s*((?:1[7-9]\d|20[0-1])\d)(?=[\s\n]*[<|}])/gi, '$1A$2 $3'); //common cs1 error
regex(/(\|\s*(?:date)\s*=)\s*f(all),?\s*((?:1[7-9]\d|20[0-1])\d)(?=[\s\n]*[<|}])/gi, '$1F$2 $3'); //common cs1 error
regex(/(\|\s*(?:date)\s*=)\s*w(inter),?\s*((?:1[7-9]\d|20[0-1])\d)(?=[\s\n]*[<|}])/gi, '$1W$2 $3'); //common cs1 error
ohc_regex(/(\|\s*access-?date\s*=)\s*(@month @year)(?=[\s\n]*[<|}])/gi, '$11 $2'); //common cs1 error
// ohc_regex(/(\|\s*date\s*=\s*)@year\?(?=[\s\n]*[<|}])/gi, '$1@Year'); //common cs1 error
// ohc_regex(/(\|\s*(?:date|year)\s*=)\s*@year\?(?=[\s\n]*[<|}])/gi, '$1c. @Year'); //common cs1 error
// ohc_regex(/(\|\s*(?:date|year)\s*=)\s*(@month @year)\?(?=[\s\n]*[<|}])/gi, '$1c. $2'); //common cs1 error
ohc_regex(/(\|\s*access-?date\s*=)\s*@month @day, (1[7-9]\d{2}|2000)(?=[\s\n]*[<|}])/gi, '$1'); //rem access date before Wikipedia (জানুয়ারি 2001)
ohc_regex(/(\|\s*access-?date\s*=)\s*@day @month.? (1[7-9]\d{2}|2000)(?=[\s\n]*[<|}])/gi, '$1'); //rem access date before Wikipedia (জানুয়ারি 2001)
ohc_regex(/(\|\s*access-?date\s*=)\s*31( (?:এপ্রিল|জুন|সেপ্টেম্বর|নভেম্বর) @year)(?=[\s\n]*[<|}])/gi, '$130$2'); //rem nonsense access date (short months)
ohc_regex(/(\|\s*access-?date\s*=)\s*29( ফেব্রুয়ারি (?:200[1235679]|201[1345789]))(?=[\s\n]*[<|}])/gi, '$128$2'); //rem nonsense access date 29 ফেব্রুয়ারি (non-leap year)
ohc_regex(/(\|\s*access-?date\s*=)\s*(?:3[01])( ফেব্রুয়ারি @yyyy)(?=[\s\n]*[<|}])/gi, '$128$2'); //rem nonsense access dates ফেব্রুয়ারি
regex(/(\|\s*access-?date\s*=)\s*(\d{4})(?=[\s\n]*[<|}])/gi, ''); //common cs1 error
//month+day+year pseudo-ISO dates
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*@dd)-@Mon-@YYYY/gi, "$1 @FullMonth @YYYY");
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@YYYY-@DD-@Mon/gi, "$1 @DD @FullMonth @YYYY");


For use with older versions of MediaWiki, use the archived versions below:
regex(/(\|\s*(?:date|year)\s*=)\s*(?:(?:date |)unknown|(?:not? |non-|un)date[ds])(?=[\s\n]*[<|}])/gi, '$1n.d.'); //common cs1 error
regex(/(\|\s*(?:date|year)\s*=)\s*n\.?d(?=[\s\n]*[<|}])/gi, '$1n.d.'); //common cs1 error
regex(/(\|\s*)year(\s*=\s*)(?=n\.?d\.)(?=[\s\n]*[<|}])/gi, '$1date$2'); //common cs1 error


<=1.26: https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&oldid=211134664
  // remove parasitic metadata -  days of the week/descriptives
*/
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:[^|}\d]*|)@Day\s+@Month\s+@YYYY((?:[a-z]\b|)\s?)[^|<}]*(?=[\s\n]*[<|}])/gi, "$1@Day @Month @YYYY$2"); //rem negate "<", "hyphens" "dashes" 26/6/2020
// <nowiki>
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)[^|}]*@Month\s+@Day,\s+@YYYY((?:[a-z]\b|)\s?)[^|<}]*(?=[\s\n]*[<|}])/gi, "$1@Month @Day, @YYYY$2"); //rem negate "<", "hyphens" "dashes" 26/6/2020
/* eslint-disable vars-on-top, one-var, camelcase, no-alert, curly */
// ohc_regex(/(\|\s*date\s*=\s*)(?:[^|}–<]*\D|)@Day\s+@Month\s+@YYYY ?– ?@Day\s+@Month\s+@YYYY[^|}–<]*(?=[\s\n]*[<|}])/gi, "$1@Day1 @Mon1 @Year1 – @Day2 @Mon2 @Year2");
/* global jQuery, mediaWiki, UFUI, JSconfig, UploadForm */
// ohc_regex(/(\|\s*date\s*=\s*)[^|}–<]*@Month\s+@Day,\s+@YYYY ?– ?@Month @Day, @YYYY[^|}–<]*(?=[\s\n]*[<|}])/gi, "$1@Mon1 @Day1, @Year1 – @@Mon2 Day2, @Year2");
/* jslint strict:false, nonew:false, bitwise:true */
// regex(/(\|\s*author\s*=\s*)(?:posted|published)(?: by\b| on\b|)[\s:](?=\w)/gi, "$1");
( function ( $, mw ) {
// regex(/(\|\s*(?:date|archive-?date|access-?date|author|year)\s*=\s*)(?:accessed|retrieved|entered|posted|published|(?:last |)updated?|©)(?: by\b| on\b|)[\s:]*(?=\w)/gi, "$1");
// Don't use mw.config.get() as that takes a copy of the config, and so doesn't
regex(/(\|\s*(?:author|first|last)\s*=\s*)(?:by\b|on\b)[\s:]*(?=\w)/gi, "$1");
// account for values changing, e.g. wgCurRevisionId after a VE edit
regex(/(\|\s*(?:date|archive-?date|access-?date|author|first|last)\s*=\s*)(?:(?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day,?)\s/gi, "$1");
var
regex(/(\|\s*(?:date|archive-?date|access-?date|author|first|last)\s*=\s*)(?:Mon|Tues?|Wed|Thur?|Fri|Sat)[\.,]?\s/gi, "$1"); //<!-- rem "Sun" - false positives -->
        conf = $.extend( {}, mw.config.values, {
            // when running on mobile domain - do not use wgServer.
            wgServer: window.location.host.indexOf('.m.') > -1 ?
                '//' + window.location.host : mw.config.get( 'wgServer' )
        } );


// Guard against double inclusions (in old IE/Opera element ids become window properties)
  // remove deprecated parameters (|day= and |month)
if ( ( window.HotCat && !window.HotCat.nodeName ) ||
ohc_regex(/(\|\s*)day(?:\s*=\s*)@DD ?\| ?month(?:\s*=\s*)@Month ?\| ?year(?:\s*=\s*)@YYYY(?=[|}\s])/gi, '$1date=@Day @Month @Year');
conf.wgAction === 'edit' ) // Not on edit mode
ohc_regex(/(\|\s*)year(?:\s*=\s*)@YYYY ?\| ?month(?:\s*=\s*)@Month ?\| ?day(?:\s*=\s*)@DD(?=[|}\s])/gi, '$1date=@Month @Day, @Year');
return;
// typos
ohc_regex(/(date *= *)@Day @Month ?@th/gi, '$1@Day @Month');
ohc_regex(/(date *= *)@Day @Month\w(?= \d{3,4})/gi, '$1@Day @Month');  


// Configuration stuff.
ohc_regex(/(date *= *(?:[12]?\d|30|31) )(জানুয়ারি|Febr)[\w ]?[aur]{3,4}\w{0,2}(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1$2uary');
var HC = window.HotCat = {
ohc_regex(/(date *= *(?:[12]?\d|30|31) )J[anu]{3,5}r\w{0,2}(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1জানুয়ারি');
// Localize these messages to the main language of your wiki.
ohc_regex(/(date *= *(?:[12]?\d) )Febua?r\w{0,2}(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1ফেব্রুয়ারি');
messages: {
ohc_regex(/(date *= *(?:[12]?\d|30|31) )M\w{2,3}ch(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1মার্চ');
cat_removed: 'removed [[Category:$1]]',
ohc_regex(/(date *= *(?:[12]?\d|30) )A[bpv\[]\w{2,3}l\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1এপ্রিল');
template_removed: 'removed {{[[Category:$1]]}}',
ohc_regex(/(date *= *(?:[12]?\d|30|31) )Ma[tui](?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1মে');  
cat_added: 'added [[Category:$1]]',
ohc_regex(/(date *= *(?:[12]?\d|30) )J\wn\w(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুন');  
cat_keychange: 'new key for [[Category:$1]]: "$2"', // $2 is the new key
ohc_regex(/(date *= *(?:[12]?\d|30) )J\w{1,2}e(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুন');  
cat_notFound: 'Category "$1" not found',
ohc_regex(/(date *= *(?:[12]?\d|30|31) )জুলাই\w{1,2}(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুলাই');
cat_exists: 'Category "$1" already exists; not added.',
ohc_regex(/(date *= *(?:[12]?\d|30|31) )A[oug]{2,3}\w{1,4}t(?:\w|us)?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1আগষ্ট');
cat_resolved: ' (redirect [[Category:$1]] resolved)',
ohc_regex(/(date *= *(?:[12]?\d|30|31) )(সেপ্টেম্বর|নভেম্বর|ডিসেম্বর)\w{2,4}b[er]{1,2}\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1$2ember');
uncat_removed: 'removed {{uncategorized}}',
ohc_regex(/(date *= *(?:[12]?\d|30) )S\w{0,2}p[ \[]?\w{2,5}[er]{2,3}\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1সেপ্টেম্বর');
separator: '; ',
ohc_regex(/(date *= *(?:[12]?\d|30|31) )O\w{0,2}t\w{1,3}[er]{2,3}\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1অক্টোবর');
// Some text to prefix to the edit summary.
ohc_regex(/(date *= *(?:[12]?\d|30) )[MN]\w{1,2}[bv] ?\w{1,3}b[er]{1,2}\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1নভেম্বর');
prefix: '',
ohc_regex(/(date *= *(?:[12]?\d|30|31) )D[ie]?[cs] ?\w{1,4}b[er]{1,2}\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1ডিসেম্বর');
// Some text to append to the edit summary. Named 'using' for historical reasons. If you prefer
// to have a marker at the front, use prefix and set this to the empty string.
using: ' using [[Help:Gadget-HotCat|HotCat]]',
// $1 is replaced by a number. If your language has several plural forms (c.f. [[:en:Dual (grammatical form)]]),
// you can set this to an array of strings suitable for passing to mw.language.configPlural().
// If that function doesn't exist, HotCat will simply fall back to using the last
// entry in the array.
multi_change: '$1 categories',
// Button text. Localize to wgContentLanguage here; localize to wgUserLanguage in a subpage,
// see localization hook below.
commit: 'Save',
// Button text. Localize to wgContentLanguage here; localize to wgUserLanguage in a subpage,
// see localization hook below.
ok: 'OK',
// Button text. Localize to wgContentLanguage here; localize to wgUserLanguage in a subpage,
// see localization hook below.
cancel: 'Cancel',
// Localize to wgContentLanguage here; localize to wgUserLanguage in a subpage,
// see localization hook below.
multi_error: 'Could not retrieve the page text from the server. Therefore, your category changes ' +
'cannot be saved. We apologize for the inconvenience.',
// Defaults to '[[' + category_canonical + ':$1]]'. Can be overridden if in the short edit summaries
// not the standard category name should be used but, say, a shorter namespace alias. $1 is replaced
// by a category name.
short_catchange: null
},
// Plural of category_canonical.
categories: 'Categories',
// Any category in this category is deemed a disambiguation category; i.e., a category that should not contain
// any items, but that contains links to other categories where stuff should be categorized. If you don't have
// that concept on your wiki, set it to null. Use blanks, not underscores.
disambig_category: 'Disambiguation',
// Any category in this category is deemed a (soft) redirect to some other category defined by a link
// to another non-blacklisted category. If your wiki doesn't have soft category redirects, set this to null.
// If a soft-redirected category contains more than one link to another non-blacklisted category, it's considered
// a disambiguation category instead.
redir_category: 'Category redirects',
// The little modification links displayed after category names. U+2212 is a minus sign; U+2193 and U+2191 are
// downward and upward pointing arrows. Do not use ↓ and ↑ in the code!
links: {
change: '(±)',
remove: '(\u2212)',
add: '(+)',
restore: '(×)',
undo: '(×)',
down: '(\u2193)',
up: '(\u2191)'
},
changeTag: conf.wgUserName ? 'HotCat' : '', // if tag is missing, edit is rejected
// The tooltips for the above links
tooltips: {
change: 'Modify',
remove: 'Remove',
add: 'Add a new category',
restore: 'Undo changes',
undo: 'Undo changes',
down: 'Open for modifying and display subcategories',
up: 'Open for modifying and display parent categories'
},
// The HTML content of the "enter multi-mode" link at the front.
addmulti: '<span>+<sup>+</sup></span>',
// Tooltip for the "enter multi-mode" link
multi_tooltip: 'Modify several categories',
// Return true to disable HotCat.
disable: function () {
var ns = conf.wgNamespaceNumber;
var nsIds = conf.wgNamespaceIds;
return (
ns < 0 || // Special pages; Special:Upload is handled differently
ns === 10 || // Templates
ns === 828 || // Module (Lua)
ns === 8 || // MediaWiki
ns === 6 && !conf.wgArticleId || // Non-existing file pages
ns === 2 && /\.(js|css)$/.test( conf.wgTitle ) || // User scripts
nsIds &&
( ns === nsIds.creator ||
ns === nsIds.timedtext ||
ns === nsIds.institution ) );
},
// A regexp matching a templates used to mark uncategorized pages, if your wiki does have that.
// If not, set it to null.
uncat_regexp: /\{\{\s*[Uu]ncategorized\s*[^}]*\}\}\s*(<!--.*?-->\s*)?/g,
// The images used for the little indication icon. Should not need changing.
existsYes: '//upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png',
existsNo: '//upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png',
// a list of categories which can be removed by removing a template
// key: the category without namespace
// value: A regexp matching the template name, again without namespace
// If you don't have this at your wiki, or don't want this, set it to an empty object {}.
template_categories: {},
// Names for the search engines
engine_names: {
searchindex: 'Search index',
pagelist: 'Page list',
combined: 'Combined search',
subcat: 'Subcategories',
parentcat: 'Parent categories'
},


// Override the decision of whether HotCat should help users by automatically
ohc_regex(/(date *= *)@Month\w(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1@Month'); //rem stray digit at the end of year string
// capitalising the title in the user input text if the wiki has case-sensitive page names.
// Basically, this will make an API query to check the MediaWiki configuration and HotCat then sets
ohc_regex(/(date *= *)(জানুয়ারি|Febr)[\w ]?[aur]{3,4}\w{0,2}(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1$2uary');
// this to true for most wikis, and to false on Wiktionary.
ohc_regex(/(date *= *)J[anu]{3,5}r\w{0,2}(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1জানুয়ারি');
//  
ohc_regex(/(date *= *)Febua?r\w{0,2}(?=(?: (?:[12]?\d),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1ফেব্রুয়ারি');
// You can set this directly if there is a problem with it. For example, Georgian Wikipedia (kawiki),
ohc_regex(/(date *= *)M\w{2,3}ch(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1মার্চ');
// is known to have different capitalisation logic between MediaWiki PHP and JavaScript. As such, automatic
ohc_regex(/(date *= *)A[bpv\[]\w{2,3}l\w?(?=(?: (?:[12]?\d|30),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1এপ্রিল');
// case changes in JavaScript by HotCat would be wrong.
ohc_regex(/(date *= *)Ma[tui](?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1মে');
capitalizePageNames: null,
ohc_regex(/(date *= *)J\wn\w(?=(?: (?:[12]?\d|30),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুন');
// If upload_disabled is true, HotCat will not be used on the Upload form.
ohc_regex(/(date *= *)J\w{1,2}e(?=(?: (?:[12]?\d|30),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুন');
upload_disabled: false,
ohc_regex(/(date *= *)জুলাই\w{1,2}(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুলাই');
// Single regular expression matching blacklisted categories that cannot be changed or
ohc_regex(/(date *= *)A[oug]{2,3}\w{1,4}t(?:\w|us)?(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1আগষ্ট');
// added using HotCat. For instance /\bstubs?$/ (any category ending with the word "stub"
ohc_regex(/(date *= *)(সেপ্টেম্বর|নভেম্বর|ডিসেম্বর)\w{2,4}b[er]{1,2}\w?(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1$2ember');
// or "stubs"), or /(\bstubs?$)|\bmaintenance\b/ (stub categories and any category with the
ohc_regex(/(date *= *)S\w{0,2}p[ \[]?\w{2,5}[er]{2,3}\w?(?=(?: (?:[12]?\d|30),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1সেপ্টেম্বর');
// word "maintenance" in its title.
ohc_regex(/(date *= *)O\w{0,2}t\w{1,3}[er]{2,3}\w?(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1অক্টোবর');
blacklist: null,
ohc_regex(/(date *= *)[MN]\w{1,2}[bv] ?\w{1,3}b[er]{1,2}\w?(?=(?: (?:[12]?\d|30),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1নভেম্বর');
ohc_regex(/(date *= *)D[ie]?[cs] ?\w{1,4}b[er]{1,2}\w?(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1ডিসেম্বর');


// Stuff changeable by users:
//insert comma to separate date from army unit
// Background for changed categories in multi-edit mode. Default is a very light salmon pink.
ohc_regex(/@FullMonth ((?:the |)\d\d*@th (?:Air(?:borne|)|Arm(?:ou?red|y)|Artillery|Battalion|Brigade|Co(?:mpan|)y|Division|Fleet|Group|Infantry|Land|Panzer|Regiment|Squadron|Sqn)\b)/g, "@Month, $1");
bg_changed: '#FCA',
// If true, HotCat will never automatically submit changes. HotCat will only open an edit page with
// the changes; users must always save explicitly.
no_autocommit: false,
// If true, the "category deletion" link "(-)" will never save automatically but always show an
// edit page where the user has to save the edit manually. Is false by default because that's the
// traditional behavior. This setting overrides no_autocommit for "(-)" links.
del_needs_diff: false,
// Time, in milliseconds, that HotCat waits after a keystroke before making a request to the
// server to get suggestions.
suggest_delay: 100,
// Default width, in characters, of the text input field.
editbox_width: 40,
// One of the engine_names above, to be used as the default suggestion engine.
suggestions: 'combined',
// If true, always use the default engine, and never display a selector.
fixed_search: false,
// If false, do not display the "up" and "down" links
use_up_down: true,
// Default list size
listSize: 10,
// If true, single category changes are marked as minor edits. If false, they're not.
single_minor: true,
// If true, never add a page to the user's watchlist. If false, pages get added to the watchlist if
// the user has the "Add pages I edit to my watchlist" or the "Add pages I create to my watchlist"
// options in his or her preferences set.
dont_add_to_watchlist: false,
shortcuts: null,
addShortcuts: function ( map ) {
if ( !map ) return;
window.HotCat.shortcuts = window.HotCat.shortcuts || {};
for ( var k in map ) {
if ( !map.hasOwnProperty( k ) || typeof k !== 'string' ) continue;


var v = map[ k ];
// remove parasitic metadata - time
if ( typeof v !== 'string' ) continue;
ohc_regex(/(\|\s*\w*date\s*=\s*@yyyy-@mm-@dd)\s?(?:T[0-2]\d:[0-5]\d:[0-5]\d(?:\s*|&nbsp;|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|Z))(?=\s*[|}])/g, "$1");
ohc_regex(/(\|\s*\w*date\s*=\s*@month @day,? @yyyy)\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|))(?=\|)/g, "$1");
ohc_regex(/(\|\s*\w*date\s*=\s*@day @month,? @yyyy)\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|))(?=\|)/g, "$1");
ohc_regex(/(\|\s*\w*date\s*=\s*\w[\w\s]+@month @day,? @yyyy)\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|))(?=\|)/g, "$1");
ohc_regex(/(\|\s*\w*date\s*=\s*\w[\w\s]+@day @month,? @yyyy)\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|))(?=\|)/g, "$1");
ohc_regex(/(\|\s*\w*date\s*=[^:|}]*)\s?(?:T?[0-2]\d:[0-5]\d:[0-5]\d(?:\s*|&nbsp;|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|Z))/g, "$1");


k = k.replace( /^\s+|\s+$/g, '' );
//  add back spaces or comma or remove other single artefact after date string
v = v.replace( /^\s+|\s+$/g, '' );
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:on |)@Day\s{,2}@Month\s{,2}@YYYY[^a-z{}]?(?=\s*[|}\n])/gi, "$1@Day @Month @YYYY$2");
if ( !k.length || !v.length ) continue;
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:on |)@Month\s{,2}@Day,?\s{,2}@YYYY[^a-z{}]?(?=\s*[|}\n])/gi, "$1@Month @Day, @YYYY$2");
//long-hand palliative for observed failure to insert spaces
ohc_regex(/(\|\s*(?:archive|access|air)-?date\s*=\s*)(?:on |)([0-2]?\d|30|31)\s*(জানুয়ারি|ফেব্রুয়ারি|মার্চ|এপ্রিল|মে|জুন|জুলাই|আগষ্ট|সেপ্টেম্বর|অক্টোবর|নভেম্বর|ডিসেম্বর)\s*((?:19\d|20[0-1])\d\s?)[^|{}\s<>]*(?=\s*[|}])/gi, "$1$2 $3 $4");
// ohc_regex(/(\|\s*(?:publication|)-?date\s*=\s*)(?:on |)@Day\s*@Month\s*@YYYY([a-z]\s?|\s?)\w*[^|{}<>]*(?=[|}])/gi, "$1@Day @Month @YYYY$2");
// ohc_regex(/(\|\s*(?:publication|)-?date\s*=\s*)(?:on |)@Month\s*@Day,\s*@YYYY([a-z]\s?|\s?)\w*[^|{}<>]*(?=[|}])/gi, "$1@Month @Day, @YYYY$2");


window.HotCat.shortcuts[ k ] = v;
//remove extraneous bracket //from Batty
}
ohc_regex(/{{(\s*[Cc]it(?:e|ation))([^}]+)(\s*\|\s*(?:archive-?|access-?|publication-?)?date\s*=\s*)([\w\s-]+)\](?=\s*[\|}<])/gi, '{{$1$2$3$4');
}
};


// More backwards compatibility. We have a few places where we test for the browser: once for
//fix bda template redirect
// Safari < 3.0, and twice for WebKit (Chrome or Safari, any versions)
// regex(/\{\{bda\|([^}]+)\}\}/gi, '{{birth date and age|$1}}');
var ua = navigator.userAgent.toLowerCase();
// regex(/\{\{dda\|([^}]+)\}\}/gi, '{{death date and age|$1}}');
var is_webkit = /applewebkit\/\d+/.test( ua ) && ua.indexOf( 'spoofer' ) < 0;
var cat_prefix = null;
var noSuggestions = false;


function LoadTrigger( needed ) {
//zap redundant {{date}}, {{accessdate}} {{retrieved}}, {{monthname}} and {{#dateformat}}
// Define methods in a closure so that self reference is available,
// regex(/({{(?:end|start)[-–]date)\|df=y(?:es|)/gi, "$1"); //rem deprecated parameter - disabled: doesn't work here, so ejected to the formatting script
// also allows method calls to be detached.
ohc_regex(/{{#formatdate:@YYYY-@MM-@DD(?:[^\}]*)}}/gi, "@Day @Month @YYYY");
var self = this;
regex(/{{#formatdate:([^}]+)}}/gi, "$1");
self.queue = [];
regex(/\{\{#dateformat:([^}\|]+)(?:\|dmy|\|mdy)?\}\}/gi, '$1');
self.needed = needed;
// ohc_regex(/(date[ ]*=[ ]*)\{\{(?:Start|End) ?date(?:\|df=y(?:es|)|)\|@YYYY\|@MM\|@DD(?:\|df=y(?:es|)|)\}\}/gi, '$1@Month @DD, @YYYY'); //stripping start/end template notes inside "|date=" parameter (line 72)
self.register = function ( callback ) {
ohc_regex(/{{#formatdate:@YYYY-@MM-@DD(?:\|(?:[dmy]{3}|iso)|)}}/gi, "@Day @Month @YYYY");
if ( self.needed <= 0 ) callback(); // Execute directly
ohc_regex(/\{\{date\|@YYYY-@MM-@DD\}\}/gi, "@Day @Month @YYYY");
else self.queue.push( callback );
ohc_regex(/\{\{date\|(@DD[\-\s]@Mon|@Mon[\-\s]@DD)\}\}/gi, "@Day @Month");
};
regex(/\{\{date\|([^}\|]+)(?:\|l?(?:[dmy]{3}|iso|none|link))?\}\}/gi, '$1');
self.loaded = function () {
ohc_regex(/[ ]*\{\{accessdate\|@YYYY-@MM-@DD[ ]*\}\}/gi, " Retrieved @YYYY-@MM-@DD");
self.needed--;
ohc_regex(/[ ]*\{\{retrieved[ ]*\|[ ]accessdate=([\-\w, ]*)\}\}/gi, " Retrieved $1");
if ( self.needed === 0 ) {
// ohc_regex(/(date[ ]*=[ ]*|\w{2,}[ ]*)\{\{(?:start|end).date[^|}]*(?:\|df=y(?:es|)|)\|@YYYY(?:\|df=y(?:es|)|)\}\}/gi, '$1@YYYY'); //stripping start/end template (disabling to placate Pigsonthewing)
// Run queued callbacks once
// ohc_regex(/\{\{(?:Start|End) date(?:\|df=y(?:es|)|)\|@YYYY\|@MM\}\}/gi, '@Month @YYYY')  //stripping start/end template notes
for ( var i = 0; i < self.queue.length; i++ ) self.queue[ i ]();
// ohc_regex(/<!--(?:Use)? \{\{(?:Start|End) date\|@YYYY\|@MM\|@DD\}\} -->/gi, ''); //stripping start/end template notes
self.queue = [];
ohc_regex(/(\{\{MONTHNAME\|@MM\}\})/gi, "@Month")
}
};
}


// Used to delay running the HotCat setup until /local_defaults and localizations have been loaded.
//expand one and two-digit years in ranges
var loadTrigger = new LoadTrigger( 2 );
regex(/(\()@Month @YYYY[-–]@Month @YYNN(\))/gi, '$1@Month1 @YYYY1 – @Month2 @YYYY2$2');
regex(/(\(1[789])(\d)(1)[-–]([2-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(1[789])(\d)(2)[-–]([3-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(1[789])(\d)(3)[-–]([4-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(1[789])(\d)(4)[-–]([5-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(1[789])(\d)(5)[-–]([6-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(1[789])(\d)(6)[-–]([7-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(1[789])(\d)(7)[-–]([8-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(1[789])(\d)(8)[-–](9\))/gi, '$1$2$3–$2$4');
regex(/(\(20)([01])(1)[-–]([2-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(20)([01])(2)[-–]([3-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(20)([01])(3)[-–]([4-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(20)([01])(4)[-–]([5-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(20)([01])(5)[-–]([6-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(20)([01])(6)[-–]([7-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(20)([01])(7)[-–]([8-9]\))/gi, '$1$2$3–$2$4');
regex(/(\(20)([01])(8)[-–](9\))/gi, '$1$2$3–$2$4');


function load( uri, callback ) {
ohc_regex(/(\W)@DD@th?, @DD@th?((?:[ ]|&nbsp;)(?:and|&|to|or)(?:[ ]|&nbsp;))@DD@th?(?:\sof\s?)?([ ]|&nbsp;)@Month(?=\W)/gi, '$1@Day1, @Day2$2@Day3$3@LMonth');
var s = document.createElement( 'script' );
ohc_regex(/(\W)@DD@th?((?:[ ]|&nbsp;)(?:and|&|to|or)(?:[ ]|&nbsp;))@DD@th?(?:\sof\s?|)([ ]|&nbsp;)@Month(?=\W)/gi, '$1@Day1$2@Day2$3@LMonth');
s.src = uri;
ohc_regex(/(\W)the @DD@th(?:\sof|)\s@Month,? @YYYY(?=\W\D)/g, '$1@Day @LMonth @YYYY');
var called = false;
ohc_regex(/(\W)the @DD@th(?:\sof|)\s@Month(?=\W\D)/g, '$1@Day @LMonth');
ohc_regex(/(\W)@Day@th?(?:\sof|)([ _]|&nbsp;|{{(?:break|nbsp)}})@Month(?=[^|\]\w])/gi, '$1@Day$2@LMonth');
ohc_regex(/(\W)@Month\s(?:the\s)?@DD@th?,(?:\sthe\s)?(?: |&nbsp;)@DD@th?(\s(?:and|&|to|or)(?:[ _]|&nbsp;))(?:the\s)?@DD@th?(?=[^|\]\w])/gi, '$1@LMonth @Day1, @Day2$2@Day3');
ohc_regex(/(\W)(@month)\s(@day)((?:,\s@day){0,6}),?(\/|\s?[-–]\s?|\s(?:and|&|to|or)\s+?)@Day@th?(?:,?(?:[ _]|&nbsp;)|\sof\s)?(\d{3,4}\W\D)/gi, '$1$2 $3$4$5@Day, $6');
ohc_regex(/(\W)(@month)\s(@day)((?:,\s@day){0,6}),?(\/|\s?[-–]\s?|\s(?:and|&|to|or)\s+?)@Day@th?(?=\W\D)/gi, '$1$2 $3$4$5@Day');
ohc_regex(/(\W)@Month([ _]|&nbsp;|{{(?:break|nbsp)}})(?:the\s)?@DD@th?,? @Year/gi, '$1@LMonth$2@Day, @Year');
ohc_regex(/(\W)@Month @Day(?:\sof|,|)([ _]|&nbsp;|{{(?:break|nbsp)}})@Year(?=[^|\]\w])/gi, '$1@Month @Day,$2@Year');


s.onload = s.onerror = function () {
// consolidating/amalgamating date fields
if ( !called && callback ) {
ohc_regex(/(\|[ ]*date[ ]*=[ ]*@day)\s*\|[ ]*month=[ ]*(@month)\s*\|[ ]*year=[ ]*(@yyyy[ ]*)(?=[|}\s])/gi, "$1 $2 $3");
called = true;
ohc_regex(/(\|[ ]*date[ ]*=[ ]*@day.?@month)\s*\|[ ]*year=[ ]*(@yyyy[ ]*)(?=[|}\s])/gi, "$1 $2");
callback();
ohc_regex(/(\|[ ]*date[ ]*=[ ]*@month.?@day)\s*\|[ ]*year=[ ]*(@yyyy[ ]*)(?=[|}\s])/gi, "$1 $2");
}
if ( s.parentNode ) {
s.parentNode.removeChild( s );
}
};
document.head.appendChild( s );
}


function loadJS( page, callback ) {
// eliminating dates and time placed in author parameter
load( conf.wgServer + conf.wgScript + '?title=' + encodeURIComponent( page ) + '&action=raw&ctype=text/javascript', callback );
//removing artefacts from Indian news sites (TNN আগষ্ট 30, 2012, 05.46AM)
}
ohc_regex(/(\|\s*author\s*=\s*(?:[A-Z]{2,3}\b))(?:[^|}]*)\d{4}, [\d\.:]{4,5}(&nbsp;|)[AP]M IST(?=[ ]*\|)/g, '$1$2');
// ohc_regex(/(\|\s*author=(?:[^\[\]|{}]*))(TNN|PTI) @day @month @yyyy, [\d\.:]{4,5}(&nbsp;|)[AP]M IST(?=[ ]*\|)/g, '$1$2');


function loadURI( href, callback ) {
ohc_regex(/(\|\s*author\s*=\s*)@month @day,? @yyyy\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|)|)(?=\|)/g, "$1");
var url = href;
ohc_regex(/(\|\s*author\s*=\s*)@day @month,? @yyyy\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|)|)(?=\|)/g, "$1");
if ( url.substring( 0, 2 ) === '//' ) url = window.location.protocol + url; else if ( url.substring( 0, 1 ) === '/' ) url = conf.wgServer + url;
ohc_regex(/(\|\s*author\s*=\s*\w[\w\s]+)@month @day,? @yyyy(?:[^\[\]|{}]*)(?=[|}])/g, "$1");
ohc_regex(/(\|\s*author\s*=\s*\w[\w\s]+)@day @month,? @yyyy(?:[^\[\]|{}]*)(?=[|}])/g, "$1");
ohc_regex(/(\|\s*author\s*=\s*(?:\w[\w\s]+)?)@dd-@mm-@yyyy/gi, "$1");
ohc_regex(/(\|\s*author\s*=\s*(?:\w[\w\s]+)?)@YYYY-@MM-@DD ?/gi, "$1");
regex(/(\|\s*(?:date|archive-?date|access-?date|author)\s*=\s*(?:\w[\w\s]+)?)[0-2]\d:[0-5]\d(?:[ ]|&nbsp;)?(?:[ap]m|[ap]\.m\.|)(?: ?(?:[A-Z]{1,2}T|UTC)[\.,]?|)/gi, "$1");
// ohc_regex(/(\|\s*author\s*=\s*(?:\w[\w\s]+)?)\s*[0-2]\d[\.:][0-5]\d(?:[\.:][0-5]\d|)/gi, "$1"); //let's see later if we need this


load( url, callback );
// eliminating mm-dd-yyyy dates
}
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@MM[-–\/\.=\s](1[3-9]|2\d|3[01])[-–\/\.=\s]@YYYY/gi, "$1@Month $2, @YYYY");
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Mon[-–\/\.=\s](1[3-9]|2\d|3[01])[-–\/\.=\s]@YYYY/gi, "$1@Month $2, @YYYY");
ohc_regex(/[ ](?:Accessed|Retrieved)(?:(?: online|) on|:?)[ ]@MM[-–\/\.=\s](1[3-9]|2\d|3[01])[-–\/\.=\s]@YYYY(?=\D)/gi, " Retrieved @Month $1, @YYYY");
// ohc_regex(/[ ](?:Accessed|Retrieved)(?:(?: online|) on|:?)[ ]@YYYY,? @Month @DD(?=\D)/gi, " Retrieved @Day @Month @YYYY");


// Load local configurations, overriding the pre-set default values in the HotCat object above. This is always loaded
ohc_regex(/([ =|])@Mon[-–](1[3-9]|2\d|3[01])[-–]@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY");
// from the wiki where this script is executing, even if this script itself is hotlinked from Commons. This can
ohc_regex(/([ =|])@Mon\/(1[3-9]|2\d|3[01])\/@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY");
// be used to change the default settings, or to provide localized interface texts for edit summaries and so on.
ohc_regex(/([ =|])@Mon\.(1[3-9]|2\d|3[01])\.@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY");
loadJS( 'MediaWiki:Gadget-HotCat.js/local_defaults', loadTrigger.loaded );
ohc_regex(/([ =|])@Mon (1[3-9]|2\d|3[01]) @YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY");
ohc_regex(/([ =|])@MM[-–](1[3-9]|2\d|3[01])[-–]@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY");
ohc_regex(/([ =|])@MM\/(1[3-9]|2\d|3[01])\/@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY");
ohc_regex(/([ =|])@MM\.(1[3-9]|2\d|3[01])\.@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY");
ohc_regex(/([ =|])@MM (1[3-9]|2\d|3[01]) @YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY");  


// Load localized UI texts. These are the texts that HotCat displays on the page itself. Texts shown in edit summaries
// eliminating dd-mm-yyyy dates (assumed default)
// should be localized in /local_defaults above.
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@DD[-–\/\.=\s]@MM[-–\/\.=\s]@YYYY/gi, "$1@Day @Month @YYYY");
if ( conf.wgUserLanguage !== 'en' ) {
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@DD[-–\/\.=\s]@Mon[-–\/\.=\s]@YYYY/gi, "$1@Day @Month @YYYY");
// Lupo: somebody thought it would be a good idea to add this. So the default is true, and you have to set it to false
ohc_regex(/[ ](?:Accessed|Retrieved)(?:(?: online|) on|:?)[ ]@DD[-–\/\.=\s]@MM[-–\/\.=\s]@YYYY(?=\D)/gi, " Retrieved @Day @Month @YYYY");
// explicitly if you're not on Commons and don't want that.
ohc_regex(/[ ](?:Accessed|Retrieved)(?:(?: online|) on|:?)[ ]@YYYY,? @Month @DD(?=\D)/gi, " Retrieved @Day @Month @YYYY");
if ( window.hotcat_translations_from_commons === undefined ) window.hotcat_translations_from_commons = true;
ohc_regex(/([ =|])@DD[-–]@Mon[-–]@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY");
ohc_regex(/([ =|])@DD\/@Mon\/@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY");
ohc_regex(/([ =|])@DD\.@Mon\.@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY");
ohc_regex(/([ =|])@DD @Mon @YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY");
ohc_regex(/([ =|])@DD[-–]@MM[-–]@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY");
ohc_regex(/([ =|])@DD\/@MM\/@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY");
ohc_regex(/([ =|])@DD\.@MM\.@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY");
ohc_regex(/([ =|])@DD @MM @YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY");
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@DD[-–\/\.=\s]@Month[-–\/\.=\s]@YYNN(?=\s*[|}\n])/gi, '$1@Day @Month @YYYY');


// Localization hook to localize HotCat messages, tooltips, and engine names for wgUserLanguage.
//convert yyyy-dd-mm to yyyy-mm-dd
if ( window.hotcat_translations_from_commons && conf.wgServer.indexOf( '//commons' ) < 0 ) {
ohc_regex(/{{(\s*[Cc]it(?:e|ation))([^}]+)(\s*\|\s*(?:publication|archive|access|air|)-?date\s*=\s*(?:1[0-9]|20)\d{2})[-/\.=\s](1[3-9]|2\d|3[01])[-/\.=\s](0?\d|1[0-2])(\s*[\|}<])/gi, '{{$1$2$3-$5-$4$6'); //from Batty
loadURI( '//commons.wikimedia.org/w/index.php?title=' +
'MediaWiki:Gadget-HotCat.js/' + conf.wgUserLanguage +
'&action=raw&ctype=text/javascript', loadTrigger.loaded );
} else {
// Load translations locally
loadJS( 'MediaWiki:Gadget-HotCat.js/' + conf.wgUserLanguage, loadTrigger.loaded );
}
} else {
loadTrigger.loaded();
}


// No further changes should be necessary here.
// eliminating other errant formats
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)([0-2]?\d|30|31) @Month \2,? @YYYY(?=\s*[|}])/gi, "$1$2 @Month @YYYY"); //repeated digits
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Day ?@Month ?200([01]\d)[^\s|}]?(?=\s*[|}])/gi, "$1@Day @Month 20$2");
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month ?@Day,? ?200([01]\d)[^\s|}]?(?=\s*[|}])/gi, "$1@Month @Day, 20$2");


// The following regular expression strings are used when searching for categories in wikitext.
ohc_regex(/([ ]\()@DD-@MM-@YYYY(\)\W)/gi, '$1@Day @Month @YYYY$2');
var wikiTextBlank = '[\\t _\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]+';
ohc_regex(/([ ]\()@DD-@Month-@YYYY(\)\W)/gi, '$1@Day @Month @YYYY$2');
var wikiTextBlankRE = new RegExp( wikiTextBlank, 'g' );
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@Month, @DD, @YYYY(?=\s*[|}])/gi, "$1@Day @Month @YYYY");
// Regexp for handling blanks inside a category title or namespace name.
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@DD[\.,] @Month,? @YYYY(?=\s*[|}])/gi, "$1@Day @Month @YYYY");
// See http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/Title.php?revision=104051&view=markup#l2722
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@YYYY,? @Month @DD(?=\s*[|}])/gi, "$1@Day @Month @YYYY");
// See also http://www.fileformat.info/info/unicode/category/Zs/list.htm
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@YYYY,? @DD @Month(?=\s*[|}])/gi, "$1@Day @Month @YYYY");
//  MediaWiki collapses several contiguous blanks inside a page title to one single blank. It also replace a
ohc_regex(/[ ]\(@YYYY,? @Month @DD\)/gi, " (@Day @Month @YYYY)");
// number of special whitespace characters by simple blanks. And finally, blanks are treated as underscores.
ohc_regex(/[ ]\(@YYYY @MM @DD\)/gi, " (@Day @Month @YYYY)");
// Therefore, when looking for page titles in wikitext, we must handle all these cases.
ohc_regex(/[ ]\(@YYYY, @DD @Month\)/gi, " (@Day @Month @YYYY)");
//  Note: we _do_ include the horizontal tab in the above list, even though the MediaWiki software for some reason
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@YYYY,? @Month(?=\s*[|}])/gi, "$1@Month @YYYY");
// appears to not handle it. The zero-width space \u200B is _not_ handled as a space inside titles by MW.
ohc_regex(/[ ]\(@YYYY, @Month\)/gi, " (@Month @YYYY)");
var wikiTextBlankOrBidi = '[\\t _\\xA0\\u1680\\u180E\\u2000-\\u200B\\u200E\\u200F\\u2028-\\u202F\\u205F\\u3000]*';
ohc_regex(/[ ]\(@Mon@YYYY\)/gi, " (@Mon @YYYY)");
// Whitespace regexp for handling whitespace between link components. Including the horizontal tab, but not \n\r\f\v:
// a link must be on one single line.
//   MediaWiki also removes Unicode bidi override characters in page titles (and namespace names) completely.
// This is *not* handled, as it would require us to allow any of [\u200E\u200F\u202A-\u202E] between any two
// characters inside a category link. It _could_ be done though... We _do_ handle strange spaces, including the
// zero-width space \u200B, and bidi overrides between the components of a category link (adjacent to the colon,
// or adjacent to and inside of "[[" and "]]").


// First auto-localize the regexps for the category and the template namespaces.
//CS1 errors ISO-like dates (too few or too many digits)
var formattedNamespaces = conf.wgFormattedNamespaces;
ohc_regex(/(date\s*=\s*)(?:\[\[)?@YYYY(?:\]\][–—‐]\[\[|[–—‐])@MM[\-–—‐]@DD(?:\]\])?(?=\s*[|}])/gi, "$1@YYYY-@ZM-@ZD"); //ndashes and emdashes
var namespaceIds = conf.wgNamespaceIds;
ohc_regex(/(\|\s*access-?date\s*=)\s*@YYYY-0[–—]@DD(?=\s*[|}])/gi, ""); //rem nonsense access date
function autoLocalize( namespaceNumber, fallback ) {
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@YYYY[-–—]@MM[-–—]@DD(?=\s*[|}])/gi, "$1@YYYY-@ZM-@ZD"); //ndashes and emdashes
function createRegexpStr( name ) {
// ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@YYYY[\-–—‐]@MM(?=\s*[|}])/gi, "$1@Month @YYYY"); //transform "yyyy-mm" to "month year"
if ( !name || !name.length ) return '';
ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[–—]@MM[–—]@DD([^-\w\/%,<][^<]*?<\/ref>)/gi, "$1$2@Day @Month @YYYY$3");
ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-]@MM[-]([1-9])([^-\w\/%,<][^<]*?<\/ref>)/gi, "$1$2$3 @Month @YYYY$4");


var regex_name = '';
// spaces and commas between month and year
for ( var i = 0; i < name.length; i++ ) {
ohc_regex(/@Month(?:,?|\s+of|)(\s|&nbsp;)@YYYY(?=\D)/gi, "@LMonth$1@YYYY");
var initial = name.charAt( i ),
ll = initial.toLowerCase(),
ul = initial.toUpperCase();
if ( ll === ul ) regex_name += initial; else regex_name += '[' + ll + ul + ']';
}
return regex_name
.replace( /([\\^$.?*+()])/g, '\\$1' )
.replace( wikiTextBlankRE, wikiTextBlank );
}


fallback = fallback.toLowerCase();
// fix month names (capitalize, remove dots)
var canonical = formattedNamespaces[ String( namespaceNumber ) ].toLowerCase();
ohc_regex(/(\W)@DD\s@FullMonth(\s+|\s*,)/gi, "$1@Day @FullMonth$2");
var regexp = createRegexpStr( canonical );
ohc_regex(/(\W)@DD\s@Mon(\s+|\s*,)/gi, "$1@Day @Mon$2");
if ( fallback && canonical !== fallback ) regexp += '|' + createRegexpStr( fallback );
ohc_regex(/(\W)@FullMonth\s@DD(\s+|\s*,)/gi, "$1@FullMonth @Day$2");
ohc_regex(/(\W)@Mon\s@DD(\s+|\s*,)/gi, "$1@Mon @Day$2");
regex(/(\d(?:st|nd|rd|th) )C(entur(?:ies|y))(?=[ ]*(=|BC|AD|CE))/g, '$1c$2');
// regex(/(\d(?:st|nd|rd|th) )C(entur(?:ies|y))(?![ \-][A-Z]\w*|''|")/g, '$1c$2');


if ( namespaceIds ) {
//spaces and commas - in date formats
for ( var cat_name in namespaceIds ) {
ohc_regex(/(\D\W\[?\[?@dd)[ ]+(@month)(\]\])?[ ]*,[ ]*(\[?\[?@yyyy(\sAD|\sBC|\sCE|\sBCE|)\]?\]?\W\D)/gi, "$1 $2$3 $4");
if (
ohc_regex(/(\D\W\[?\[?)(@month)[ ]+(@dd)(\]?\]?)(?:[ ]*,[ ]*)(\[?\[?@yyyy(\sAD|\sBC|\sCE|\sBCE|)\]?\]?\W\D)/gi, "$1$2 $3$4, $5");
typeof cat_name === 'string' &&
ohc_regex(/(\D\W\[?\[?)(@month)[ ]+(@dd)(\]?\]?)[ ]+(\[?\[?@yyyy(\sAD|\sBC|\sCE|\sBCE|)\]?\]?\W\D)/gi, "$1$2 $3$4, $5");
cat_name.toLowerCase() !== canonical &&
cat_name.toLowerCase() !== fallback &&
namespaceIds[ cat_name ] === namespaceNumber
) {
regexp += '|' + createRegexpStr( cat_name );
}
}
}
return regexp;
}


HC.category_canonical = formattedNamespaces[ '14' ];
ohc_regex(/(@month)(?:, | of )(@yyyy\w)/gi, "$1 $2"); //repeat after delinking
HC.category_regexp = autoLocalize( 14, 'category' );
if ( formattedNamespaces[ '10' ] ) HC.template_regexp = autoLocalize( 10, 'template' );


// Utility functions. Yes, this duplicates some functionality that also exists in other places, but
// spaces and commas - md-md and dm-dm date ranges
// to keep this whole stuff in a single file not depending on any other on-wiki JavaScripts, we re-do
ohc_regex(/(\D\W)@Month\s@DD(&nbsp;|\s)(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?@Month\s@DD(?=\W\D)/gi, "$1@LMonth1 @Day1$2– @LMonth2 @Day2");
// these few operations here.
ohc_regex(/(\D\W)@Month\s@DD(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?@Month\s@DD(?=\W\D)/gi, "$1@LMonth1 @Day1 – @LMonth2 @Day2");
function make( arg, literal ) {
ohc_regex(/(\D\W)@DD\s@Month(&nbsp;|\s)(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?@DD\s@Month(?=\W\D)/gi, "$1@Day1 @LMonth1$2– @Day2 @LMonth2");
if ( !arg ) return null;
ohc_regex(/(\D\W)@DD\s@Month(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?@DD\s@Month(?=\W\D)/gi, "$1@Day1 @LMonth1 – @Day2 @LMonth2");


return literal ? document.createTextNode( arg ) : document.createElement( arg );
// spaces and commas - d-dm and md-d date ranges
}
ohc_regex(/(\D\W)@Month(\s|&nbsp;)@DD@th?(?:(?:\s*|&nbsp;|)[-–](?:\s*|&nbsp;|))@DD@th?(?=\W\D)/gi, "$1@LMonth1$2@Day1–@Day2");
function param( name, uri ) {
ohc_regex(/(\D\W)@DD@th?(?:(?:\s*|&nbsp;|)[-–](?:\s*|&nbsp;|))@DD@th?(\s|&nbsp;)@Month(?=\W\D)/gi, "$1@Day1–@Day2$2@LMonth1");
uri = uri || document.location.href;
var re = new RegExp( '[&?]' + name + '=([^&#]*)' );
var m = re.exec( uri );
if ( m && m.length > 1 ) return decodeURIComponent( m[ 1 ] );
return null;
}
function title( href ) {
if ( !href ) return null;


var script = conf.wgScript + '?';
// spaces and commas between month and year (again)
if ( href.indexOf( script ) === 0 || href.indexOf( conf.wgServer + script ) === 0 || conf.wgServer.substring( 0, 2 ) === '//' && href.indexOf( document.location.protocol + conf.wgServer + script ) === 0 ) {
ohc_regex(/@Month(?:,\s+|\s+of\s+)@YYYY(\w)/gi, "@LMonth @YYYY$1");
// href="/w/index.php?title=..."
}
return param( 'title', href );
} else {
// href="/wiki/..."
var prefix = conf.wgArticlePath.replace( '$1', '' );
if ( href.indexOf( prefix ) ) prefix = conf.wgServer + prefix; // Fully expanded URL?


if ( href.indexOf( prefix ) && prefix.substring( 0, 2 ) === '//' ) prefix = document.location.protocol + prefix; // Protocol-relative wgServer?
/** ------------------------------------------------------------------------- */
/// ISO to long format


if ( href.indexOf( prefix ) === 0 ) return decodeURIComponent( href.substring( prefix.length ) );
function ohc_ISO_to_dmy_in_citations()
}
{
return null;
//ISO dates within single citation
}
ohc_regex(/(\|\s*(?:publication|archive|access|air|designation\d?_|)-?date\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Day @Month @YYYY");
function hasClass( elem, name ) {
}
return ( ' ' + elem.className + ' ' ).indexOf( ' ' + name + ' ' ) >= 0;
}
function capitalize( str ) {
if ( !str || !str.length ) return str;


return str.substr( 0, 1 ).toUpperCase() + str.substr( 1 );
function ohc_ISO_to_mdy_in_citations()
}
{
function wikiPagePath( pageName ) {
//ISO dates within single citation
// Note: do not simply use encodeURI, it doesn't encode '&', which might break if wgArticlePath actually has the $1 in
ohc_regex(/(\|\s*(?:publication|archive|access|air|designation\d?_|)-?date\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Month @Day, @YYYY");
// a query parameter.
}
return conf.wgArticlePath.replace( '$1', encodeURIComponent( pageName ).replace( /%3A/g, ':' ).replace( /%2F/g, '/' ) );
}
function escapeRE( str ) {
return str.replace( /([\\^$.?*+()[\]])/g, '\\$1' );
}


function substituteFactory( options ) {
function ohc_ISO_to_dmy_in_references()
options = options || {};
{
var lead = options.indicator || '$';
//multiple calls for multiple dates within single citation
var indicator = escapeRE( lead );
ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD([^-\w\/%,<][^<]*?<\/ref>)/gi, "$1$2@Day @Month @YYYY$3");
var lbrace = escapeRE( options.lbrace || '{' );
ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD(<\/ref>)/gi, "$1$2@Day @Month @YYYY$3");
var rbrace = escapeRE( options.rbrace || '}' );
}
var re;


re = new RegExp(
function ohc_ISO_to_mdy_in_references()
// $$
{
'(?:' + indicator + '(' + indicator + '))|' +
//multiple calls for multiple dates within single citation
// $0, $1
ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD([^-\w\/%,<][^<]*?<\/ref>)/gi, "$1$2@Month @Day, @YYYY$3");
'(?:' + indicator + '(\\d+))|' +
ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD(<\/ref>)/gi, "$1$2@Month @Day, @YYYY$3");
// ${key}
}
'(?:' + indicator + '(?:' + lbrace + '([^' + lbrace + rbrace + ']+)' + rbrace + '))|' +
// $key (only if first char after $ is not $, digit, or { )
'(?:' + indicator + '(?!(?:[' + indicator + lbrace + ']|\\d))(\\S+?)\\b)',
'g'
);
// Replace $1, $2, or ${key1}, ${key2}, or $key1, $key2 by values from map. $$ is replaced by a single $.
return function ( str, map ) {
if ( !map ) return str;


return str.replace( re, function ( match, prefix, idx, key, alpha ) {
// currently unused
if ( prefix === lead ) return lead;
function ohc_ISO_to_dmy_anywhere()
{
//multiple calls for multiple dates within single citation
ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Day @Month @YYYY$2');
ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Day @Month @YYYY$2');
ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Day @Month @YYYY$2');
}


var k = alpha || key || idx;
// currently unused
var replacement = typeof map[ k ] === 'function' ? map[ k ]( match, k ) : map[ k ];
function ohc_ISO_to_mdy_anywhere()
return typeof replacement === 'string' ? replacement : ( replacement || match );
{
} );
//multiple calls for multiple dates within single citation
};
ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Month @Day, @YYYY$2');
}
ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Month @Day, @YYYY$2');
ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Month @Day, @YYYY$2');
}


var substitute = substituteFactory();
function ohc_delink_ISO_to_dmy()
var replaceShortcuts = ( function () {
{
var replaceHash = substituteFactory( {
ohc_ISO_to_dmy_in_citations();
indicator: '#',
ohc_ISO_to_dmy_in_references();
lbrace: '[',
regex(/([^\w\/\-%,])@YYYY-@MM-@DD(<\s?\/ref.*?>)/g, '$1@Day @Month @Year$2');
rbrace: ']'
ohc_regex(/(\|\|[ ]*)@YYYY[-–]@MM[-–]@DD([ ]*\|\|)/gi, '$1{{dts|format=dmy|@YYYY|@MM|@DD}}$2'); //dts template for sortable tables
} );
ohc_regex(/(\{\{dts\|format=)mdy\|/gi, '$1dmy|'); //flip dts template formats
return function ( str, map ) {
}
var s = replaceHash( str, map );
return HC.capitalizePageNames ? capitalize( s ) : s;
};
}() );


// Text modification
function ohc_delink_ISO_to_mdy()
{
ohc_ISO_to_mdy_in_citations();
ohc_ISO_to_mdy_in_references();
regex(/([^\w\/\-%,])@YYYY-@MM-@DD(<\s?\/ref.*?>)/g, '$1@Month @Day, @Year$2');
ohc_regex(/(\|\|[ ]*)@YYYY[-–]@MM[-–]@DD([ ]*\|\|)/gi, '$1{{dts|@YYYY|@MM|@DD}}$2');  //dts template for sortable tables (mdy is default)
ohc_regex(/(\{\{dts\|)format=(?:mdy|dmy|) ?\|/gi, '$1');  //flip dts template formats
}


var findCatsRE =
function ohc_delink_year_in_X()
new RegExp( '\\[\\[' + wikiTextBlankOrBidi + '(?:' + HC.category_regexp + ')' + wikiTextBlankOrBidi + ':[^\\]]+\\]\\]', 'g' );
{
// ohc_regex(/\{\{(?:avyear|by|baseball\syear|fy|ly|mlby|mlb\syear|scy|sdy)\|(@year)\}\}/gi, "$1"); //disabled 3/5/21 discussion at https://en.wikipedia.org/w/index.php?title=Wikipedia_talk:WikiProject_Baseball&oldid=1021203365#Links_to_baseball_year_articles_in_infobox?
// ohc_regex(/\{\{(?:avyear|by|baseball\syear|fy|ly|mlby|mlb\syear|scy|sdy)\|@year\|(@year)\}\}/gi, "$1");
ohc_regex(/\[\[@yyyy\sin\s[^|\]]+\|((?:(?:@day |)@month |)@yyyy)\]\]/gi, '$1');
regex(/\[\[(?:\d{4}[-–]\d{2} in English football)\|((?:(?:@Day |)@Month |)@YYYY)\]\]/gi, '$1');  


function replaceByBlanks( match ) {
regex(/\[\[\d{4} Major League Baseball season\|(\d{4})(\sseason)?\]\]/gi, '$1$2');
return match.replace( /(\s|\S)/g, ' ' ); // /./ doesn't match linebreaks. /(\s|\S)/ does.
}
}


function find_category( wikitext, category, once ) {
var cat_regex = null;
if ( HC.template_categories[ category ] ) {
cat_regex = new RegExp(
'\\{\\{' + wikiTextBlankOrBidi + '(' + HC.template_regexp + '(?=' + wikiTextBlankOrBidi + ':))?' + wikiTextBlankOrBidi +
'(?:' + HC.template_categories[ category ] + ')' +
wikiTextBlankOrBidi + '(\\|.*?)?\\}\\}',
'g'
);
} else {
var cat_name = escapeRE( category );
var initial = cat_name.substr( 0, 1 );
cat_regex = new RegExp(
'\\[\\[' + wikiTextBlankOrBidi + '(' + HC.category_regexp + ')' + wikiTextBlankOrBidi + ':' + wikiTextBlankOrBidi +
( initial === '\\' || !HC.capitalizePageNames ?
initial :
'[' + initial.toUpperCase() + initial.toLowerCase() + ']' ) +
cat_name.substring( 1 ).replace( wikiTextBlankRE, wikiTextBlank ) +
wikiTextBlankOrBidi + '(\\|.*?)?\\]\\]',
'g'
);
}
if ( once ) return cat_regex.exec( wikitext );


var copiedtext = wikitext
// format parameter must be 'dmy' or 'mdy'
.replace( /<!--(\s|\S)*?-->/g, replaceByBlanks )
function ohc_fix_dts_template(format)
.replace( /<nowiki>(\s|\S)*?<\/nowiki>/g, replaceByBlanks );
{
var result = [];
// dts - format=dmy in this case (per D12000)
var curr_match = null;
// per {{dts}} doc, remove the obsolete link=off param
while ( ( curr_match = cat_regex.exec( copiedtext ) ) !== null ) {
regex(/(\{\{dts[^}]*)(?:\|link=off)/gi, '$1');
result.push( {
ohc_regex(/(\{\{dts\s*\|\s*@year\s*\|\s*@month\s*\|\s*@day\s*\|\s*format=)(?:dmy|mdy)(\}\})/gi, '$1'+format+'$2');
match: curr_match
ohc_regex(/(\{\{dts\s*\|\s*format=)(?:dmy|mdy)(\s*\|\s*@year\s*\|\s*@month\s*\|\s*@day\s*\}\})/gi, '$1'+format+'$2');
} );
ohc_regex(/(\{\{dts\s*\|\s*@year\s*\|\s*@month\s*\|\s*@day\s*)(\}\})/gi, '$1|format='+format+'$2');
}
result.re = cat_regex;
return result; // An array containing all matches, with positions, in result[ i ].match
}


var interlanguageRE = null;
  // stripping – {{dts}} serves no purpose inside date parameters
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)\{\{dts\s*\|\s*format=(?:dmy|mdy)\s*\|\s*([|}]*)\}\}(?=\s*[|}])/gi, "$1$2");
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)\{\{dts\s*\|\s*([|}]*)(?:\|\s*format=(?:dmy|mdy)\s*|)\}\}(?=\s*[|}])/gi, "$1$2");
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)\{\{dts\s*\|\s*format=(?:dmy|mdy)\s*\|\s*@YYYY(\s*\|\s*|-)@MM(\s*\|\s*|-)@DD\s*\}\}(?=\s*[|}])/gi, "$1@YYYY-@MM-@DD ");
ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)\{\{dts\s*\|\s*@YYYY(\s*\|\s*|-)@MM(\s*\|\s*|-)@DD\s*\|\s*format=(?:dmy|mdy)\s*\}\}(?=\s*[|}])/gi, "$1@YYYY-@MM-@DD ");
}


function change_category( wikitext, toRemove, toAdd, key, is_hidden ) {
// format parameter must be 'dmy' or 'mdy'
function ohc_fix_gr_template(format)
{
// GR - date formatting parameter
// per {GR} doc, insert date formatting param
regex(/(\{\{GR\|\d\d?)(?!\|date)/gi, '$1|dateform=' + format);
}


function find_insertionpoint( wikitext ) {
function ohc_dates_to_dmy()
var copiedtext = wikitext
{
.replace( /<!--(\s|\S)*?-->/g, replaceByBlanks )
regex(/\|df=[mdy]{3}(?:-all|)(?=\s*[|}])/gi, '');
.replace( /<nowiki>(\s|\S)*?<\/nowiki>/g, replaceByBlanks );
regex(/\|format=mdy/gi, '|format=dmy');
// Search in copiedtext to avoid that we insert inside an HTML comment or a nowiki "element".
//change start and end templates; vgrelease new v=2 or mdy is default
var index = -1;
regex(/(\{\{(?:start date|end date)[^|}]*\|)df=ye?s?\|([^}]*df=ye?s?)/gi, '$1$2');
findCatsRE.lastIndex = 0;
regex(/(\{\{vgrelease new[^|}]*\|)(?:v=1\||)([A-Z]{2,3}\|)/g, '$1v=2|$2');
while ( findCatsRE.exec( copiedtext ) !== null ) index = findCatsRE.lastIndex;
ohc_regex(/(\|\s*(?:begin|end|first|last)\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Day @Month @YYYY"); //spotted at [[Template:Infobox recurring event]]
//change birth and death templates
regex(/(\{\{(?:(?:Birth|Death) date(?: and age|)|launch|release|start)[^}]*\|)m(f=ye?s?)/gi, '$1d$2'); // substitute df for mf
regex(/(\{\{(?:(?:Birth|Death) date(?: and age|)|launch|release|start|film ?date|Wayback)[\|\d]+)(\}\})/gi, '$1|df=y$2'); //insert df parameter
regex(/(\{\{(?:(?:Birth|Death) date(?: and age|)|launch|release|start|film ?date|Wayback)[\|\d]+\|)df=ye?s?\|([^}]*df=ye?s?)/gi, '$1$2'); //put date format parameter at the end
regex(/(\{\{(?:start date|end date)\|)df=ye?s?\|((?:1[789]|20)\d{2}\}\})/gi, '$1$2'); //date format parameter not needed – year only


if ( index < 0 ) {
//convert date ranges (md,d,d-dy to d,d,d-dmy; md,d,d-d to d,d,d-dm; md,d,d to d,d,dm)
// Find the index of the first interlanguage link...
ohc_regex(/(\D\W)@Month((?:\s@day?,?){1,6}),?(\/|\s?(?:[-]|&ndash;)\s?|(?:[ _]|&nbsp;)(?:and|&|to|or)(?:[ _]|&nbsp;)+?)@Day,?\s(?:of\s)?(@yyyy\W\D)/gi, "$1$2$3@Day @LMonth $4");
var match = null;
ohc_regex(/(\D\W)@Month((?:\s@day?,?){1,6}),?(\/|\s?(?:[-–]|&ndash;)\s?|(?:[ _]|&nbsp;)(?:and|&|to|or)(?:[ _]|&nbsp;)+?)@Day(?=\W\D)/gi, "$1$2$3@Day @LMonth");
if ( !interlanguageRE ) {
// Approximation without API: interlanguage links start with 2 to 3 lower case letters, optionally followed by
// a sequence of groups consisting of a dash followed by one or more lower case letters. Exceptions are "simple"
// and "tokipona".
match = /((^|\n\r?)(\[\[\s*(([a-z]{2,3}(-[a-z]+)*)|simple|tokipona)\s*:[^\]]+\]\]\s*))+$/.exec( copiedtext );
} else {
match = interlanguageRE.exec( copiedtext );
}
if ( match ) index = match.index;


return {
// ohc_regex(/(\D\W)@Month((?:\s@day?,?){1,6}) @Day(?=\W\D)/gi, "$1$2 @Day @LMonth"); //disabling as unlikely and ungrammatical constructions causing false positives
idx: index,
onCat: false
};
}
return {
idx: index,
onCat: index >= 0
};
}


var summary = [],
//'md, md,' to 'dm, dm,'
nameSpace = HC.category_canonical,
ohc_regex(/(\D\W)@Month @Day, @Month @Day(?=[,\.]\W\D)/gi, "$1@Day1 @LMonth1, @Day2 @LMonth2");
cat_point = -1, // Position of removed category;
keyChange = ( toRemove && toAdd && toRemove === toAdd && toAdd.length ),
matches;
if ( key ) key = '|' + key;
// Remove
if ( toRemove && toRemove.length ) {
matches = find_category( wikitext, toRemove );
if ( !matches || !matches.length ) {
return {
text: wikitext,
summary: summary,
error: HC.messages.cat_notFound.replace( /\$1/g, toRemove )
};
} else {
var before = wikitext.substring( 0, matches[ 0 ].match.index ),
after = wikitext.substring( matches[ 0 ].match.index + matches[ 0 ].match[ 0 ].length );
if ( matches.length > 1 ) {
// Remove all occurrences in after
matches.re.lastIndex = 0;
after = after.replace( matches.re, '' );
}
if ( toAdd ) {
// nameSpace = matches[ 0 ].match[ 1 ] || nameSpace; Canonical namespace should be always preferred
if ( key === null ) key = matches[ 0 ].match[ 2 ];
// Remember the category key, if any.
}
// Remove whitespace (properly): strip whitespace, but only up to the next line feed.
// If we then have two linefeeds in a row, remove one. Otherwise, if we have two non-
// whitespace characters, insert a blank.
var i = before.length - 1;
while ( i >= 0 && before.charAt( i ) !== '\n' && before.substr( i, 1 ).search( /\s/ ) >= 0 ) i--;


var j = 0;
//convert simple mdy dates to dmy
while ( j < after.length && after.charAt( j ) !== '\n' && after.substr( j, 1 ).search( /\s/ ) >= 0 ) j++;
ohc_regex(/(p(?:g?\.?|age) ?\d+|p(?:p\.?|ages) ?\d+[-–]\d+), @Month((?:\s@day?,?){1,6}) @Day(?=\W\D)/gi, "$1. $2 @Day @LMonth");
ohc_regex(/(\D\W)@Month\s@Day,?\s@Year(\s?(?:AD|BC|CE|BCE)\W\D)/gi, "$1@Day @LMonth @Year$2");
ohc_regex(/(\|\s*term_(?:end|start)\d\s*=\s*|\D\W)@Month\s@Day,?\s@YYYY(?=\W\D)/gi, "$1@Day @LMonth @Year");
ohc_regex(/(\|\s*term_(?:end|start)\d\s*=\s*|\D\W)@Month\s@Day(?=\W\D)/gi, "$1@Day @LMonth");


if ( i >= 0 && before.charAt( i ) === '\n' && ( !after.length || j < after.length && after.charAt( j ) === '\n' ) ) i--;
//Month+day_number " 7th মার্চ" -> "7 মার্চ"
ohc_regex(/(\D\W)@Day\s@Month\s@YYYY(?=\W\D)/gi, "$1@Day @LMonth @Year");
ohc_regex(/(\D\W)@Day\s@Month(?=\W\D)/gi, "$1@Day @LMonth");
ohc_regex(/(\D\W)@Month\s@Day,?\s@Year(?=\W\D)/gi, "$1@Day @LMonth @Year");


if ( i >= 0 ) before = before.substring( 0, i + 1 ); else before = '';
//dates with embedded nbsp
ohc_regex(/(\D\W)@Month([ _]|&nbsp;)(\d{1,2},(?: |&nbsp;)\d{1,2}(?:\s(?:and|&|to|or)(?:[ _]|&nbsp;))\d{1,2})(?=[^|\]\w])/gi, '$1$3$2@LMonth ');
ohc_regex(/(\D\W)@Month([ _]|&nbsp;|{{(?:break|nbsp)}})@Day,([ _]|&nbsp;|{{(?:break|nbsp)}})@YYYY(?=[^|\]\w])/gi, '$1@Day$2@Month$3@Year');


if ( j < after.length ) after = after.substring( j ); else after = '';
//remove comma
ohc_regex(/(\D\W)@Day\s@Month,\s?@Year(?=\W\D)/gi, "$1@Day @LMonth @Year");


if (
// remove "the" from "on the dd month"
before.length && before.substring( before.length - 1 ).search( /\S/ ) >= 0 &&
ohc_regex(/(on |by )the @Day\s@Month(?=[ ,\)\.])/gi, "$1@Day @LMonth");
after.length && after.substr( 0, 1 ).search( /\S/ ) >= 0
) {
before += ' ';
}


cat_point = before.length;
//remove space from date range conversion
if ( cat_point === 0 && after.length && after.substr( 0, 1 ) === '\n' ) after = after.substr( 1 );
ohc_regex(/(\D ) @Day(\/|\s?(?:[-–]|&ndash;)\s?|(?:[ _]|&nbsp;)(?:and|&|to|or)(?:[ _]|&nbsp;)+?)/gi, "$1@Day$2");
}


wikitext = before + after;
function ohc_dates_to_mdy()
if ( !keyChange ) {
{
if ( HC.template_categories[ toRemove ] ) { summary.push( HC.messages.template_removed.replace( /\$1/g, toRemove ) ); } else { summary.push( HC.messages.cat_removed.replace( /\$1/g, toRemove ) ); }
//change birth and death templates – mf=y is the default; vgrelease new v=2 or mdy is default
}
regex(/\|df=[mdy]{3}(?:-all|)(?=\s*[|}])/gi, '');
regex(/\|df=y(?:es|)(?=[|}\s])/gi, '');
regex(/(mf=y(?:es|)\|[^}]*\|)(?:mf=y(?:es|)\|)/gi, '$1');
regex(/(\{\{vgrelease new[^|}]*\|)(?:v=2\||)([A-Z]{2,3}\|)/g, '$1$2');
ohc_regex(/(\|\s*(?:begin|end|first|last)\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Month @Day, @YYYY");


}
//convert date ranges (d,d,d-dmy to md,d,d-dy; d,d,d-dm to md,d,d-d; dm,d,d to md,d,d)
}
ohc_regex(/(\D\W)@Day((?:, @day){0,5})(\/|\s?(?:[-–]|&ndash;)\s?|\s(?:and|&|to|or)\s+?)@Day\s@Month,? @YYYY(?=\W\D)/gi, "$1@LMonth @Day1$2$3@Day2, @YYYY");
// Add
ohc_regex(/(\D\W)@Day((?:, @day){0,5})(\/|\s?(?:[-–]|&ndash;)\s?|\s(?:and|&|to|or)\s+?)@Day\s@Month(?=\W\D)/gi, "$1@LMonth @Day1$2$3@Day2");
if ( toAdd && toAdd.length ) {
// ohc_regex(/(\D\W)@Day((?:, @day){0,5})\s@Month,? @YYYY(?=\W\D)/gi, "$1@LMonth @Day1$2, @YYYY"); //disabling as unlikely and ungrammatical constructions causing false positives
matches = find_category( wikitext, toAdd );
// ohc_regex(/(\D\W)@Day((?:, @day){0,5})\s@Month(?=\W\D)/gi, "$1@LMonth @Day1$2"); //disabling as unlikely and ungrammatical constructions causing false positives
if ( matches && matches.length ) {
// Already exists
return {
text: wikitext,
summary: summary,
error: HC.messages.cat_exists.replace( /\$1/g, toAdd )
};
} else {
var onCat = false;
if ( cat_point < 0 ) {
var point = find_insertionpoint( wikitext );
cat_point = point.idx;
onCat = point.onCat;
} else {
onCat = true;
}
var newcatstring = '[[' + nameSpace + ':' + toAdd + ( key || '' ) + ']]';
if ( cat_point >= 0 ) {
var suffix = wikitext.substring( cat_point );
wikitext = wikitext.substring( 0, cat_point ) + ( cat_point > 0 ? '\n' : '' ) + newcatstring + ( !onCat ? '\n' : '' );
if ( suffix.length && suffix.substr( 0, 1 ) !== '\n' ) wikitext += '\n' + suffix; else wikitext += suffix;
} else {
if ( wikitext.length && wikitext.substr( wikitext.length - 1, 1 ) !== '\n' ) wikitext += '\n';


wikitext += ( wikitext.length ? '\n' : '' ) + newcatstring;
//'dm, dm,' to 'md, md,'
}
ohc_regex(/(\D\W)@Day @Month, @Day @Month(?=[,\.]?\W\D)/gi, "$1@LMonth1 @Day1, @LMonth2 @Day2");
if ( keyChange ) {
var k = key || '';
if ( k.length ) k = k.substr( 1 );


summary.push( substitute( HC.messages.cat_keychange, [ null, toAdd, k ] ) );
//convert simple dmy dates to mdy
} else {
ohc_regex(/(p(?:g?\.?|age) ?\d+|p(?:p\.?|ages) ?\d+[-–]\d+), @Month((?:\s@day?,?){1,6}) @Day(?=\W\D)/gi, "$1. @LMonth $2 @Day");
summary.push( HC.messages.cat_added.replace( /\$1/g, toAdd ) );
ohc_regex(/(\D\W)@Day(\s|&nbsp;)@Month,?(\s|&nbsp;)@Year(?=\W\D)/gi, "$1@LMonth$2@Day,$3@Year");
}
ohc_regex(/(\|\s*term_(?:end|start)\d\s*=\s*|\D\W)@Day[ ]+@Month,?\s@YYYY(?=\W\D)/gi, "$1@LMonth @Day, @Year");
if ( HC.uncat_regexp && !is_hidden ) {
ohc_regex(/(\|\s*term_(?:end|start)\d\s*=\s*|\D\W)@Day[ ]+@Month(?=\W\D)/gi, "$1@LMonth @Day");
var txt = wikitext.replace( HC.uncat_regexp, '' ); // Remove "uncat" templates
if ( txt.length !== wikitext.length ) {
wikitext = txt;
summary.push( HC.messages.uncat_removed );
}
}
}
}
return {
text: wikitext,
summary: summary,
error: null
};
}


// The real HotCat UI
//Month+day_number "মার্চ 7th" -> "মার্চ 7"
ohc_regex(/(\D\W)@Month\s@Day@th?,?\s@YYYY(?=\W\D)/gi, "$1@LMonth @Day, @YYYY");
ohc_regex(/(\D\W)@Day@th?(\s|&nbsp;)@Month(\s|&nbsp;)@YYYY(?=\W\D)/gi, "$1@LMonth$2@Day,$3@YYYY");
ohc_regex(/(\D\W)@Month(\s|&nbsp;)@Day(?=\W\D)/gi, "$1@LMonth$2@Day");
ohc_regex(/(\D\W)@Day@th?(\s|&nbsp;)@Month([,\.])(?=\W\D)/gi, "$1@LMonth$2@Day$3");


function evtKeys( e ) {
//add comma where missing
/* eslint-disable no-bitwise */
ohc_regex(/(\D\W)@Month\s@Day,?\s@YYYY,?(?=\s\w)/gi, "$1@LMonth @Day, @YYYY,");
var code = 0;
//rem superfluous comma where applicable
if ( e.ctrlKey ) { // All modern browsers
ohc_regex(/(\D[^\w\/])@Month\s@ZD,,(?=\W\D|\b)/gi, "$1@LMonth @Day,");
// Ctrl-click seems to be overloaded in FF/Mac (it opens a pop-up menu), so treat cmd-click
}
// as a ctrl-click, too.
if ( e.ctrlKey || e.metaKey ) code |= 1;


if ( e.shiftKey ) code |= 2;
function ohc_fix_dmy_redundancies()
}
{
return code;
//month-range redundancies (repeating month names)
}
ohc_regex(/([\D]@dd)@th? @Month[ ]{1,2}((?:to|and|-|–)[ ]{1,2}@dd)@th? @Month/, "$1 $2 @LMonth", function(d1, d2) {
function evtKill( e ) {
if (d1.m == d2.m) return true;
if ( e.preventDefault ) {
return false;
e.preventDefault();
});
e.stopPropagation();
}
} else {
//not currently used
e.cancelBubble = true;
function ohc_fix_mdy_redundancies()
}
{
//month-range redundancies (repeating month names)
ohc_regex(/(@Month[ ]{1,2}@dd)@th? (to|and|-|–)[ ]{1,2}@Month[ ]{1,2}@DD@th?/, "$1 $2 @LDay", function(d1, d2) {
if (d1.m == d2.m) return true;
return false;
return false;
}
});
}


var catLine = null,
function ohc_expand_ref_dates()
onUpload = false,
{
editors = [],
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month @YYYY(?=\s*[|}])/gi, "$1@FullMonth @YYYY");
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Day @Month @YYYY(?=\s*[|}])/gi, "$1@Day @FullMonth @YYYY");
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month @Day, @YYYY(?=\s*[|}])/gi, "$1@FullMonth @Day, @YYYY");


commitButton = null,
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)((?:[01-2]?\d|30|31) |)@Month @YYYY ?(?:-|–|&ndash;) ?((?:[01-3]?\d|30|31) |)@Month @YYYY(?=\s*[|}])/gi, "$1$2 @FullMonth1 @YYYY1 – $3@FullMonth2 @YYYY2");
commitForm = null,
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month @Day(, (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @Day, @YYYY(?=\s*[|}])/gi, "$1@FullMonth1 @Day1$2 – @FullMonth2 @Day2, @YYYY");
multiSpan = null,
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Day @Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Day @Month @YYYY(?=\s*[|}])/gi, "$1@Day1 @FullMonth1$2 – @Day2 @FullMonth2 @YYYY");
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month,? @YYYY(?=\s*[|}])/gi, "$1@FullMonth1$2 – @FullMonth2 @YYYY");
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)((?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @YYYY(?=\s*[|}])/gi, "$1@$2 – @FullMonth @YYYY");


pageText = null,
ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))((?:[01-2]?\d|30|31) |)@Month @YYYY ?(?:-|–|&ndash;) ?((?:[01-3]?\d|30|31) |)@Month @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1$2@FullMonth1 @YYYY1 – $3@FullMonth2 @YYYY2");
pageTime = null,
ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))@Month @Day(, (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @Day, @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1@FullMonth1 @Day1$2 – @FullMonth2 @Day2, @YYYY");
pageWatched = false,
ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))@Day @Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Day @Month @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1@Day1 @FullMonth1$2 – @Day2 @FullMonth2 @YYYY");
watchCreate = false,
ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))@Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month,? @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1@FullMonth1$2 – @FullMonth2 @YYYY");
watchEdit = false,
ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))((?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1$2 – @FullMonth @YYYY");
minorEdits = false,
}
editToken = null,


is_rtl = false,
function ohc_expand_all_dates()
serverTime = null,
{
lastRevId = null,
ohc_regex(/([^-\w/])@Month @YYYY(?=[^-\w/])/gi, '$1@FullMonth @YYYY');
pageTextRevId = null,
ohc_regex(/([^-\w/])@Day @Month @YYYY(?=[^-\w/])/gi, '$1@Day @FullMonth @YYYY');
conflictingUser = null,
ohc_regex(/([^-\w/])@Month @Day, @YYYY(?=[^-\w/])/gi, '$1@FullMonth @Day, @YYYY');


newDOM = false; // true if MediaWiki serves the new UL-LI DOM for categories
ohc_regex(/([^-\w/])((?:[01-2]?\d|30|31) |)@Month @YYYY ?(?:-|–|&ndash;) ?((?:[01-3]?\d|30|31) |)@Month @YYYY(?=[^-\w/])/gi, "$1$2@FullMonth1 @YYYY1 – $3@FullMonth2 @YYYY2");
 
ohc_regex(/([^-\w/])@Month @Day(, (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @Day, @YYYY(?=[^-\w/])/gi, "$1@FullMonth1 @Day1$2 – @FullMonth2 @Day2, @YYYY");
function CategoryEditor() {
ohc_regex(/([^-\w/])@Day @Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Day @Month @YYYY(?=[^-\w/])/gi, "$1@Day1 @FullMonth1$2 – @Day2 @FullMonth2 @YYYY");
this.initialize.apply( this, arguments );
ohc_regex(/([^-\w/])@Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month,? @YYYY(?=[^-\w/])/gi, "$1@FullMonth1$2 – @FullMonth2 @YYYY");
}
ohc_regex(/([^-\w/])((?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @YYYY(?=[^-\w/])/gi, "$1$2 – @FullMonth @YYYY");


function setPage( json ) {
ohc_regex(/([ ]\(|\|\s*)@Day @Month @YYYY(?=\)\W|\s*[|\n])/gi, "$1@Day @FullMonth @YYYY");
var startTime = null;
ohc_regex(/([ ]\(|\|\s*)@Month @Day,? @YYYY(?=\)\W|\s*[|\n])/gi, "$1@FullMonth @Day, @YYYY");
if ( json && json.query ) {
ohc_regex(/([ ]\((?:c\. |))@Month @YYYY ?(?:-|–|&nbsp;) ?@Day @Month @YYYY(?=\)\W)/gi, "$1@FullMonth1 @YYYY1 – @Day @FullMonth2 @YYYY2");
if ( json.query.pages ) {
ohc_regex(/([ ]\((?:c\. |))@Month @YYYY ?(?:-||&nbsp;) ?@Month @YYYY(?=\)\W)/gi, "$1@FullMonth1 @YYYY1 – @FullMonth2 @YYYY2");
var page = json.query.pages[ !conf.wgArticleId ? '-1' : String( conf.wgArticleId ) ];
ohc_regex(/([ ]\((?:c\. |))@YYYY ?(?:-|–|&nbsp;) ?@Month @YYYY(?=\)\W)/gi, "$1@YYYY1 – @FullMonth @YYYY2");
if ( page ) {
ohc_regex(/([ ]\((?:c\. |))@Month ?(?:-|–|&nbsp;) ?@Month @YYYY(?=\)\W)/gi, "$1@FullMonth1 – @FullMonth2 @YYYY");
if ( page.revisions && page.revisions.length ) {
ohc_regex(/([ ]\((?:c\. |))@Month @YYYY(?=\)\W)/gi, "$1@FullMonth @YYYY");
// Revisions are sorted by revision ID, hence [ 0 ] is the one we asked for, and possibly there's a [ 1 ] if we're
}
// not on the latest revision (edit conflicts and such).
pageText = page.revisions[ 0 ][ '*' ];
if ( page.revisions[ 0 ].timestamp ) pageTime = page.revisions[ 0 ].timestamp.replace( /\D/g, '' );
if ( page.revisions[ 0 ].revid ) pageTextRevId = page.revisions[ 0 ].revid;
if ( page.revisions.length > 1 ) conflictingUser = page.revisions[ 1 ].user;
}
if ( page.lastrevid ) lastRevId = page.lastrevid;
if ( page.starttimestamp ) startTime = page.starttimestamp.replace( /\D/g, '' );
pageWatched = typeof page.watched === 'string';
if ( json.query.tokens ) editToken = json.query.tokens.csrftoken;
if ( page.langlinks && ( !json[ 'query-continue' ] || !json[ 'query-continue' ].langlinks ) ) {
// We have interlanguage links, and we got them all.
var re = '';
for ( var i = 0; i < page.langlinks.length; i++ ) re += ( i > 0 ? '|' : '' ) + page.langlinks[ i ].lang.replace( /([\\^$.?*+()])/g, '\\$1' );
if ( re.length ) interlanguageRE = new RegExp( '((^|\\n\\r?)(\\[\\[\\s*(' + re + ')\\s*:[^\\]]+\\]\\]\\s*))+$' );
}
}
}
// Siteinfo
if ( json.query.general ) {
if ( json.query.general.time && !startTime ) startTime = json.query.general.time.replace( /\D/g, '' );


if ( HC.capitalizePageNames === null ) {
function ohc_abbrev_ref_dates()
// ResourceLoader's JSParser doesn't like .case, so override eslint.
{
// eslint-disable-next-line dot-notation
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Day @Month @YYYY(?=\s*[|}])/gi, "$1@Day @Mon @YYYY");
HC.capitalizePageNames = ( json.query.general[ 'case' ] === 'first-letter' );
ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))([12]?\d|30|31) (জানুয়ারি|ফেব্রুয়ারি|মার্চ|এপ্রিল|মে|জুন|জুলাই|আগষ্ট|অক্টোবর|Oct|নভেম্বর|ডিসেম্বর)(?:r?uary|ch|il|[ey]|ust|(?:t?em|o)ber)( (?:19\d|20[01])\d)(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1$2 $3$4");
}
ohc_regex(/([ ]\()@Day @Month @YYYY([^-\w\/])/gi, "$1@Day @Mon @YYYY$2");
}
serverTime = startTime;
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month @Day, @YYYY(?=\s*[|}])/gi, "$1@Mon @Day, @YYYY");
// Userinfo
ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))(জানুয়ারি|ফেব্রুয়ারি|মার্চ|এপ্রিল|মে|জুন|জুলাই|আগষ্ট|অক্টোবর|Oct|নভেম্বর|ডিসেম্বর)(?:r?uary|ch|il|[ey]|ust|(?:t?em|o)ber) ([12]?\d|30|31),( (?:19\d|20[01])\d)(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1$2 $3,$4");
if ( json.query.userinfo && json.query.userinfo.options ) {
ohc_regex(/([^-\w\/])@Month @Day, @YYYY([^-\w\/])/gi, '$1@Mon @Day, @YYYY$2');
watchCreate = !HC.dont_add_to_watchlist && json.query.userinfo.options.watchcreations === '1';
}
watchEdit = !HC.dont_add_to_watchlist && json.query.userinfo.options.watchdefault === '1';
minorEdits = json.query.userinfo.options.minordefault === 1;
//not currently used
// If the user has the "All edits are minor" preference enabled, we should honor that
function ohc_abbrev_all_dates()
// for single category changes, no matter what the site configuration is.
{
if ( minorEdits ) HC.single_minor = true;
ohc_regex(/([^-\w/])@Day @Month @YYYY(?=[^-\w/])/gi, '$1@Day @Mon @YYYY');
}
ohc_regex(/([^-\w/])@Month @Day, @YYYY(?=[^-\w/])/gi, '$1@Mon @Day, @YYYY');
}
}
}


var saveInProgress = false;
//not currently used
function initiateEdit( doEdit, failure ) {
function ohc_dmy_publication_dates()
if ( saveInProgress ) return;
{
saveInProgress = true;
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month @Day,? @YYYY/gi, "$1@Day @Month @YYYY"); // conversion of dates in references outside of the protection loop (eg for quotations etc.)
var oldButtonState;
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:\[\[)?@YYYY(?:\]\][-–]\[\[|[-–])@MM[-–]@DD(?:\]\])?(?=\s*[|}])/gi, "$1@Day @Month @YYYY");
if ( commitButton ) {
//replace ISO dates (within parentheses) only within refs
oldButtonState = commitButton.disabled;
ohc_regex(/(<ref[^>]*>[^<]+?)([ ]\()@YYYY-@MM-@DD(\))(\W[^<]*?<\/ref>)/gi, "$1$2@Day @Month @YYYY$3$4");
commitButton.disabled = true;
}
}


function fail() {
function ohc_mdy_publication_dates()
saveInProgress = false;
{
if ( commitButton ) commitButton.disabled = oldButtonState;
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Day @Month @YYYY/gi, "$1@Month @Day, @YYYY"); // conversion of dates in references outside of the protection loop (eg for quotations etc.)
failure.apply( this, arguments );
ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:\[\[)?@YYYY(?:\]\][-–]\[\[|[-–])@MM[-–]@DD(?:\]\])?(?=\s*[|}])/gi, "$1@Month @Day, @YYYY");  
}
//replace ISO dates (within parentheses) only within refs
ohc_regex(/(<ref[^>]*>[^<]+?)([ ]\()@YYYY-@MM-@DD(\))(\W[^<]*?<\/ref>)/gi, "$1$2@Month @Day, @YYYY$3$4");
}


// Must use Ajax here to get the user options and the edit token.
function ohc_Bigendian_ref_dates() {
$.getJSON(
// Add a tag to the summary box
conf.wgServer + conf.wgScriptPath + '/api.php?' +
regex(/(\{\{use (?:mdy|dmy) dates)(?:\|cs1-dates=\w{1,2}|)(\|[^\}\|]+\}\})/gi, '$1|cs1-dates=y$2');
'format=json&action=query&rawcontinue=&titles=' + encodeURIComponent( conf.wgPageName ) +
}
'&prop=info%7Crevisions%7Clanglinks&inprop=watched&rvprop=content%7Ctimestamp%7Cids%7Cuser&lllimit=500' +
'&rvlimit=2&rvdir=newer&rvstartid=' + conf.wgCurRevisionId + '&meta=siteinfo%7Cuserinfo%7Ctokens&type=csrf&uiprop=options',
function ( json ) {
setPage( json );
doEdit( fail );
}
).fail( function ( req ) {
fail( req.status + ' ' + req.statusText );
} );
}


function multiChangeMsg( count ) {
/** ------------------------------------------------------------------------ **/
var msg = HC.messages.multi_change;
/// EDIT SUMMARIES & USE DMY TEMPLATE
if ( typeof msg !== 'string' && msg.length )
// this function modified 2019-03-27 from [[Special:Permalink/846525463]]
if ( mw.language && mw.language.convertPlural ) { msg = mw.language.convertPlural( count, msg ); } else { msg = msg[ msg.length - 1 ]; }
// format parameter must be 'dmy' or 'mdy'
function ohc_use_dates_template(format)  
{
var txt = document.editform.wpTextbox1;
// current month-year
var currentDate = new Date();
var currmonth = currentDate.getMonth();
var curryear = currentDate.getFullYear();
var myMonths = ["জানুয়ারি", "ফেব্রুয়ারি", "মার্চ", "এপ্রিল", "মে", "জুন", "জুলাই", "আগষ্ট", "সেপ্টেম্বর", "অক্টোবর", "নভেম্বর", "ডিসেম্বর"];
var curryyyymm = myMonths[currmonth] + ' ' + curryear;


return substitute( msg, [ null, String( count ) ] );
// step 1: normalize redirect template names to canonical template names 'Use dmy dates' or 'Use mdy dates' according to 'format' argument
}
// rename redirects 'dmy', 'mdy', 'usedmydates', 'usemdydates' ('usedmydates' and 'usemdydates' are not currently listed as redirects but might be encountered?)
regex(/\{\{ *(?:use(?:dmy|mdy)dates|dmy|mdy) *([\|\}])/gi, '{{Use ' + format + ' dates$1');
// rename redirects 'usedmy', 'usemdy', 'use dmy', 'use mdy' to canonical form
regex(/\{\{ *use *(?:dmy|mdy) *([\|\}])/gi, '{{Use ' + format + ' dates$1');
// strip leading / trailing whitespace from 'use xxx dates'
regex(/\{\{ *use (?:dmy|mdy) dates *([\|\}])/gi, '{{Use ' + format + ' dates$1');


function currentTimestamp() {
// step 2: look for a canonical template name (the above might not have had anthing to work on) ; if found continue, write new template else
var now = new Date();
var rxpdd = new RegExp("{{Use " + format + " dates", "gi"); // here we search for canonical form {{use xxx dates}} that has current date
var ts = String( now.getUTCFullYear() );
var dflagfound = txt.value.search(rxpdd);
function two( s ) {
if (dflagfound === -1) {
return s.substr( s.length - 2 );
txt.value = '{{Use ' + format + ' dates|date=' + curryyyymm + '}}\r\n' + txt.value; // not found so insert new template at top of wikitext
}
return; // and done
ts +=
two( '0' + ( now.getUTCMonth() + 1 ) ) +
two( '0' + now.getUTCDate() ) +
two( '00' + now.getUTCHours() ) +
two( '00' + now.getUTCMinutes() ) +
two( '00' + now.getUTCSeconds() );
return ts;
}
}


function performChanges( failure, singleEditor ) {
// step 3: rewrite existing canonical templates; add or refresh |date= to current month year; preserve |cs1-dates= as is
if ( pageText === null ) {
regex(/(\{\{use (?:dmy|mdy) dates)\| *date *=[^\|]*\| *cs1\-dates *= *([^\|\}]*?) *\}\}/gi, '$1|date=' + curryyyymm + '|cs1-dates=$2}}'); // with |date= followed by |cs1-dates=
failure( HC.messages.multi_error );
regex(/(\{\{use (?:dmy|mdy) dates)\| *cs1\-dates *= *([^\|\}]*?) *\| *date *=[^\}]*\}\}/gi, '$1|date=' + curryyyymm + '|cs1-dates=$2}}'); // with |cs1-dates= followed by |date=
return;
regex(/(\{\{use (?:dmy|mdy) dates)\| *date *=[^\|\}]*\}\}/gi, '$1|date=' + curryyyymm + '}}'); // with |date=
}
regex(/(\{\{use (?:dmy|mdy) dates)\| *cs1\-dates *= *([^\|\}]*?) \}\}/gi, '$1|date=' + curryyyymm + '|cs1-dates=$2}}'); // with |cs1-dates
// Backwards compatibility after message change (added $2 to cat_keychange)
regex(/(\{\{use (?:dmy|mdy) dates)\}\}/gi, '$1|date=' + curryyyymm + '}}'); // no parameters so add |date=curryyyymm
if ( HC.messages.cat_keychange.indexOf( '$2' ) < 0 ) HC.messages.cat_keychange += '"$2"';
regex(/(\{\{[\t_ ]*use[\t_ ]+(?:dmy|mdy)[\t_ ]+dates[^{}]*\}\})([\r\n\t ]*)(\{\{[\t ]*short description[^{}]*\}\})/gi, '$3$2$1'); // repositioning "short description" template at the top
}


// More backwards-compatibility with earlier HotCat versions:
if ( !HC.messages.short_catchange ) HC.messages.short_catchange = '[[' + HC.category_canonical + ':$1]]';


// Create a form and submit it. We don't use the edit API (api.php?action=edit) because
// (a) sensibly reporting back errors like edit conflicts is always a hassle, and
// (b) we want to show a diff for multi-edits anyway, and
// (c) we want to trigger onsubmit events, allowing user code to intercept the edit.
// Using the form, we can do (b) and (c), and we get (a) for free. And, of course, using the form
// automatically reloads the page with the updated categories on a successful submit, which
// we would have to do explicitly if we used the edit API.
var action;
// Normally, we don't have to care about edit conflicts. If some other user edited the page in the meantime, the
// server will take care of it and merge the edit automatically or present an edit conflict screen. However, the
// server suppresses edit conflicts with oneself. Hence, if we have a conflict, and the conflicting user is the
// current user, then we set the "oldid" value and switch to diff, which gives the "you are editing an old version;
// if you save, any more recent changes will be lost" screen.
var selfEditConflict = ( lastRevId !== null && lastRevId !== conf.wgCurRevisionId || pageTextRevId !== null &&
pageTextRevId !== conf.wgCurRevisionId ) && conflictingUser && conflictingUser === conf.wgUserName;
if ( singleEditor && !singleEditor.noCommit && !HC.no_autocommit && editToken && !selfEditConflict ) {
// If we do have an edit conflict, but not with ourself, that's no reason not to attempt to save: the server side may actually be able to
// merge the changes. We just need to make sure that we do present a diff view if it's a self edit conflict.
commitForm.wpEditToken.value = editToken;
action = commitForm.wpDiff;
if ( action ) action.name = action.value = 'wpSave';
} else {
action = commitForm.wpSave;
if ( action ) action.name = action.value = 'wpDiff';
}
var result = {
text: pageText
},
changed = [],
added = [],
deleted = [],
changes = 0,
toEdit = singleEditor ? [ singleEditor ] : editors,
error = null,
edit,
i;
for ( i = 0; i < toEdit.length; i++ ) {
edit = toEdit[ i ];
if ( edit.state === CategoryEditor.CHANGED ) {
result = change_category(
result.text,
edit.originalCategory,
edit.currentCategory,
edit.currentKey,
edit.currentHidden );
if ( !result.error ) {
changes++;
if ( !edit.originalCategory || !edit.originalCategory.length ) {
added.push( edit.currentCategory );
} else {
changed.push( {
from: edit.originalCategory,
to: edit.currentCategory
} );
}
} else if ( error === null ) {
error = result.error;
}
} else if (
edit.state === CategoryEditor.DELETED && edit.originalCategory && edit.originalCategory.length ) {
result = change_category(
result.text,
edit.originalCategory,
null, null, false );
if ( !result.error ) {
changes++;
deleted.push( edit.originalCategory );
} else if ( error === null ) {
error = result.error;
}
}
}
if ( error !== null ) { // Do not commit if there were errors
action = commitForm.wpSave;
if ( action ) action.name = action.value = 'wpDiff';
}
// Fill in the form and submit it
commitForm.wpMinoredit.checked = minorEdits;
commitForm.wpWatchthis.checked = !conf.wgArticleId && watchCreate || watchEdit || pageWatched;
if ( conf.wgArticleId || !!singleEditor ) {
// Prepare change-tag save
if ( action && action.value === 'wpSave' ) {
if ( HC.changeTag ) {
commitForm.wpChangeTags.value = HC.changeTag;
HC.messages.using = '';
HC.messages.prefix = '';
}
} else {
commitForm.wpAutoSummary.value = HC.changeTag;
}
if ( changes === 1 ) {
if ( result.summary && result.summary.length ) commitForm.wpSummary.value = HC.messages.prefix + result.summary.join( HC.messages.separator ) + HC.messages.using;
commitForm.wpMinoredit.checked = HC.single_minor || minorEdits;
} else if ( changes ) {
var summary = [];
var shortSummary = [];
// Deleted
for ( i = 0; i < deleted.length; i++ ) summary.push( '−' + substitute( HC.messages.short_catchange, [ null, deleted[ i ] ] ) );


if ( deleted.length === 1 ) shortSummary.push( '−' + substitute( HC.messages.short_catchange, [ null, deleted[ 0 ] ] ) ); else if ( deleted.length ) shortSummary.push( '− ' + multiChangeMsg( deleted.length ) );
/** ------------------------------------------------------------------------ **/
/// DATE PROTECTION


// Added
var linkmap = [];
for ( i = 0; i < added.length; i++ ) summary.push( '+' + substitute( HC.messages.short_catchange, [ null, added[ i ] ] ) );


if ( added.length === 1 ) shortSummary.push( '+' + substitute( HC.messages.short_catchange, [ null, added[ 0 ] ] ) ); else if ( added.length ) shortSummary.push( '+ ' + multiChangeMsg( added.length ) );
function ohc_protect_dates()
{
// protects dates within links, quotes, etc
// the sensitive part is stored and replaced with a unique identifier,
// which is later replaced with the stored part.
var protect_function = function(s, begin, replace, end) {
linkmap.push(replace);
return begin + "⍌"+(linkmap.length-1)+"⍍" + end;
};
//\|x=
regex(/(<timeline>)([\s\S]*?)(<\/timeline>)/gi, protect_function);
regex(/(<!--)([^<\{\}]*?)(-->)/gi, protect_function);
regex(/(<math>)([\s\S]*?)(<\/math>)/gi, protect_function);
regex(/((?:{(?:Wikimedia |)Commons ?|C ?))(Cat(?:egory|))\|[^{}*](})/gi, protect_function);
regex(/(<ref)([^>]+)(>)/gi, protect_function);
regex(/((?:Category|Image|File):)([^|\]]*)([|\]])/gi, protect_function);
regex(/(\{(?:See ?also|Main))(\|[^}]*)(\})/gi, protect_function);
regex(/(\{\{(?:double ?|external ?|wide ?)image\s?\|)([^}]+)(\})/gi, protect_function);
regex(/(\{\{(?:harvnb|r|wikisource)\|)([^}]+)(\})/gi, protect_function);
regex(/(\{\{(?:Canadian federal by-election))([^}]+)(\}\})/gi, protect_function);
regex(/(\[(?:https?:|ftp:))([^\]]*)(\])/gi, protect_function);
regex(/(>[ ]*(?:https?:|ftp:))([^< >\]]*)([ ]*<)/gi, protect_function);
// regex(/(https?:|ftp:)([^\s\]]*)([\s\]])/gi, protect_function);
regex(/(<blockquote>)([\s\S]*?)(<\/blockquote>)/gi, protect_function);
regex(/(<noinclude>)([\s\S]*?)(<\/noinclude>)/gi, protect_function);
regex(/(<gallery)([\s\S]*?)(<\/gallery>)/gi, protect_function);
regex(/(<poem>)([\s\S]*?)(<\/poem>)/gi, protect_function);
regex(/(\{[^\{]{0,6}(?:quot[^|]{1,7}\s?|sic)\|)([^}]+)(\})/gi, protect_function);
regex(/((?:image\d?|image_skyline|image[ _]location\d?|image[ _]name|image[ _]file|img|map\d|pic)\s*=)([^|}]*)([|}])/gi, protect_function);
regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|(?:trans-?|)title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|(?:trans-?|)title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
regex(/([\|\{]\s*(?:season)\s*=)(\s*\[\[[^\]]*\]\]\s*)([|}])/gi, protect_function);
regex(/([\|\{]\s*(?:[xy])\s*=)(\s*[^\|]+\s*)(\|)/gi, protect_function);
regex(/(\{\{navsource\|)([^}]+)(\})/gi, protect_function);
regex(/(\{\{(?:singlechart)\|)([^}]+)(\})/gi, protect_function);
regex(/(\{\{(?:defaultsort|graph):)([^}]+)(\})/gi, protect_function);
regex(/(["“])([^"”\n]*)(["”])/gi, protect_function);
regex(/(.)(\(\{\{by\|[12]\d{3}\}\}[-–]\{\{by\|)([12]\d{3}[ ]*\}\}\))/gi, protect_function);
regex(/(.)(\(\{\{by\|[12]\d{3}\}\}(?:[-–]present|))(\))/gi, protect_function);
regex(/(\[\[)(4AD)(\]\]|\|)/gi, protect_function);


// Changed
//retraining redirects containing a date
var arrow = is_rtl ? '\u2190' : '\u2192'; // left and right arrows. Don't use ← and → in the code.
regex(/(\[\[)(?:সেপ্টেম্বর 3 Society)(\]\]|\|)/gi, '$1Jiusan Society$2');
for ( i = 0; i < changed.length; i++ ) {
regex(/(\[\[)(?:জুন 4th incident)(\]\]|\|)/gi, '$1Tiananmen Square protests of 1989$2');
if ( changed[ i ].from !== changed[ i ].to ) {
regex(/(\[\[)(?:5@th? অক্টোবর (?:\(Serbia\)|overthrow))(\]\]|\|)/gi, '$1Overthrow of Slobodan Milošević$2');
summary.push(
regex(/(\[\[)(?:অক্টোবর 5@th?(?: \(Serbia\)| overthrow|, 2000))(\]\]|\|)/gi, '$1Overthrow of Slobodan Milošević$2');
'±' + substitute( HC.messages.short_catchange, [ null, changed[ i ].from ] ) + arrow +
substitute( HC.messages.short_catchange, [ null, changed[ i ].to ] )
);
} else {
summary.push( '±' + substitute( HC.messages.short_catchange, [ null, changed[ i ].from ] ) );
}
}
if ( changed.length === 1 ) {
if ( changed[ 0 ].from !== changed[ 0 ].to ) {
shortSummary.push(
'±' + substitute( HC.messages.short_catchange, [ null, changed[ 0 ].from ] ) + arrow +
substitute( HC.messages.short_catchange, [ null, changed[ 0 ].to ] )
);
} else {
shortSummary.push( '±' + substitute( HC.messages.short_catchange, [ null, changed[ 0 ].from ] ) );
}
} else if ( changed.length ) {
shortSummary.push( '± ' + multiChangeMsg( changed.length ) );
}
if ( summary.length ) {
summary = summary.join( HC.messages.separator );
if ( summary.length > 200 - HC.messages.prefix.length - HC.messages.using.length ) summary = shortSummary.join( HC.messages.separator );


commitForm.wpSummary.value = HC.messages.prefix + summary + HC.messages.using;
//protect alternate meanings of 'মে' and 'মার্চ' (note: not case insensitive)
}
// ohc_regex(/([^\w])(@day,?\s{0,3}মে)([^\w][^\d])/g, protect_function);  //disabled 26 মে – not case senstitve: false negatives in converting dates in মে
}
ohc_regex(/([^\w])(মার্চ\s@day)(\s(?:mile|kilomet|met))/g, protect_function);
}


commitForm.wpTextbox1.value = result.text;
//protect all links containing a date and some text
commitForm.wpStarttime.value = serverTime || currentTimestamp();
ohc_regex(/(\[\[)(\s*\w[^\]\|\n]+?@day[^\]\|\n]+?@fullmonth[^\]\|\n]*)(\]\]|\|)/gi, protect_function);
commitForm.wpEdittime.value = pageTime || commitForm.wpStarttime.value;
ohc_regex(/(\[\[)([^\]\|\n]*?@day[^\]\|\n]+?@fullmonth(?:,? @year|) \D[^\]\|\n]+\w\s*)(\]\]|\|)/gi, protect_function);
if ( selfEditConflict ) commitForm.oldid.value = String( pageTextRevId || conf.wgCurRevisionId );
ohc_regex(/(\[\[)(\s*\w[^\]\|\n]+?@fullmonth[^\]\|\n]+?@day[^\]\|\n]*)(\|)/gi, protect_function);
ohc_regex(/(\[\[)([^\]\|\n]*?@fullmonth[^\]\|\n]+?@day(?:, @year|) \D[^\]\|\n]+\w\s*)(\]\]|\|)/gi, protect_function);


// Submit the form in a way that triggers onsubmit events: commitForm.submit() doesn't.
//protects certain dates
commitForm.hcCommit.click();
regex(/(\[\[)(4AD)([\s\S])/gi, protect_function);
}
regex(/([\s\S])(মার্চ (?:8|14) Alliance)([\s\S])/gi, protect_function);
regex(/([\s\S])(23rd মার্চ 1931: Shaheed)([\s\S])/gi, protect_function);
regex(/([\s\S])(Long মার্চ [1-7])([\s\S])/gi, protect_function);
regex(/([\s\S])(National সেপ্টেম্বর 11 Memorial & Museum)([\s\S])/gi, protect_function);
regex(/([\s\S])(Queen Elizabeth II সেপ্টেম্বর 11th Garden)([\s\S])/gi, protect_function);
regex(/([\s\S])(Bombay মার্চ 12)([\s\S])/gi, protect_function);
regex(/([\s\S])(movement 2 জুন)([\s\S])/gi, protect_function);
regex(/([\s\S])(6th\sof অক্টোবর City)([\s\S])/gi, protect_function);
regex(/([\s\S])(Party Workers' Liberation Front 30th of মে)([\s\S])/gi, protect_function);
regex(/([\s\S])(4th\sof আগষ্ট regime)([\s\S])/gi, protect_function);
regex(/([\s\S])(19th\sof এপ্রিল movement)([\s\S])/gi, protect_function);
regex(/([\s\S])(জুন 4th (?:incident|museum))([\s\S])/gi, protect_function);
regex(/([\s\S])(The Battle Of Marston Moor \(জুলাই 2nd,? 1644\))([\s\S])/gi, protect_function);
regex(/([\s\S])(Night of জানুয়ারি 16th)([\s\S])/gi, protect_function);
regex(/([\s\S])(Observance of 5th নভেম্বর Act)([\s\S])/gi, protect_function);
regex(/(\[\[)(13 মে incident)(\|)/gi, protect_function);
regex(/(\'\'\')(22nd\sof মে)(\'\'\')/gi, protect_function);
regex(/(\[\[)(22nd\sof মে \(film\))([|\]\'])/gi, protect_function);
regex(/(\[\[)(জুলাই 12, 2007, Baghdad airstrike)(\|)/gi, protect_function);
regex(/(\[\[)(নভেম্বর 1828)(\]\])/gi, protect_function);
regex(/(.)(4th\sof জুলাই)(.)/gi, protect_function);
regex(/(\[\[)((?:2300|2000)\s?AD)(\]\])/gi, protect_function);
regex(/(\[\[)(29 ফেব্রুয়ারি)(\]\])/gi, protect_function);
regex(/(\[\[)(ফেব্রুয়ারি 29)(\]\])/gi, protect_function);


function resolveOne( page, toResolve ) {
// works names
var cats = page.categories,
// regex(/(.)(protect string)(.)/gi, protect_function);
lks = page.links,
regex(/(.)(11\/22\/63)(.)/gi, protect_function);
is_dab = false,
regex(/(.)(1\.1\.1994)(.)/gi, protect_function);
is_redir = typeof page.redirect === 'string', // Hard redirect?
regex(/([\s\S])(2\.13\.61)([\s\S])/gi, protect_function);
is_hidden = page.categoryinfo && typeof page.categoryinfo.hidden === 'string',
// regex(/(.)(4th of জুলাই, Asbury)(.)/gi, protect_function); //protected above globally
is_missing = typeof page.missing === 'string',
regex(/(.)(26 অক্টোবর 1993)(.)/gi, protect_function);
i;
regex(/(\[\[|\'\')(জুন 1, 1974)(.)/gi, protect_function);
for ( i = 0; i < toResolve.length; i++ ) {
regex(/(\[\[|\'\')(জুলাই 15, 1972)(.)/gi, protect_function);
if ( i && toResolve[ i ].dabInputCleaned !== page.title.substring( page.title.indexOf( ':' ) + 1 ) ) continue;
regex(/(\[\[|\'\')(আগষ্ট 1914)(.)/gi, protect_function);
// Note: the server returns in page an NFC normalized Unicode title. If our input was not NFC normalized, we may not find
ohc_regex(/(\[\[|\'\')(@fullmonth @dd@th? \((?:@yyyy |)film\)(?:\|@fullmonth @dd@th?|))([\s\S])/gi, protect_function);
// any entry here. If we have only one editor to resolve (the most common case, I presume), we may simply skip the check.
ohc_regex(/(\[\[|\'\')(@dd@th? @fullmonth \((?:@yyyy |)film\)(?:\|@dd@th? @fullmonth|))([\s\S])/gi, protect_function);
toResolve[ i ].currentHidden = is_hidden;
// regex(/(Les Bains Douches 18)( ডিসেম্বর 1979)(.)/gi, protect_function);
toResolve[ i ].inputExists = !is_missing;
regex(/(আগষ্ট)( 7, 4:15)(.)/gi, protect_function);
toResolve[ i ].icon.src = ( is_missing ? HC.existsNo : HC.existsYes );
regex(/(In Concert, Zürich, অক্টোবর)( 28, 1979)(.)/gi, protect_function);
}
regex(/(CBGB OMFUG Masters: Live জুন)( 29, 2001)(.)/gi, protect_function);
if ( is_missing ) return;
ohc_regex(/(Live at [\w ]*,? [1-3]\d)( @fullmonth)(.)/gi, protect_function);
if ( !is_redir && cats && ( HC.disambig_category || HC.redir_category ) ) {
ohc_regex(/(Live at [\w ]*,? @fullmonth)( @dd)(.)/gi, protect_function);
for ( var c = 0; c < cats.length; c++ ) {
ohc_regex(/(Bootmoon Series: [\w ]*[-–] @fullmonth)( @day, @YYYY)(.)/gi, protect_function);
var cat = cats[ c ].title;
// Strip namespace prefix
if ( cat ) {
cat = cat.substring( cat.indexOf( ':' ) + 1 ).replace( /_/g, ' ' );
if ( cat === HC.disambig_category ) {
is_dab = true;
break;
} else if ( cat === HC.redir_category ) {
is_redir = true;
break;
}
}
}
}
if ( !is_redir && !is_dab ) return;
if ( !lks || !lks.length ) return;
var titles = [];
for ( i = 0; i < lks.length; i++ ) {
if (
// Category namespace -- always true since we ask only for the category links
lks[ i ].ns === 14 &&
// Name not empty
lks[ i ].title && lks[ i ].title.length
) {
// Internal link to existing thingy. Extract the page name and remove the namespace.
var match = lks[ i ].title;
match = match.substring( match.indexOf( ':' ) + 1 );
// Exclude blacklisted categories.
if ( !HC.blacklist || !HC.blacklist.test( match ) ) titles.push( match );
}
}
if ( !titles.length ) return;
for ( i = 0; i < toResolve.length; i++ ) {
if ( i && toResolve[ i ].dabInputCleaned !== page.title.substring( page.title.indexOf( ':' ) + 1 ) ) continue;
toResolve[ i ].inputExists = true; // Might actually be wrong if it's a redirect pointing to a non-existing category
toResolve[ i ].icon.src = HC.existsYes;
if ( titles.length > 1 ) {
toResolve[ i ].dab = titles;
} else {
toResolve[ i ].text.value =
titles[ 0 ] + ( toResolve[ i ].currentKey !== null ? '|' + toResolve[ i ].currentKey : '' );
}
}
}


function resolveRedirects( toResolve, params ) {
// expressions and grammatical strings including modal "মে"
if ( !params || !params.query || !params.query.pages ) return;
regex(/(\W)((?:\d{1,3}) মে)((?: have(?: \w+|)|) be)/g, protect_function);
for ( var p in params.query.pages ) resolveOne( params.query.pages[ p ], toResolve );
regex(/(\W)((?:\d{3}|3[2-9]|[4-9]\d)\/\d ডিসেম্বর(?:l\.?|))(\W)/gi, protect_function);
}
regex(/(\W)((?:\d{2,3})\/\d ডিসেম্বর(?:l\.?|))( \(\d\d? overs)/gi, protect_function);
}


function resolveMulti( toResolve, callback ) {
/** ------------------------------------------------------------------------ **/
var i;
/// DATE PROTECTION FOR ALL REF SECTION
for ( i = 0; i < toResolve.length; i++ ) {
toResolve[ i ].dab = null;
toResolve[ i ].dabInput = toResolve[ i ].lastInput;
}
if ( noSuggestions ) {
callback( toResolve );
return;
}
// Use %7C instead of |, otherwise Konqueror insists on re-encoding the arguments, resulting in doubly encoded
// category names. (That is a bug in Konqueror. Other browsers don't have this problem.)
var args = 'action=query&prop=info%7Clinks%7Ccategories%7Ccategoryinfo&plnamespace=14' +
'&pllimit=' + ( toResolve.length * 10 ) +
'&cllimit=' + ( toResolve.length * 10 ) +
'&format=json&titles=';
for ( i = 0; i < toResolve.length; i++ ) {
var v = toResolve[ i ].dabInput;
v = replaceShortcuts( v, HC.shortcuts );
toResolve[ i ].dabInputCleaned = v;
args += encodeURIComponent( 'Category:' + v );
if ( i + 1 < toResolve.length ) args += '%7C';
}
$.getJSON( conf.wgServer + conf.wgScriptPath + '/api.php?' + args,
function ( json ) {
resolveRedirects( toResolve, json );
callback( toResolve );
} ).fail( function ( req ) {
if ( !req ) noSuggestions = true;
callback( toResolve );
} );
}


function makeActive( which ) {
var linkmap = [];
if ( which.is_active ) return;
for ( var i = 0; i < editors.length; i++ )
if ( editors[ i ] !== which ) editors[ i ].inactivate();


which.is_active = true;
function ohc_protect_dates_ref()  
if ( which.dab ) {
{
// eslint-disable-next-line no-use-before-define
// protects dates within links, quotes, etc
showDab( which );
// the sensitive part is stored and replaced with a unique identifier,
} else {
// which is later replaced with the stored part.
// Check for programmatic value changes.
var expectedInput = which.lastRealInput || which.lastInput || '';
var actualValue = which.text.value || '';
if ( !expectedInput.length && actualValue.length || expectedInput.length && actualValue.indexOf( expectedInput ) ) {
// Somehow the field's value appears to have changed, and which.lastSelection therefore is no longer valid. Try to set the
// cursor at the end of the category, and do not display the old suggestion list.
which.showsList = false;
var v = actualValue.split( '|' );
which.lastRealInput = which.lastInput = v[ 0 ];
if ( v.length > 1 ) which.currentKey = v[ 1 ];


if ( which.lastSelection ) {
var protect_function = function (s, begin, replace, end) {
which.lastSelection = {
linkmap.push(replace);
start: v[ 0 ].length,
return begin + "⍌" + (linkmap.length - 1) + "⍍" + end;
end: v[ 0 ].length
};
};
}
}
if ( which.showsList ) which.displayList();


if ( which.lastSelection ) {
regex(/(<ref\s?(?:>|name=[^>]+))([^<]+)(<\/ref>)/gi, protect_function);
if ( is_webkit ) {
regex(/(<timeline>)([\s\S]*?)(<\/timeline>)/gi, protect_function);
// WebKit (Safari, Chrome) has problems selecting inside focus()
regex(/(<math>)([\s\S]*?)(<\/math>)/gi, protect_function);
// See http://code.google.com/p/chromium/issues/detail?id=32865#c6
regex(/((?:{(?:Wikimedia |)Commons ?|C ?))(Cat(?:egory|))\|[^{}*](})/gi, protect_function);
window.setTimeout(
regex(/((?:Category|Image|File):)([^|\]]*)([|\]])/gi, protect_function);
function () {
regex(/(\{(?:See ?also|Main))(\|[^}]*)(\})/gi, protect_function);
which.setSelection( which.lastSelection.start, which.lastSelection.end );
regex(/(\{\{(?:double ?|external ?|wide ?)image\s?\|)([^}]+)(\})/gi, protect_function);
},
regex(/(\{\{(?:harvnb|wikisource)\|)([^}]+)(\})/gi, protect_function);
1 );
regex(/(\[(?:https?:|ftp:))([^\]]*)(\])/gi, protect_function);
} else {
regex(/(>[ ]*(?:https?:|ftp:))([^< >\]]*)([ ]*<)/gi, protect_function);
which.setSelection( which.lastSelection.start, which.lastSelection.end );
//regex(/(https?:|ftp:)([^\s\]]*)([\s\]])/gi, protect_function);
}
regex(/(<blockquote>)([\s\S]*?)(<\/blockquote>)/gi, protect_function);
}
regex(/(\{[^\{]{0,6}(?:quot[^|]{1,7}\s?|sic)\|)([^}]+)(\})/gi, protect_function);
}
regex(/((?:image\d?|image_skyline|image[ _]location\d?|image[ _]name|image[ _]file|img|pic)\s*=)([^|}]*)([|}])/gi, protect_function);
}
regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
regex(/([\|\{]\s*(?:season)\s*=)(\s*\[\[[^\]]*\]\]\s*)([|}])/gi, protect_function);
regex(/(\{\{navsource\|)([^}]+)(\})/gi, protect_function);
regex(/(\{\{singlechart\|)([^}]+)(\})/gi, protect_function);
regex(/(\{\{defaultsort:)([^}]+)(\})/gi, protect_function);
regex(/([\s\(>]")([^"\n]*)(")/gi, protect_function);
regex(/([\s\(>]“)([^”\n]*)(”)/gi, protect_function);
regex(/(.)(\(\{\{by\|[12]\d{3}\}\}[-–]\{\{by\|)([12]\d{3}[ ]*\}\}\))/gi, protect_function);
regex(/(.)(\(\{\{by\|[12]\d{3}\}\}(?:[-–]present|))(\))/gi, protect_function);


function showDab( which ) {
//retraining redirects containing a date
if ( !which.is_active ) {
regex(/(\[\[)(?:সেপ্টেম্বর 3 Society)(\]\]|\|)/gi, '$1Jiusan Society$2');
makeActive( which );
regex(/(\[\[)(?:জুন 4th incident)(\]\]|\|)/gi, '$1Tiananmen Square protests of 1989$2');
} else {
ohc_regex(/(\[\[)(?:5@th? অক্টোবর (?:\(Serbia\)|overthrow))(\]\]|\|)/gi, '$1Overthrow of Slobodan Milošević$2');
which.showSuggestions( which.dab, false, null, null ); // do autocompletion, no key, no engine selector
ohc_regex(/(\[\[)(?:অক্টোবর 5@th?(?: \(Serbia\)| overthrow|, 2000))(\]\]|\|)/gi, '$1Overthrow of Slobodan Milošević$2');
which.dab = null;
}
}


function multiSubmit() {
//protect alternate meanings of 'মে' and 'মার্চ' (note: not case insensitive)
var toResolve = [];
ohc_regex(/([^\w])(@day,?\s{0,3}মে)([^\w][^\d])/g, protect_function);
for ( var i = 0; i < editors.length; i++ )
ohc_regex(/([^\w])(মার্চ\s@day)(\s(?:mile|kilomet|met))/g, protect_function);
if ( editors[ i ].state === CategoryEditor.CHANGE_PENDING || editors[ i ].state === CategoryEditor.OPEN ) toResolve.push( editors[ i ] );


if ( !toResolve.length ) {
//protect all links containing a date and some text
initiateEdit( function ( failure ) {
ohc_regex(/(\[\[)(\s*\w[^\]\|\n]+?@day[^\]\|\n]+?@fullmonth[^\]\|\n]*)(\]\]|\|)/gi, protect_function);
performChanges( failure );
ohc_regex(/(\[\[)([^\]\|\n]*?@day[^\]\|\n]+?@fullmonth(?:,? @year|) \D[^\]\|\n]+\w\s*)(\]\]|\|)/gi, protect_function);
}, function ( msg ) {
ohc_regex(/(\[\[)(\s*\w[^\]\|\n]+?@fullmonth[^\]\|\n]+?@day[^\]\|\n]*)(\|)/gi, protect_function);
alert( msg );
ohc_regex(/(\[\[)([^\]\|\n]*?@fullmonth[^\]\|\n]+?@day(?:, @year|) \D[^\]\|\n]+\w\s*)(\]\]|\|)/gi, protect_function);
} );
return;
}
resolveMulti( toResolve, function ( resolved ) {
var firstDab = null;
var dontChange = false;
for ( var i = 0; i < resolved.length; i++ ) {
if ( resolved[ i ].lastInput !== resolved[ i ].dabInput ) {
// We didn't disable all the open editors, but we did asynchronous calls. It is
// theoretically possible that the user changed something...
dontChange = true;
} else {
if ( resolved[ i ].dab ) {
if ( !firstDab ) firstDab = resolved[ i ];
} else {
if ( resolved[ i ].acceptCheck( true ) ) resolved[ i ].commit();
}
}
}
if ( firstDab ) {
showDab( firstDab );
} else if ( !dontChange ) {
initiateEdit( function ( failure ) {
performChanges( failure );
}, function ( msg ) {
alert( msg );
} );
}
} );
}


function setMultiInput() {
//protects certain dates
if ( commitButton || onUpload ) return;
regex(/(\[\[)(4AD)([\s\S])/gi, protect_function);
commitButton = make( 'input' );
regex(/([\s\S])(মার্চ (?:8|14) Alliance)([\s\S])/gi, protect_function);
commitButton.type = 'button';
regex(/([\s\S])(23rd মার্চ 1931: Shaheed)([\s\S])/gi, protect_function);
commitButton.value = HC.messages.commit;
regex(/([\s\S])(Long মার্চ [1-7])([\s\S])/gi, protect_function);
commitButton.onclick = multiSubmit;
regex(/([\s\S])(Bombay মার্চ 12)([\s\S])/gi, protect_function);
if ( multiSpan ) multiSpan.parentNode.replaceChild( commitButton, multiSpan ); else catLine.appendChild( commitButton );
regex(/([\s\S])(movement 2 জুন)([\s\S])/gi, protect_function);
}
regex(/([\s\S])(6th\sof অক্টোবর City)([\s\S])/gi, protect_function);
regex(/([\s\S])(Party Workers' Liberation Front 30th of মে)([\s\S])/gi, protect_function);
regex(/([\s\S])(4th\sof আগষ্ট regime)([\s\S])/gi, protect_function);
regex(/([\s\S])(19th\sof এপ্রিল movement)([\s\S])/gi, protect_function);
regex(/([\s\S])(জুন 4th incident)([\s\S])/gi, protect_function);
regex(/([\s\S])(The Battle Of Marston Moor \(জুলাই 2nd,? 1644\))([\s\S])/gi, protect_function);
regex(/([\s\S])(Night of জানুয়ারি 16th)([\s\S])/gi, protect_function);
regex(/([\s\S])(Observance of 5th নভেম্বর Act)([\s\S])/gi, protect_function);
regex(/(\[\[)(13 মে incident)(\|)/gi, protect_function);
regex(/(\'\'\')(22nd\sof মে)(\'\'\')/gi, protect_function);
regex(/(\[\[)(22nd\sof মে \(film\))([|\]\'])/gi, protect_function);
regex(/(\[\[)(জুলাই 12, 2007, Baghdad airstrike)(\|)/gi, protect_function);
regex(/(\[\[)(নভেম্বর 1828)(\]\])/gi, protect_function);
regex(/(.)(4th\sof জুলাই)(.)/gi, protect_function);
regex(/(\[\[)((?:2300|2000)\s?AD)(\]\])/gi, protect_function);
regex(/(\[\[)(29 ফেব্রুয়ারি)(\]\])/gi, protect_function);
regex(/(\[\[)(ফেব্রুয়ারি 29)(\]\])/gi, protect_function);


function checkMultiInput() {
// works names
if ( !commitButton ) return;
//regex(/(.)(protect string)(.)/gi, protect_function);
var hasChanges = false;
regex(/(.)(11\/22\/63)(.)/gi, protect_function);
for ( var i = 0; i < editors.length; i++ ) {
regex(/(.)(1\.1\.1994)(.)/gi, protect_function);
if ( editors[ i ].state !== CategoryEditor.UNCHANGED ) {
regex(/([\s\S])(2\.13\.61)([\s\S])/gi, protect_function);
hasChanges = true;
//regex(/(.)(4th of জুলাই, Asbury)(.)/gi, protect_function); //protected above globally
break;
regex(/(.)(26 অক্টোবর 1993)(.)/gi, protect_function);
}
regex(/(\[\[|\'\')(জুন 1, 1974)(.)/gi, protect_function);
}
regex(/(\[\[|\'\')(জুলাই 15, 1972)(.)/gi, protect_function);
commitButton.disabled = !hasChanges;
regex(/(\[\[|\'\')(আগষ্ট 1914)(.)/gi, protect_function);
}
ohc_regex(/(\[\[|\'\')(@fullmonth @dd@th? \((?:@yyyy |)film\)(?:\|@fullmonth @dd@th?|))([\s\S])/gi, protect_function);
ohc_regex(/(\[\[|\'\')(@dd@th? @fullmonth \((?:@yyyy |)film\)(?:\|@dd@th? @fullmonth|))([\s\S])/gi, protect_function);
//regex(/(Les Bains Douches 18)( ডিসেম্বর 1979)(.)/gi, protect_function);
regex(/(আগষ্ট)( 7, 4:15)(.)/gi, protect_function);
regex(/(In Concert, Zürich, অক্টোবর)( 28, 1979)(.)/gi, protect_function);
regex(/(CBGB OMFUG Masters: Live জুন)( 29, 2001)(.)/gi, protect_function);
ohc_regex(/(Live at [\w ]*,? [1-3]\d)( @fullmonth)(.)/gi, protect_function);
ohc_regex(/(Live at [\w ]*,? @fullmonth)( @dd)(.)/gi, protect_function);
ohc_regex(/(Bootmoon Series: [\w ]*[-–] @fullmonth)( @day, @YYYY)(.)/gi, protect_function);


var suggestionEngines = {
regex(/(\W)((?:\d{3}|3[2-9]|[4-9]\d)\/\d ডিসেম্বর(?:l\.?|))(\W)/gi, protect_function);
opensearch: {
regex(/(\W)((?:\d{2,3})\/\d ডিসেম্বর(?:l\.?|))( \(\d\d? overs)/gi, protect_function);
uri: '/api.php?format=json&action=opensearch&namespace=14&limit=30&search=Category:$1', // $1 = search term
}
// Function to convert result of uri into an array of category names
handler: function ( queryResult, queryKey ) {
if ( queryResult && queryResult.length >= 2 ) {
var key = queryResult[ 0 ].substring( queryResult[ 0 ].indexOf( ':' ) + 1 );
var titles = queryResult[ 1 ];
var exists = false;
if ( !cat_prefix ) cat_prefix = new RegExp( '^(' + HC.category_regexp + '):' );


for ( var i = 0; i < titles.length; i++ ) {
cat_prefix.lastIndex = 0;
var m = cat_prefix.exec( titles[ i ] );
if ( m && m.length > 1 ) {
titles[ i ] = titles[ i ].substring( titles[ i ].indexOf( ':' ) + 1 ); // rm namespace
if ( key === titles[ i ] ) exists = true;
} else {
titles.splice( i, 1 ); // Nope, it's not a category after all.
i--;
}
}
titles.exists = exists;
if ( queryKey !== key ) titles.normalized = key;
// Remember the NFC normalized key we got back from the server
return titles;
}
return null;
}
},
internalsearch: {
uri: '/api.php?format=json&action=query&list=allpages&apnamespace=14&aplimit=30&apfrom=$1&apprefix=$1',
handler: function ( queryResult ) {
if ( queryResult && queryResult.query && queryResult.query.allpages ) {
var titles = queryResult.query.allpages;
for ( var i = 0; i < titles.length; i++ ) titles[ i ] = titles[ i ].title.substring( titles[ i ].title.indexOf( ':' ) + 1 ); // rm namespace


return titles;
/** ------------------------------------------------------------------------ **/
}
/// DATE PROTECTION FOR SLASH modules
return null;
}
},
exists: {
uri: '/api.php?format=json&action=query&prop=info&titles=Category:$1',
handler: function ( queryResult, queryKey ) {
if ( queryResult && queryResult.query && queryResult.query.pages && !queryResult.query.pages[ -1 ] ) {
// Should have exactly 1
for ( var p in queryResult.query.pages ) {
var title = queryResult.query.pages[ p ].title;
title = title.substring( title.indexOf( ':' ) + 1 );
var titles = [ title ];
titles.exists = true;
if ( queryKey !== title ) titles.normalized = title;
// NFC
return titles;
}
}
return null;
}
},
subcategories: {
uri: '/api.php?format=json&action=query&list=categorymembers&cmtype=subcat&cmlimit=max&cmtitle=Category:$1',
handler: function ( queryResult ) {
if ( queryResult && queryResult.query && queryResult.query.categorymembers ) {
var titles = queryResult.query.categorymembers;
for ( var i = 0; i < titles.length; i++ ) titles[ i ] = titles[ i ].title.substring( titles[ i ].title.indexOf( ':' ) + 1 ); // rm namespace


return titles;
var linkmap = [];
}
return null;
}
},
parentcategories: {
uri: '/api.php?format=json&action=query&prop=categories&titles=Category:$1&cllimit=max',
handler: function ( queryResult ) {
if ( queryResult && queryResult.query && queryResult.query.pages ) {
for ( var p in queryResult.query.pages ) {
if ( queryResult.query.pages[ p ].categories ) {
var titles = queryResult.query.pages[ p ].categories;
for ( var i = 0; i < titles.length; i++ ) titles[ i ] = titles[ i ].title.substring( titles[ i ].title.indexOf( ':' ) + 1 ); // rm namespace


return titles;
function ohc_protect_dates_slash()
}
{
}
// protects dates within links, quotes, etc
}
// the sensitive part is stored and replaced with a unique identifier,
return null;
// which is later replaced with the stored part.
}
}
};


var suggestionConfigs = {
var protect_function = function (s, begin, replace, end) {
searchindex: {
linkmap.push(replace);
name: 'Search index',
return begin + "⍌" + (linkmap.length - 1) + "⍍" + end;
engines: [ 'opensearch' ],
cache: {},
show: true,
temp: false,
noCompletion: false
},
pagelist: {
name: 'Page list',
engines: [ 'internalsearch', 'exists' ],
cache: {},
show: true,
temp: false,
noCompletion: false
},
combined: {
name: 'Combined search',
engines: [ 'opensearch', 'internalsearch' ],
cache: {},
show: true,
temp: false,
noCompletion: false
},
subcat: {
name: 'Subcategories',
engines: [ 'subcategories' ],
cache: {},
show: true,
temp: true,
noCompletion: true
},
parentcat: {
name: 'Parent categories',
engines: [ 'parentcategories' ],
cache: {},
show: true,
temp: true,
noCompletion: true
}
};
};


CategoryEditor.UNCHANGED = 0;
regex(/(<ref\s?(?:>|name=[^>]+))([^<]+)(<\/ref>)/gi, protect_function);
CategoryEditor.OPEN = 1; // Open, but no input yet
regex(/(<timeline>)([\s\S]*?)(<\/timeline>)/gi, protect_function);
CategoryEditor.CHANGE_PENDING = 2; // Open, some input made
regex(/(<math>)([\s\S]*?)(<\/math>)/gi, protect_function);
CategoryEditor.CHANGED = 3;
regex(/((?:{(?:Wikimedia |)Commons ?|C ?))(Cat(?:egory|))\|[^{}*](})/gi, protect_function);
CategoryEditor.DELETED = 4;
regex(/((?:Category|Image|File):)([^|\]]*)([|\]])/gi, protect_function);
 
regex(/(\{(?:See ?also|Main))(\|[^}]*)(\})/gi, protect_function);
// Support: IE6
regex(/(\{\{(?:double ?|external ?|wide ?)image\s?\|)([^}]+)(\})/gi, protect_function);
// IE6 sometimes forgets to redraw the list when editors are opened or closed.
regex(/(\{\{(?:harvnb|wikisource)\|)([^}]+)(\})/gi, protect_function);
// Adding/removing a dummy element helps, at least when opening editors.
regex(/(\[(?:https?:|ftp:))([^\]]*)(\])/gi, protect_function);
var dummyElement = make( '\xa0', true );
regex(/(>[ ]*(?:https?:|ftp:))([^< >\]]*)([ ]*<)/gi, protect_function);
 
//regex(/(https?:|ftp:)([^\s\]]*)([\s\]])/gi, protect_function);
function forceRedraw() {
regex(/(<blockquote>)([\s\S]*?)(<\/blockquote>)/gi, protect_function);
if ( dummyElement.parentNode ) document.body.removeChild( dummyElement ); else document.body.appendChild( dummyElement );
regex(/(\{[^\{]{0,6}(?:quot[^|]{1,7}\s?|sic)\|)([^}]+)(\})/gi, protect_function);
}
regex(/((?:image\d?|image_skyline|image[ _]location\d?|image[ _]name|image[ _]file|img|pic)\s*=)([^|}]*)([|}])/gi, protect_function);
 
regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
// Event keyCodes that we handle in the text input field/suggestion list.
regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
var BS = 8,
regex(/([\|\{]\s*(?:season)\s*=)(\s*\[\[[^\]]*\]\]\s*)([|}])/gi, protect_function);
TAB = 9,
regex(/(\{\{navsource\|)([^}]+)(\})/gi, protect_function);
RET = 13,
regex(/(\{\{singlechart\|)([^}]+)(\})/gi, protect_function);
ESC = 27,
regex(/(\{\{defaultsort:)([^}]+)(\})/gi, protect_function);
SPACE = 32,
regex(/([\s\(>]")([^"\n]*)(")/gi, protect_function);
PGUP = 33,
regex(/([\s\(>]“)([^”\n]*)(”)/gi, protect_function);
PGDOWN = 34,
regex(/(.)(\(\{\{by\|[12]\d{3}\}\}[-–]\{\{by\|)([12]\d{3}[ ]*\}\}\))/gi, protect_function);
UP = 38,
regex(/(.)(\(\{\{by\|[12]\d{3}\}\}(?:[-–]present|))(\))/gi, protect_function);
DOWN = 40,
DEL = 46,
IME = 229;
 
CategoryEditor.prototype = {
 
initialize: function ( line, span, after, key, is_hidden ) {
// If a span is given, 'after' is the category title, otherwise it may be an element after which to
// insert the new span. 'key' is likewise overloaded; if a span is given, it is the category key (if
// known), otherwise it is a boolean indicating whether a bar shall be prepended.
if ( !span ) {
this.isAddCategory = true;
// Create add span and append to catLinks
this.originalCategory = '';
this.originalKey = null;
this.originalExists = false;
if ( !newDOM ) {
span = make( 'span' );
span.className = 'noprint';
if ( key ) {
span.appendChild( make( ' | ', true ) );
if ( after ) {
after.parentNode.insertBefore( span, after.nextSibling );
after = after.nextSibling;
} else if (line) {
line.appendChild( span );
}
} else if ( line && line.firstChild ) {
span.appendChild( make( ' ', true ) );
line.appendChild( span );
}
}
this.linkSpan = make( 'span' );
this.linkSpan.className = 'noprint nopopups hotcatlink';
var lk = make( 'a' );
lk.href = '#catlinks';
lk.onclick = this.open.bind( this );
lk.appendChild( make( HC.links.add, true ) );
lk.title = HC.tooltips.add;
this.linkSpan.appendChild( lk );
span = make( newDOM ? 'li' : 'span' );
span.className = 'noprint';
if ( is_rtl ) span.dir = 'rtl';
 
span.appendChild( this.linkSpan );
if ( after ) {
after.parentNode.insertBefore( span, after.nextSibling );
} else if ( line ) {
line.appendChild( span );
}


this.normalLinks = null;
}
this.undelLink = null;
this.catLink = null;
} else {
if ( is_rtl ) span.dir = 'rtl';


this.isAddCategory = false;
function ohc_unprotect_dates()
this.catLink = span.firstChild;
{
this.originalCategory = after;
//unprotect all dates
this.originalKey = ( key && key.length > 1 ) ? key.substr( 1 ) : null; // > 1 because it includes the leading bar
regex(/[♫]/g, '');
this.originalExists = !hasClass( this.catLink, 'new' );
regex(/⍌([0-9]+)⍍/g, function (x, n) {
// Create change and del links
var res = linkmap[n];
this.makeLinkSpan();
res = res.replace(/⍌([0-9]+)⍍/g, function (x, n) {
if ( !this.originalExists && this.upDownLinks ) this.upDownLinks.style.display = 'none';
var res = linkmap[n];
res = res.replace(/⍌([0-9]+)⍍/g, function (x, n) {
var res = linkmap[n];
res = res.replace(/⍌([0-9]+)⍍/g, function (x, n) {
return linkmap[n];
});
return res;
});
return res;
});
return res;
});
}


span.appendChild( this.linkSpan );
function ohc_MOSNUM_edit_summary()  
}
{
this.originalHidden = is_hidden;
//Add a tag to the summary box
this.line = line;
setoptions(minor = 'true');
this.engine = HC.suggestions;
setreason('date formats per [[MOS:DATEFORMAT]] by [[WP:MOSNUMscript|script]]', 'append');
this.span = span;
doaction('diff');
this.currentCategory = this.originalCategory;
}
this.currentExists = this.originalExists;
this.currentHidden = this.originalHidden;
this.currentKey = this.originalKey;
this.state = CategoryEditor.UNCHANGED;
this.lastSavedState = CategoryEditor.UNCHANGED;
this.lastSavedCategory = this.originalCategory;
this.lastSavedKey = this.originalKey;
this.lastSavedExists = this.originalExists;
this.lastSavedHidden = this.originalHidden;
if ( this.catLink && this.currentKey ) this.catLink.title = this.currentKey;


editors[ editors.length ] = this;
function ohc_bigendien_edit_summary()
},
{
//Add a tag to the summary box
setoptions(minor = 'true');
setreason('ymd ref dates', 'append');
doaction('diff');
}


makeLinkSpan: function () {
function ohc_expand_edit_summary()  
this.normalLinks = make( 'span' );
{
var lk = null;
//Add a tag to the summary box
if ( this.originalCategory && this.originalCategory.length ) {
setoptions(minor = 'true');
lk = make( 'a' );
setreason('expand month names', 'append');
lk.href = '#catlinks';
doaction('diff');
lk.onclick = this.remove.bind( this );
}
lk.appendChild( make( HC.links.remove, true ) );
lk.title = HC.tooltips.remove;
this.normalLinks.appendChild( make( ' ', true ) );
this.normalLinks.appendChild( lk );
}
if ( !HC.template_categories[ this.originalCategory ] ) {
lk = make( 'a' );
lk.href = '#catlinks';
lk.onclick = this.open.bind( this );
lk.appendChild( make( HC.links.change, true ) );
lk.title = HC.tooltips.change;
this.normalLinks.appendChild( make( ' ', true ) );
this.normalLinks.appendChild( lk );
if ( !noSuggestions && HC.use_up_down ) {
this.upDownLinks = make( 'span' );
lk = make( 'a' );
lk.href = '#catlinks';
lk.onclick = this.down.bind( this );
lk.appendChild( make( HC.links.down, true ) );
lk.title = HC.tooltips.down;
this.upDownLinks.appendChild( make( ' ', true ) );
this.upDownLinks.appendChild( lk );
lk = make( 'a' );
lk.href = '#catlinks';
lk.onclick = this.up.bind( this );
lk.appendChild( make( HC.links.up, true ) );
lk.title = HC.tooltips.up;
this.upDownLinks.appendChild( make( ' ', true ) );
this.upDownLinks.appendChild( lk );
this.normalLinks.appendChild( this.upDownLinks );
}
}
this.linkSpan = make( 'span' );
this.linkSpan.className = 'noprint nopopups hotcatlink';
this.linkSpan.appendChild( this.normalLinks );
this.undelLink = make( 'span' );
this.undelLink.className = 'nopopups hotcatlink';
this.undelLink.style.display = 'none';
lk = make( 'a' );
lk.href = '#catlinks';
lk.onclick = this.restore.bind( this );
lk.appendChild( make( HC.links.restore, true ) );
lk.title = HC.tooltips.restore;
this.undelLink.appendChild( make( ' ', true ) );
this.undelLink.appendChild( lk );
this.linkSpan.appendChild( this.undelLink );
},


invokeSuggestions: function ( dont_autocomplete ) {
function ohc_slash_edit_summary()  
if ( this.engine && suggestionConfigs[ this.engine ] && suggestionConfigs[ this.engine ].temp && !dont_autocomplete ) this.engine = HC.suggestions; // Reset to a search upon input
{
//Add a tag to the summary box
setoptions(minor = 'true');
setreason('resolved slash dates', 'append');
doaction('diff');
}


this.state = CategoryEditor.CHANGE_PENDING;
function ohc_abbrev_edit_summary()  
var self = this;
{
window.setTimeout( function () {
//Add a tag to the summary box
self.textchange( dont_autocomplete );
setoptions(minor = 'true');
}, HC.suggest_delay );
setreason('abbrev month names', 'append');
},
doaction('diff');
}


makeForm: function () {
/** ------------------------------------------------------------------------ **/
var form = make( 'form' );
/// CUSTOMIZATION POINTS
form.method = 'POST';
function ohc_customize_all_to_dmy() {
form.onsubmit = this.accept.bind( this );
}
this.form = form;
var self = this;
var text = make( 'input' );
text.type = 'text';
text.size = HC.editbox_width;
if ( !noSuggestions ) {
// Be careful here to handle IME input. This is browser/OS/IME dependent, but basically there are two mechanisms:
// - Modern (DOM Level 3) browsers use compositionstart/compositionend events to signal composition; if the
//  composition is not canceled, there'll be a textInput event following. During a composition key events are
//  either all suppressed (FF/Gecko), or otherwise have keyDown === IME for all keys (Webkit).
//  - Webkit sends a textInput followed by keyDown === IME and a keyUp with the key that ended composition.
//  - Gecko doesn't send textInput but just a keyUp with the key that ended composition, without sending keyDown
//    first. Gecko doesn't send any keydown while IME is active.
// - Older browsers signal composition by keyDown === IME for the first and subsequent keys for a composition. The
//   first keyDown !== IME is certainly after the end of the composition. Typically, composition end can also be
//   detected by a keyDown IME with a keyUp of space, tab, escape, or return.
text.onkeyup = function ( evt ) {
var key = evt.keyCode || 0;
if ( self.ime && self.lastKey === IME && !self.usesComposition && ( key === TAB || key === RET || key === ESC || key === SPACE ) ) self.ime = false;


if ( self.ime ) return true;
function ohc_customize_all_to_mdy() {
}


if ( key === UP || key === DOWN || key === PGUP || key === PGDOWN ) {
function ohc_customize_body_to_dmy() {
// In case a browser doesn't generate keypress events for arrow keys...
}
if ( self.keyCount === 0 ) return self.processKey( evt );
} else {
if ( key === ESC && self.lastKey !== IME ) {
if ( !self.resetKeySelection() ) {
// No undo of key selection: treat ESC as "cancel".
self.cancel();
return;
}
}
// Also do this for ESC as a workaround for Firefox bug 524360
// https://bugzilla.mozilla.org/show_bug.cgi?id=524360
self.invokeSuggestions( key === BS || key === DEL || key === ESC );
}
return true;
};
text.onkeydown = function ( evt ) {
var key = evt.keyCode || 0;
self.lastKey = key;
self.keyCount = 0;
// DOM Level < 3 IME input
if ( !self.ime && key === IME && !self.usesComposition ) {
// self.usesComposition catches browsers that may emit spurious keydown IME after a composition has ended
self.ime = true;
} else if ( self.ime && key !== IME && !( key >= 16 && key <= 20 || key >= 91 && key <= 93 || key === 144 ) ) {
// Ignore control keys: ctrl, shift, alt, alt gr, caps lock, windows/apple cmd keys, num lock. Only the windows keys
// terminate IME (apple cmd doesn't), but they also cause a blur, so it's OK to ignore them here.
// Note: Safari 4 (530.17) propagates ESC out of an IME composition (observed at least on Win XP).
self.ime = false;
}
if ( self.ime ) return true;


// Handle return explicitly, to override the default form submission to be able to check for ctrl
function ohc_customize_body_to_mdy() {
if ( key === RET ) return self.accept( evt );
}


// Inhibit default behavior of ESC (revert to last real input in FF: we do that ourselves)
function ohc_customize_ISO_to_dmy() {
return ( key === ESC ) ? evtKill( evt ) : true;
}
};
// And handle continued pressing of arrow keys
text.onkeypress = function ( evt ) {
self.keyCount++;
return self.processKey( evt );
};
$( text ).on( 'focus', function () {
makeActive( self );
} );
// On IE, blur events are asynchronous, and may thus arrive after the element has lost the focus. Since IE
// can get the selection only while the element is active (has the focus), we may not always get the selection.
// Therefore, use an IE-specific synchronous event on IE...
// Don't test for text.selectionStart being defined;
$( text ).on(
( text.onbeforedeactivate !== undefined && text.createTextRange ) ? 'beforedeactivate' : 'blur',
this.saveView.bind( this ) );
// DOM Level 3 IME handling
try {
// Setting lastKey = IME provides a fake keyDown for Gecko's single keyUp after a cmposition. If we didn't do this,
// cancelling a composition via ESC would also cancel and close the whole category input editor.
$( text ).on( 'compositionstart', function () {
self.lastKey = IME;
self.usesComposition = true;
self.ime = true;
} );
$( text ).on( 'compositionend', function () {
self.lastKey = IME;
self.usesComposition = true;
self.ime = false;
} );
$( text ).on( 'textInput', function () {
self.ime = false;
self.invokeSuggestions( false );
} );
} catch ( any ) {
// Just in case some browsers might produce exceptions with these DOM Level 3 events
}
$( text ).on( 'blur', function () {
self.usesComposition = false;
self.ime = false;
} );
}
this.text = text;


this.icon = make( 'img' );
function ohc_customize_ISO_to_mdy() {
}


var list = null;
/** ------------------------------------------------------------------------ **/
if ( !noSuggestions ) {
function ohc_body_dates_to_dmy()  
list = make( 'select' );
{
list.onclick = function () {
ohc_use_dates_template('dmy');
if ( self.highlightSuggestion( 0 ) ) self.textchange( false, true );
};
list.ondblclick = function ( e ) {
if ( self.highlightSuggestion( 0 ) ) self.accept( e );
};
list.onchange = function () {
self.highlightSuggestion( 0 );
self.text.focus();
};
list.onkeyup = function ( evt ) {
if ( evt.keyCode === ESC ) {
self.resetKeySelection();
self.text.focus();
window.setTimeout( function () {
self.textchange( true );
}, HC.suggest_delay );
} else if ( evt.keyCode === RET ) {
self.accept( evt );
}
};
if ( !HC.fixed_search ) {
var engineSelector = make( 'select' );
for ( var key in suggestionConfigs ) {
if ( suggestionConfigs[ key ].show ) {
var opt = make( 'option' );
opt.value = key;
if ( key === this.engine ) opt.selected = true;


opt.appendChild( make( suggestionConfigs[ key ].name, true ) );
ohc_fix_common_errors();
engineSelector.appendChild( opt );
ohc_fix_dts_template('dmy');
}
ohc_fix_gr_template('dmy');
}
ohc_dates_to_dmy();
engineSelector.onchange = function () {
ohc_remove_leading_zeroes();
self.engine = self.engineSelector.options[ self.engineSelector.selectedIndex ].value;
ohc_fix_dmy_redundancies();
self.text.focus();
}
self.textchange( true, true ); // Don't autocomplete, force re-display of list
};
this.engineSelector = engineSelector;
}
}
this.list = list;


function button_label( id, defaultText ) {
function ohc_body_dates_to_mdy()  
var label = null;
{
if (
ohc_use_dates_template('mdy');
onUpload &&
ohc_fix_common_errors();
window.UFUI !== undefined &&
ohc_fix_dts_template('mdy');
window.UIElements !== undefined &&
ohc_fix_gr_template('mdy');
UFUI.getLabel instanceof Function
ohc_dates_to_mdy();
) {
ohc_remove_leading_zeroes();
try {
ohc_fix_mdy_redundancies();
label = UFUI.getLabel( id, true );
}
// Extract the plain text. IE doesn't know that Node.TEXT_NODE === 3
while ( label && label.nodeType !== 3 ) label = label.firstChild;
} catch ( ex ) {
label = null;
}
}
if ( !label || !label.data ) return defaultText;


return label.data;
/** ------------------------------------------------------------------------ **/
}
function ohc_all_to_dmy_driver(e)
{
e.preventDefault();
ohc_delink_dates();
ohc_protect_dates();
ohc_fix_unambiguous_dates();
ohc_body_dates_to_dmy();
ohc_delink_ISO_to_dmy();
ohc_delink_year_in_X();
ohc_customize_all_to_dmy();
ohc_ISO_to_dmy_in_citations();
ohc_unprotect_dates();


// Do not use type 'submit'; we cannot detect modifier keys if we do
ohc_MOSNUM_edit_summary();
var OK = make( 'input' );
}
OK.type = 'button';
OK.value = button_label( 'wpOkUploadLbl', HC.messages.ok );
OK.onclick = this.accept.bind( this );
this.ok = OK;


var cancel = make( 'input' );
function ohc_all_to_mdy_driver(e)
cancel.type = 'button';
{
cancel.value = button_label( 'wpCancelUploadLbl', HC.messages.cancel );
e.preventDefault();
cancel.onclick = this.cancel.bind( this );
ohc_delink_dates();
this.cancelButton = cancel;
ohc_protect_dates();
ohc_fix_unambiguous_dates();
ohc_body_dates_to_mdy();
ohc_delink_ISO_to_mdy();
ohc_delink_year_in_X();
ohc_customize_all_to_mdy();
ohc_ISO_to_mdy_in_citations();
ohc_unprotect_dates();


var span = make( 'span' );
ohc_MOSNUM_edit_summary();
span.className = 'hotcatinput';
}
span.style.position = 'relative';
span.appendChild( text );


// Support: IE8, IE9
function ohc_dmy_publication_dates_driver(e)
// Put some text into this span (a0 is nbsp) and make sure it always stays on the same
{
// line as the input field, otherwise, IE8/9 miscalculates the height of the span and
e.preventDefault();
// then the engine selector may overlap the input field.
// ohc_delink_dates();
span.appendChild( make( '\xa0', true ) );
ohc_protect_dates();
span.style.whiteSpace = 'nowrap';
ohc_body_dates_to_dmy();
ohc_customize_body_to_dmy();
ohc_dmy_publication_dates();
ohc_unprotect_dates();


if ( list ) span.appendChild( list );
ohc_MOSNUM_edit_summary();
}


if ( this.engineSelector ) span.appendChild( this.engineSelector );
function ohc_mdy_publication_dates_driver(e)
{
e.preventDefault();
// ohc_delink_dates();
ohc_protect_dates();
ohc_body_dates_to_mdy();
ohc_customize_body_to_mdy();
ohc_mdy_publication_dates();
ohc_unprotect_dates();


if ( !noSuggestions ) span.appendChild( this.icon );
ohc_MOSNUM_edit_summary();


span.appendChild( OK );
}
span.appendChild( cancel );
form.appendChild( span );
form.style.display = 'none';
this.span.appendChild( form );
},


display: function ( evt ) {
function ohc_body_to_dmy_driver(e)  
if ( this.isAddCategory && !onUpload && this.line ) {
{
// eslint-disable-next-line no-new
e.preventDefault();
new CategoryEditor( this.line, null, this.span, true ); // Create a new one
// ohc_delink_dates();
}
ohc_protect_dates_ref();
if ( !commitButton && !onUpload ) {
ohc_body_dates_to_dmy();
for ( var i = 0; i < editors.length; i++ ) {
ohc_customize_body_to_dmy();
if ( editors[ i ].state !== CategoryEditor.UNCHANGED ) {
ohc_unprotect_dates();
setMultiInput();
break;
}
}
}
if ( !this.form ) this.makeForm();


if ( this.list ) this.list.style.display = 'none';
ohc_MOSNUM_edit_summary();
}


if ( this.engineSelector ) this.engineSelector.style.display = 'none';
function ohc_body_to_mdy_driver(e)
{
e.preventDefault();
// ohc_delink_dates();
ohc_protect_dates_ref();
ohc_body_dates_to_mdy();
ohc_customize_body_to_mdy();
ohc_unprotect_dates();


this.currentCategory = this.lastSavedCategory;
ohc_MOSNUM_edit_summary();
this.currentExists = this.lastSavedExists;
}
this.currentHidden = this.lastSavedHidden;
this.currentKey = this.lastSavedKey;
this.icon.src = ( this.currentExists ? HC.existsYes : HC.existsNo );
this.text.value = this.currentCategory + ( this.currentKey !== null ? '|' + this.currentKey : '' );
this.originalState = this.state;
this.lastInput = this.currentCategory;
this.inputExists = this.currentExists;
this.state = this.state === CategoryEditor.UNCHANGED ? CategoryEditor.OPEN : CategoryEditor.CHANGE_PENDING;
this.lastSelection = {
start: this.currentCategory.length,
end: this.currentCategory.length
};
this.showsList = false;
// Display the form
if ( this.catLink ) this.catLink.style.display = 'none';


this.linkSpan.style.display = 'none';
function ohc_ISO_to_dmy_driver(e)
this.form.style.display = 'inline';
{
this.ok.disabled = false;
e.preventDefault();
// Kill the event before focussing, otherwise IE will kill the onfocus event!
ohc_protect_dates();
var result = evtKill( evt );
ohc_delink_ISO_to_dmy();
this.text.focus();
ohc_customize_ISO_to_dmy();
this.text.readOnly = false;
ohc_unprotect_dates();
checkMultiInput();
return result;
},


show: function ( evt, engine, readOnly ) {
// ohc_MOSNUM_edit_summary();
var result = this.display( evt );
}
var v = this.lastSavedCategory;
if ( !v.length ) return result;


this.text.readOnly = !!readOnly;
function ohc_ISO_to_mdy_driver(e) {
this.engine = engine;
e.preventDefault();
this.textchange( false, true ); // do autocompletion, force display of suggestions
ohc_protect_dates();
forceRedraw();
ohc_delink_ISO_to_mdy();
return result;
ohc_customize_ISO_to_mdy();
},
ohc_unprotect_dates();


open: function ( evt ) {
// ohc_MOSNUM_edit_summary();
return this.show( evt, ( this.engine && suggestionConfigs[ this.engine ].temp ) ? HC.suggestions : this.engine );
}
},


down: function ( evt ) {
function ohc_delink_year_in_X_driver(e)  
return this.show( evt, 'subcat', true );
{
},
e.preventDefault();
ohc_delink_year_in_X();
}


up: function ( evt ) {
function ohc_expand_ref_dates_driver(e) {
return this.show( evt, 'parentcat' );
e.preventDefault();
},
ohc_expand_ref_dates();
ohc_protect_dates();
ohc_unprotect_dates();
ohc_expand_edit_summary();
}


cancel: function () {
function ohc_expand_all_dates_driver(e)  
if ( this.isAddCategory && !onUpload ) {
{
this.removeEditor(); // We added a new adder when opening
e.preventDefault();
return;
ohc_expand_ref_dates();
}
ohc_protect_dates();
// Close, re-display link
ohc_expand_all_dates();
this.inactivate();
ohc_unprotect_dates();
this.form.style.display = 'none';
ohc_expand_edit_summary();
if ( this.catLink ) this.catLink.style.display = '';
}


this.linkSpan.style.display = '';
function ohc_abbrev_ref_dates_driver(e)
this.state = this.originalState;
{
this.currentCategory = this.lastSavedCategory;
e.preventDefault();
this.currentKey = this.lastSavedKey;
ohc_protect_dates();
this.currentExists = this.lastSavedExists;
ohc_abbrev_ref_dates();
this.currentHidden = this.lastSavedHidden;
ohc_unprotect_dates();
if ( this.catLink )
ohc_slash_edit_summary();
if ( this.currentKey && this.currentKey.length ) { this.catLink.title = this.currentKey; } else { this.catLink.title = ''; }
}


if ( this.state === CategoryEditor.UNCHANGED ) {
function ohc_UK_slash_dates_driver(e)  
if ( this.catLink ) this.catLink.style.backgroundColor = 'transparent';
{
} else {
e.preventDefault();
if ( !onUpload ) {
ohc_expand_ref_dates();
try {
ohc_protect_dates_slash();
this.catLink.style.backgroundColor = HC.bg_changed;
ohc_UK_slash_dates_to_dmy();
} catch ( ex ) {}
ohc_unprotect_dates();
}
ohc_slash_edit_summary();
}
}
checkMultiInput();
forceRedraw();
},


removeEditor: function () {
function ohc_US_slash_dates_driver(e)  
if ( !newDOM ) {
{
var next = this.span.nextSibling;
e.preventDefault();
if ( next ) next.parentNode.removeChild( next );
ohc_expand_ref_dates();
}
ohc_protect_dates_slash();
if (this.span && this.span.parentNode) {
ohc_US_slash_dates_to_mdy();
this.span.parentNode.removeChild( this.span );
ohc_unprotect_dates();
}
ohc_expand_edit_summary();
for ( var i = 0; i < editors.length; i++ ) {
}
if ( editors[ i ] === this ) {
editors.splice( i, 1 );
break;
}
}
checkMultiInput();
},


rollback: function ( evt ) {
// </pre>
this.undoLink.parentNode.removeChild( this.undoLink );
this.undoLink = null;
this.currentCategory = this.originalCategory;
this.currentKey = this.originalKey;
this.currentExists = this.originalExists;
this.currentHidden = this.originalHidden;
this.lastSavedCategory = this.originalCategory;
this.lastSavedKey = this.originalKey;
this.lastSavedExists = this.originalExists;
this.lastSavedHidden = this.originalHidden;
this.state = CategoryEditor.UNCHANGED;
if ( !this.currentCategory || !this.currentCategory.length ) {
// It was a newly added category. Remove the whole editor.
this.removeEditor();
} else {
// Redisplay the link...
this.catLink.removeChild( this.catLink.firstChild );
this.catLink.appendChild( make( this.currentCategory, true ) );
this.catLink.href = wikiPagePath( HC.category_canonical + ':' + this.currentCategory );
this.catLink.title = this.currentKey || '';
this.catLink.className = this.currentExists ? '' : 'new';
this.catLink.style.backgroundColor = 'transparent';
if ( this.upDownLinks ) this.upDownLinks.style.display = this.currentExists ? '' : 'none';


checkMultiInput();
//সংশ্লিষ্ট পাতা ত্যাগ না করেই অন্য পাতা থেকে পুনর্নির্দেশ করা যাবে।
//<nowiki>
( function () {
var redir = $(mw.util.addPortletLink('p-tb','#','পুনর্নির্দেশক','পুনর্নির্দেশ তৈরিকারী','পুনর্নির্দেশ তৈরিকারী','','#pt-mytalk'));
$( redir ).click( function() {
var redirec = prompt("যে পাতা থেকে এই পাতায় পুনর্নির্দেশ করতে চান তার নাম লিখুন:", "");
  if (redirec === null || redirec === "") {
alert( 'আপনি কোনও নাম প্রবেশ করান নি। দয়া করে আবার চেষ্টা করুন।' );  
  } else  {
  var params = {
action: 'edit',
title: redirec ,
createonly: 1,
prependtext: '#পুনর্নির্দেশ [[' + mw.config.get("wgPageName") + ']]',
appendtext: " \n" + '{{একটি পুনর্নির্দেশ}}',
summary: '[[' + mw.config.get("wgPageName") + ']] পাতায় পুনর্নির্দেশ করা হল' ,
format: 'json'
};
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
alert( 'সফলভাবে ' + redirec + ' পাতা থেকে একটি পুনর্নির্দেশ তৈরি করা হয়েছে!' );
});
  }
}
}
return evtKill( evt );
);
},
}() );
//</nowiki>


inactivate: function () {
//<nowiki>
if ( this.list ) this.list.style.display = 'none';
( function () {
 
var talkp = $(mw.util.addPortletLink('p-tb','#','স্বাগত জানান','স্বাগত জানান','স্বাগত জানান','','#pt-mytalk'));
if ( this.engineSelector ) this.engineSelector.style.display = 'none';
$( talkp ).click( function() {
 
var talk = prompt("কোন ধরনের স্বাগত বার্তা যুক্ত করতে চান এমন টেমপ্লেটটি লিখুন {{Subst:}} সাথে, অন্যথায় পূর্বনির্ধারিত {{Subst:স্বাগতম}} যুক্ত হবে:", "");
this.is_active = false;
  if (talk === null || talk === "") {
},
    var params1 = {
 
action: 'edit',
acceptCheck: function ( dontCheck ) {
title: 'User talk:' + mw.config.get("wgRelevantUserName"),
this.sanitizeInput();
prependtext: '{{Subst:স্বাগতম}}'
var value = this.text.value.split( '|' );
,
var key = null;
summary: 'ভারতপিডিয়ায় স্বাগতম!',
if ( value.length > 1 ) key = value[ 1 ];
format: 'json'
 
};
var v = value[ 0 ].replace( /_/g, ' ' ).replace( /^\s+|\s+$/g, '' );
api = new mw.Api();
if ( HC.capitalizePageNames ) v = capitalize( v );
 
api.postWithToken( 'csrf', params1 ).done( function ( data ) {
this.lastInput = v;
alert( 'সফলভাবে স্বাগত জানানো হয়েছে!' );
v = replaceShortcuts( v, HC.shortcuts );
if ( !v.length ) {
this.cancel();
return false;
}
if ( !dontCheck && (
conf.wgNamespaceNumber === 14 && v === conf.wgTitle || HC.blacklist && HC.blacklist.test( v ) ) ) {
this.cancel();
return false;
}
this.currentCategory = v;
this.currentKey = key;
this.currentExists = this.inputExists;
return true;
},
 
accept: function ( evt ) {
// eslint-disable-next-line no-bitwise
this.noCommit = ( evtKeys( evt ) & 1 ) !== 0;
var result = evtKill( evt );
if ( this.acceptCheck() ) {
var toResolve = [ this ];
var original = this.currentCategory;
resolveMulti( toResolve, function ( resolved ) {
if ( resolved[ 0 ].dab ) {
showDab( resolved[ 0 ] );
} else {
if ( resolved[ 0 ].acceptCheck( true ) ) {
resolved[ 0 ].commit(
( resolved[ 0 ].currentCategory !== original ) ?
HC.messages.cat_resolved.replace( /\$1/g, original ) :
null );
}
}
} );
}
return result;
},
 
close: function () {
if ( !this.catLink ) {
// Create a catLink
this.catLink = make( 'a' );
this.catLink.appendChild( make( 'foo', true ) );
this.catLink.style.display = 'none';
this.span.insertBefore( this.catLink, this.span.firstChild.nextSibling );
}
this.catLink.removeChild( this.catLink.firstChild );
this.catLink.appendChild( make( this.currentCategory, true ) );
this.catLink.href = wikiPagePath( HC.category_canonical + ':' + this.currentCategory );
this.catLink.className = this.currentExists ? '' : 'new';
this.lastSavedCategory = this.currentCategory;
this.lastSavedKey = this.currentKey;
this.lastSavedExists = this.currentExists;
this.lastSavedHidden = this.currentHidden;
// Close form and redisplay category
this.inactivate();
this.form.style.display = 'none';
this.catLink.title = this.currentKey || '';
this.catLink.style.display = '';
if ( this.isAddCategory ) {
if ( onUpload && this.line ) {
// eslint-disable-next-line no-new
new CategoryEditor( this.line, null, this.span, true ); // Create a new one
}
this.isAddCategory = false;
this.linkSpan.parentNode.removeChild( this.linkSpan );
this.makeLinkSpan();
this.span.appendChild( this.linkSpan );
}
if ( !this.undoLink ) {
// Append an undo link.
var span = make( 'span' );
var lk = make( 'a' );
lk.href = '#catlinks';
lk.onclick = this.rollback.bind( this );
lk.appendChild( make( HC.links.undo, true ) );
lk.title = HC.tooltips.undo;
span.appendChild( make( ' ', true ) );
span.appendChild( lk );
this.normalLinks.appendChild( span );
this.undoLink = span;
if ( !onUpload ) {
try {
this.catLink.style.backgroundColor = HC.bg_changed;
} catch ( ex ) {}
}
}
if ( this.upDownLinks ) this.upDownLinks.style.display = this.lastSavedExists ? '' : 'none';
 
this.linkSpan.style.display = '';
this.state = CategoryEditor.CHANGED;
checkMultiInput();
forceRedraw();
},
 
commit: function () {
// Check again to catch problem cases after redirect resolution
if (
(
this.currentCategory === this.originalCategory &&
(
this.currentKey === this.originalKey ||
this.currentKey === null && !this.originalKey.length
)
) ||
conf.wgNamespaceNumber === 14 && this.currentCategory === conf.wgTitle ||
HC.blacklist && HC.blacklist.test( this.currentCategory )
) {
this.cancel();
return;
}
this.close();
if ( !commitButton && !onUpload ) {
var self = this;
initiateEdit( function ( failure ) {
performChanges( failure, self );
}, function ( msg ) {
alert( msg );
} );
}
},
 
remove: function ( evt ) {
// eslint-disable-next-line no-bitwise
this.doRemove( evtKeys( evt ) & 1 );
return evtKill( evt );
},
 
doRemove: function ( noCommit ) {
if ( this.isAddCategory ) { // Empty input on adding a new category
this.cancel();
return;
}
if ( !commitButton && !onUpload ) {
for ( var i = 0; i < editors.length; i++ ) {
if ( editors[ i ].state !== CategoryEditor.UNCHANGED ) {
setMultiInput();
break;
}
}
}
if ( commitButton ) {
this.catLink.title = '';
this.catLink.style.cssText += '; text-decoration : line-through !important;';
try {
this.catLink.style.backgroundColor = HC.bg_changed;
} catch ( ex ) {}
this.originalState = this.state;
this.state = CategoryEditor.DELETED;
this.normalLinks.style.display = 'none';
this.undelLink.style.display = '';
checkMultiInput();
} else {
if ( onUpload ) {
// Remove this editor completely
this.removeEditor();
} else {
this.originalState = this.state;
this.state = CategoryEditor.DELETED;
this.noCommit = noCommit || HC.del_needs_diff;
var self = this;
initiateEdit(
function ( failure ) {
performChanges( failure, self );
},
function ( msg ) {
self.state = self.originalState;
alert( msg );
} );
}
}
},
 
restore: function ( evt ) {
// Can occur only if we do have a commit button and are not on the upload form
this.catLink.title = this.currentKey || '';
this.catLink.style.textDecoration = '';
this.state = this.originalState;
if ( this.state === CategoryEditor.UNCHANGED ) {
this.catLink.style.backgroundColor = 'transparent';
} else {
try {
this.catLink.style.backgroundColor = HC.bg_changed;
} catch ( ex ) {}
}
this.normalLinks.style.display = '';
this.undelLink.style.display = 'none';
checkMultiInput();
return evtKill( evt );
},
 
// Internal operations
 
selectEngine: function ( engineName ) {
if ( !this.engineSelector ) return;
for ( var i = 0; i < this.engineSelector.options.length; i++ ) this.engineSelector.options[ i ].selected = this.engineSelector.options[ i ].value === engineName;
},
 
sanitizeInput: function () {
var v = this.text.value || '';
v = v.replace( /^(\s|_)+/, '' ); // Trim leading blanks and underscores
var re = new RegExp( '^(' + HC.category_regexp + '):' );
if ( re.test( v ) ) v = v.substring( v.indexOf( ':' ) + 1 ).replace( /^(\s|_)+/, '' );
v = v.replace(/\u200E$/, ''); // Trim ending left-to-right mark
if ( HC.capitalizePageNames ) v = capitalize( v );
 
// Only update the input field if there is a difference. Various browsers otherwise
// reset the selection and cursor position after each value re-assignment.
if ( this.text.value !== null && this.text.value !== v ) this.text.value = v;
},
 
makeCall: function ( url, callbackObj, engine, queryKey, cleanKey ) {
var cb = callbackObj,
e = engine,
v = queryKey,
z = cleanKey,
thisObj = this;
 
function done() {
cb.callsMade++;
if ( cb.callsMade === cb.nofCalls ) {
if ( cb.exists ) cb.allTitles.exists = true;
 
if ( cb.normalized ) cb.allTitles.normalized = cb.normalized;
 
if ( !cb.dontCache && !suggestionConfigs[ cb.engineName ].cache[ z ] ) suggestionConfigs[ cb.engineName ].cache[ z ] = cb.allTitles;
 
thisObj.text.readOnly = false;
if ( !cb.cancelled ) thisObj.showSuggestions( cb.allTitles, cb.noCompletion, v, cb.engineName );
 
if ( cb === thisObj.callbackObj ) thisObj.callbackObj = null;
 
cb = undefined;
}
}
 
$.getJSON( url, function ( json ) {
var titles = e.handler( json, z );
if ( titles && titles.length ) {
if ( cb.allTitles === null ) cb.allTitles = titles; else cb.allTitles = cb.allTitles.concat( titles );
if ( titles.exists ) cb.exists = true;
if ( titles.normalized ) cb.normalized = titles.normalized;
}
done();
} ).fail( function ( req ) {
if ( !req ) noSuggestions = true;
cb.dontCache = true;
done();
} );
} );
},
 
 
  } else {
callbackObj: null,
  var params = {
 
action: 'edit',
textchange: function ( dont_autocomplete, force ) {
title: 'User talk:' + mw.config.get("wgRelevantUserName"),
// Hide all other lists
prependtext: talk
makeActive( this );
,
// Get input value, omit sort key, if any
summary: 'ভারতপিডিয়ায় স্বাগত!',
this.sanitizeInput();
format: 'json'
var v = this.text.value;
// Disregard anything after a pipe.
var pipe = v.indexOf( '|' );
if ( pipe >= 0 ) {
this.currentKey = v.substring( pipe + 1 );
v = v.substring( 0, pipe );
} else {
this.currentKey = null;
}
if ( this.lastInput === v && !force ) return; // No change
if ( this.lastInput !== v ) checkMultiInput();
 
this.lastInput = v;
this.lastRealInput = v;
 
// Mark blacklisted inputs.
this.ok.disabled = v.length && HC.blacklist && HC.blacklist.test( v );
 
if ( noSuggestions ) {
// No Ajax: just make sure the list is hidden
if ( this.list ) this.list.style.display = 'none';
if ( this.engineSelector ) this.engineSelector.style.display = 'none';
if ( this.icon ) this.icon.style.display = 'none';
return;
}
 
if ( !v.length ) {
this.showSuggestions( [] );
return;
}
var cleanKey = v.replace( /[\u200E\u200F\u202A-\u202E]/g, '' ).replace( wikiTextBlankRE, ' ' );
cleanKey = replaceShortcuts( cleanKey, HC.shortcuts );
cleanKey = cleanKey.replace( /^\s+|\s+$/g, '' );
if ( !cleanKey.length ) {
this.showSuggestions( [] );
return;
}
 
if ( this.callbackObj ) this.callbackObj.cancelled = true;
 
var engineName = suggestionConfigs[ this.engine ] ? this.engine : 'combined';
 
dont_autocomplete = dont_autocomplete || suggestionConfigs[ engineName ].noCompletion;
if ( suggestionConfigs[ engineName ].cache[ cleanKey ] ) {
this.showSuggestions( suggestionConfigs[ engineName ].cache[ cleanKey ], dont_autocomplete, v, engineName );
return;
}
 
var engines = suggestionConfigs[ engineName ].engines;
this.callbackObj = {
allTitles: null,
callsMade: 0,
nofCalls: engines.length,
noCompletion: dont_autocomplete,
engineName: engineName
};
this.makeCalls( engines, this.callbackObj, v, cleanKey );
},
 
makeCalls: function ( engines, cb, v, cleanKey ) {
for ( var j = 0; j < engines.length; j++ ) {
var engine = suggestionEngines[ engines[ j ] ];
var url = conf.wgServer + conf.wgScriptPath + engine.uri.replace( /\$1/g, encodeURIComponent( cleanKey ) );
this.makeCall( url, cb, engine, v, cleanKey );
}
},
 
showSuggestions: function ( titles, dontAutocomplete, queryKey, engineName ) {
this.text.readOnly = false;
this.dab = null;
this.showsList = false;
if ( !this.list ) return;
if ( noSuggestions ) {
if ( this.list ) this.list.style.display = 'none';
 
if ( this.engineSelector ) this.engineSelector.style.display = 'none';
 
if ( this.icon ) this.icon.style.display = 'none';
 
this.inputExists = true; // Default...
return;
}
this.engineName = engineName;
if ( engineName ) {
if ( !this.engineSelector ) this.engineName = null;
} else {
if ( this.engineSelector ) this.engineSelector.style.display = 'none';
}
if ( queryKey ) {
if ( this.lastInput.indexOf( queryKey ) ) return;
if ( this.lastQuery && this.lastInput.indexOf( this.lastQuery ) === 0 && this.lastQuery.length > queryKey.length ) return;
}
this.lastQuery = queryKey;
 
// Get current input text
var v = this.text.value.split( '|' );
var key = v.length > 1 ? '|' + v[ 1 ] : '';
v = ( HC.capitalizePageNames ? capitalize( v[ 0 ] ) : v[ 0 ] );
var vNormalized = v;
var knownToExist = titles && titles.exists;
var i;
if ( titles ) {
if ( titles.normalized && v.indexOf( queryKey ) === 0 ) {
// We got back a different normalization than what is in the input field
vNormalized = titles.normalized + v.substring( queryKey.length );
}
var vLow = vNormalized.toLowerCase();
// Strip blacklisted categories
if ( HC.blacklist ) {
for ( i = 0; i < titles.length; i++ ) {
if ( HC.blacklist.test( titles[ i ] ) ) {
titles.splice( i, 1 );
i--;
}
}
}
titles.sort(
function ( a, b ) {
if ( a === b ) return 0;
 
if ( a.indexOf( b ) === 0 ) return 1;
// a begins with b: a > b
if ( b.indexOf( a ) === 0 ) return -1;
// b begins with a: a < b
// Opensearch may return stuff not beginning with the search prefix!
var prefixMatchA = ( a.indexOf( vNormalized ) === 0 ? 1 : 0 );
var prefixMatchB = ( b.indexOf( vNormalized ) === 0 ? 1 : 0 );
if ( prefixMatchA !== prefixMatchB ) return prefixMatchB - prefixMatchA;
 
// Case-insensitive prefix match!
var aLow = a.toLowerCase(),
bLow = b.toLowerCase();
prefixMatchA = ( aLow.indexOf( vLow ) === 0 ? 1 : 0 );
prefixMatchB = ( bLow.indexOf( vLow ) === 0 ? 1 : 0 );
if ( prefixMatchA !== prefixMatchB ) return prefixMatchB - prefixMatchA;
 
if ( a < b ) return -1;
 
if ( b < a ) return 1;
 
return 0;
} );
// Remove duplicates and self-references
for ( i = 0; i < titles.length; i++ ) {
if (
i + 1 < titles.length && titles[ i ] === titles[ i + 1 ] ||
conf.wgNamespaceNumber === 14 && titles[ i ] === conf.wgTitle
) {
titles.splice( i, 1 );
i--;
}
}
}
if ( !titles || !titles.length ) {
if ( this.list ) this.list.style.display = 'none';
 
if ( this.engineSelector ) this.engineSelector.style.display = 'none';
 
if ( engineName && suggestionConfigs[ engineName ] && !suggestionConfigs[ engineName ].temp ) {
if ( this.icon ) this.icon.src = HC.existsNo;
 
this.inputExists = false;
}
return;
}
 
var firstTitle = titles[ 0 ];
var completed = this.autoComplete( firstTitle, v, vNormalized, key, dontAutocomplete );
var existing = completed || knownToExist || firstTitle === replaceShortcuts( v, HC.shortcuts );
if ( engineName && suggestionConfigs[ engineName ] && !suggestionConfigs[ engineName ].temp ) {
this.icon.src = ( existing ? HC.existsYes : HC.existsNo );
this.inputExists = existing;
}
if ( completed ) {
this.lastInput = firstTitle;
if ( titles.length === 1 ) {
this.list.style.display = 'none';
if ( this.engineSelector ) this.engineSelector.style.display = 'none';
 
return;
}
}
// (Re-)fill the list
while ( this.list.firstChild ) this.list.removeChild( this.list.firstChild );
 
for ( i = 0; i < titles.length; i++ ) {
var opt = make( 'option' );
opt.appendChild( make( titles[ i ], true ) );
opt.selected = completed && ( i === 0 );
this.list.appendChild( opt );
}
this.displayList();
},
 
displayList: function () {
this.showsList = true;
if ( !this.is_active ) {
this.list.style.display = 'none';
if ( this.engineSelector ) this.engineSelector.style.display = 'none';
 
return;
}
var nofItems = ( this.list.options.length > HC.listSize ? HC.listSize : this.list.options.length );
if ( nofItems <= 1 ) nofItems = 2;
 
this.list.size = nofItems;
this.list.style.align = is_rtl ? 'right' : 'left';
this.list.style.zIndex = 5;
this.list.style.position = 'absolute';
// Compute initial list position. First the height.
var anchor = is_rtl ? 'right' : 'left';
var listh = 0;
if ( this.list.style.display === 'none' ) {
// Off-screen display to get the height
this.list.style.top = this.text.offsetTop + 'px';
this.list.style[ anchor ] = '-10000px';
this.list.style.display = '';
listh = this.list.offsetHeight;
this.list.style.display = 'none';
} else {
listh = this.list.offsetHeight;
}
// Approximate calculation of maximum list size
var maxListHeight = listh;
if ( nofItems < HC.listSize ) maxListHeight = ( listh / nofItems ) * HC.listSize;
 
function viewport( what ) {
if ( is_webkit && !document.evaluate ) {
// Safari < 3.0
return window[ 'inner' + what ];
}
var s = 'client' + what;
if ( window.opera ) return document.body[ s ];
 
return ( document.documentElement ? document.documentElement[ s ] : 0 ) || document.body[ s ] || 0;
}
function scroll_offset( what ) {
var s = 'scroll' + what;
var result = ( document.documentElement ? document.documentElement[ s ] : 0 ) || document.body[ s ] || 0;
if ( is_rtl && what === 'Left' ) {
// RTL inconsistencies.
// FF: 0 at the far right, then increasingly negative values.
// IE >= 8: 0 at the far right, then increasingly positive values.
// Webkit: scrollWidth - clientWidth at the far right, then down to zero.
// Opera: don't know...
if ( result < 0 ) result = -result;
 
if ( !is_webkit ) result = scroll_offset( 'Width' ) - viewport( 'Width' ) - result;
 
// Now all have webkit behavior, i.e. zero if at the leftmost edge.
}
return result;
}
function position( node ) {
// Stripped-down simplified position function. It's good enough for our purposes.
if ( node.getBoundingClientRect ) {
var box = node.getBoundingClientRect();
return {
x: Math.round( box.left + scroll_offset( 'Left' ) ),
y: Math.round( box.top + scroll_offset( 'Top' ) )
};
}
var t = 0,
l = 0;
do {
t += ( node.offsetTop || 0 );
l += ( node.offsetLeft || 0 );
node = node.offsetParent;
} while ( node );
return {
x: l,
y: t
};
};
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
alert( 'সফলভাবে স্বাগত জানানো হয়েছে!' );
} );
  }
}
}
 
);
var textPos = position( this.text ),
}() );
nl = 0,
//</nowiki>
nt = 0,
//<nowiki>
offset = 0,
console.time('mobileUndo');
// Opera 9.5 somehow has offsetWidth = 0 here?? Use the next best value...
$.when(mw.loader.using(['mediawiki.util', 'mediawiki.api', 'oojs-ui-windows', 'oojs-ui-core', 'oojs-ui.styles.icons-editing-core'])).then(function() {
textBoxWidth = this.text.offsetWidth || this.text.clientWidth;
    return new mw.Api().getMessages(['editundo', 'Undo-nochange']);
if ( this.engineName ) {
}).then(function(globalmessages) {
this.engineSelector.style.zIndex = 5;
    var mobileUndo, i18n_lang = mw.config.get('wgUserLanguage');
this.engineSelector.style.position = 'absolute';
    var i18n = {
this.engineSelector.style.width = textBoxWidth + 'px';
        "en": {
// Figure out the height of this selector: display it off-screen, then hide it again.
            "mu-success": "Successful",
if ( this.engineSelector.style.display === 'none' ) {
            "mu-fail": "Failed",
this.engineSelector.style[ anchor ] = '-10000px';
            "mu-loading": "Loading...",
this.engineSelector.style.top = '0';
            "editsummary-ad": "",
this.engineSelector.style.display = '';
            "mu-undo-successful": "Revert successful.... Reloading in a sec",
offset = this.engineSelector.offsetHeight;
            "mu-empty-reponse-from-server": "An empty response was received from the server",
this.engineSelector.style.display = 'none';
            "mu-edit-summary-prompt": "Add a reason to your edit summary !",
} else {
            "mu-edit-summary-prompt-placeholder": "Reason...",
offset = this.engineSelector.offsetHeight;
            "mu-thank-success": "Thanked",
}
            "mu-thank-confirm": "Send public thanks ?",
this.engineSelector.style[ anchor ] = nl + 'px';
            "mu-thank-loading": "Thanking...",
}
            "mu-thank-successful": "You thanked $1.",
if ( textPos.y < maxListHeight + offset + 1 ) {
            "mu-thank-failed": "Failed to thank $1.",
// The list might extend beyond the upper border of the page. Let's avoid that by placing it
            "mu-http-error":"HTTP error: "
// below the input text field.
        },
nt = this.text.offsetHeight + offset + 1;
        "bn": {
if ( this.engineName ) this.engineSelector.style.top = this.text.offsetHeight + 'px';
            "mu-success": "সফল",
} else {
            "mu-fail": "ব্যর্থ হয়েছে",
nt = -listh - offset - 1;
            "mu-loading": "লোড করা হচ্ছে...",
if ( this.engineName ) this.engineSelector.style.top = -( offset + 1 ) + 'px';
            "editsummary-ad": "",
}
            "mu-undo-successful": "পূর্বাবস্থায় ফেরত যাওয়া সফল হয়েছে.... পুনঃলোড করা হচ্ছে",
this.list.style.top = nt + 'px';
            "mu-empty-reponse-from-server": "সার্ভার থেকে একটি খালি প্রতিক্রিয়া পাওয়া গেছে।",
this.list.style.width = ''; // No fixed width (yet)
            "mu-edit-summary-prompt": "সম্পাদনা সারাংশে কারণ উল্লেখ করুন!",
this.list.style[ anchor ] = nl + 'px';
            "mu-edit-summary-prompt-placeholder": "কারণ...",
if ( this.engineName ) {
            "mu-thank-success": "ধন্যবাদ দিয়েছেন",
this.selectEngine( this.engineName );
            "mu-thank-confirm": "প্রকাশ্য ধন্যবাদ জানাবেন?",
this.engineSelector.style.display = '';
            "mu-thank-loading": "ধন্যবাদ জানানো হচ্ছে...",
}
            "mu-thank-successful": "আপনি $1 কে ধন্যবাদ জানিয়েছেন।",
this.list.style.display = 'block';
            "mu-thank-failed": "$1 কে ধন্যবাদ জানানো ব্যর্থ হয়েছে।",
// Set the width of the list
            "mu-http-error":"HTTP ত্রুটি: "
if ( this.list.offsetWidth < textBoxWidth ) {
        }
this.list.style.width = textBoxWidth + 'px';
    };
return;
if(undefined === i18n[i18n_lang]){
}
i18n_lang = 'en';
// If the list is wider than the textbox: make sure it fits horizontally into the browser window
var scroll = scroll_offset( 'Left' );
var view_w = viewport( 'Width' );
var w = this.list.offsetWidth;
var l_pos = position( this.list );
var left = l_pos.x;
var right = left + w;
if ( left < scroll || right > scroll + view_w ) {
if ( w > view_w ) {
w = view_w;
this.list.style.width = w + 'px';
if ( is_rtl ) left = right - w; else right = left + w;
}
var relative_offset = 0;
if ( left < scroll ) relative_offset = scroll - left; else if ( right > scroll + view_w ) relative_offset = -( right - scroll - view_w );
 
if ( is_rtl ) relative_offset = -relative_offset;
 
if ( relative_offset ) this.list.style[ anchor ] = ( nl + relative_offset ) + 'px';
}
},
 
autoComplete: function ( newVal, actVal, normalizedActVal, key, dontModify ) {
if ( newVal === actVal ) return true;
 
if ( dontModify || this.ime || !this.canSelect() ) return false;
 
// If we can't select properly or an IME composition is ongoing, autocompletion would be a major annoyance to the user.
if ( newVal.indexOf( actVal ) ) {
// Maybe it'll work with the normalized value (NFC)?
if ( normalizedActVal && newVal.indexOf( normalizedActVal ) === 0 ) {
if ( this.lastRealInput === actVal ) this.lastRealInput = normalizedActVal;
 
actVal = normalizedActVal;
} else {
return false;
}
}
// Actual input is a prefix of the new text. Fill in new text, selecting the newly added suffix
// such that it can be easily removed by typing backspace if the suggestion is unwanted.
this.text.focus();
this.text.value = newVal + key;
this.setSelection( actVal.length, newVal.length );
return true;
},
 
canSelect: function () {
return this.text.setSelectionRange ||
this.text.createTextRange ||
this.text.selectionStart !== undefined &&
this.text.selectionEnd !== undefined;
},
 
setSelection: function ( from, to ) {
// this.text must be focused (at least on IE)
if ( !this.text.value ) return;
if ( this.text.setSelectionRange ) { // e.g. khtml
this.text.setSelectionRange( from, to );
} else if ( this.text.selectionStart !== undefined ) {
if ( from > this.text.selectionStart ) {
this.text.selectionEnd = to;
this.text.selectionStart = from;
} else {
this.text.selectionStart = from;
this.text.selectionEnd = to;
}
} else if ( this.text.createTextRange ) { // IE
var new_selection = this.text.createTextRange();
new_selection.move( 'character', from );
new_selection.moveEnd( 'character', to - from );
new_selection.select();
}
},
 
getSelection: function () {
var from = 0,
to = 0;
// this.text must be focused (at least on IE)
if ( !this.text.value ) {
// No text.
} else if ( this.text.selectionStart !== undefined ) {
from = this.text.selectionStart;
to = this.text.selectionEnd;
} else if ( document.selection && document.selection.createRange ) { // IE
var rng = document.selection.createRange().duplicate();
if ( rng.parentElement() === this.text ) {
try {
var textRng = this.text.createTextRange();
textRng.move( 'character', 0 );
textRng.setEndPoint( 'EndToEnd', rng );
// We're in a single-line input box: no need to care about IE's strange
// handling of line ends
to = textRng.text.length;
textRng.setEndPoint( 'EndToStart', rng );
from = textRng.text.length;
} catch ( notFocused ) {
from = this.text.value.length;
to = from; // At end of text
}
}
}
return {
start: from,
end: to
};
},
 
saveView: function () {
this.lastSelection = this.getSelection();
},
 
processKey: function ( evt ) {
var dir = 0;
switch ( this.lastKey ) {
case UP:
dir = -1;
break;
case DOWN:
dir = 1;
break;
case PGUP:
dir = -HC.listSize;
break;
case PGDOWN:
dir = HC.listSize;
break;
case ESC: // Inhibit default behavior (revert to last real input in FF: we do that ourselves)
return evtKill( evt );
}
if ( dir ) {
if ( this.list.style.display !== 'none' ) {
// List is visible, so there are suggestions
this.highlightSuggestion( dir );
// Kill the event, otherwise some browsers (e.g., Firefox) may additionally treat an up-arrow
// as "place the text cursor at the front", which we don't want here.
return evtKill( evt );
} else if (
this.keyCount <= 1 &&
( !this.callbackObj || this.callbackObj.callsMade === this.callbackObj.nofCalls )
) {
// If no suggestions displayed, get them, unless we're already getting them.
this.textchange();
}
}
return true;
},
 
highlightSuggestion: function ( dir ) {
if ( noSuggestions || !this.list || this.list.style.display === 'none' ) return false;
 
var curr = this.list.selectedIndex;
var tgt = -1;
if ( dir === 0 ) {
if ( curr < 0 || curr >= this.list.options.length ) return false;
 
tgt = curr;
} else {
tgt = curr < 0 ? 0 : curr + dir;
tgt = tgt < 0 ? 0 : tgt;
if ( tgt >= this.list.options.length ) tgt = this.list.options.length - 1;
}
if ( tgt !== curr || dir === 0 ) {
if ( curr >= 0 && curr < this.list.options.length && dir !== 0 ) this.list.options[ curr ].selected = false;
 
this.list.options[ tgt ].selected = true;
// Get current input text
var v = this.text.value.split( '|' );
var key = v.length > 1 ? '|' + v[ 1 ] : '';
var completed = this.autoComplete( this.list.options[ tgt ].text, this.lastRealInput, null, key, false );
if ( !completed || this.list.options[ tgt ].text === this.lastRealInput ) {
this.text.value = this.list.options[ tgt ].text + key;
if ( this.canSelect() ) this.setSelection( this.list.options[ tgt ].text.length, this.list.options[ tgt ].text.length );
}
this.lastInput = this.list.options[ tgt ].text;
this.inputExists = true; // Might be wrong if from a dab list...
if ( this.icon ) this.icon.src = HC.existsYes;
 
this.state = CategoryEditor.CHANGE_PENDING;
}
return true;
},
 
resetKeySelection: function () {
if ( noSuggestions || !this.list || this.list.style.display === 'none' ) return false;
 
var curr = this.list.selectedIndex;
if ( curr >= 0 && curr < this.list.options.length ) {
this.list.options[ curr ].selected = false;
// Get current input text
var v = this.text.value.split( '|' );
var key = v.length > 1 ? '|' + v[ 1 ] : '';
// ESC is handled strangely by some browsers (e.g., FF); somehow it resets the input value before
// our event handlers ever get a chance to run.
var result = v[ 0 ] !== this.lastInput;
if ( v[ 0 ] !== this.lastRealInput ) {
this.text.value = this.lastRealInput + key;
result = true;
}
this.lastInput = this.lastRealInput;
return result;
}
return false;
}
}; // end CategoryEditor.prototype
 
function initialize() {
// User configurations: Do this here, called from the onload handler, so that users can
// override it easily in their own user script files by just declaring variables. JSconfig
// is some feature used at Wikimedia Commons.
var config = ( window.JSconfig !== undefined && JSconfig.keys ) ? JSconfig.keys : {};
HC.dont_add_to_watchlist = ( window.hotcat_dont_add_to_watchlist !== undefined ?
!!window.hotcat_dont_add_to_watchlist :
( config.HotCatDontAddToWatchlist !== undefined ? config.HotCatDontAddToWatchlist :
HC.dont_add_to_watchlist ) );
HC.no_autocommit = ( window.hotcat_no_autocommit !== undefined ?
!!window.hotcat_no_autocommit : ( config.HotCatNoAutoCommit !== undefined ?
config.HotCatNoAutoCommit :
// On talk namespace default autocommit off
( conf.wgNamespaceNumber % 2 ?
true : HC.no_autocommit ) ) );
HC.del_needs_diff = ( window.hotcat_del_needs_diff !== undefined ?
!!window.hotcat_del_needs_diff :
( config.HotCatDelNeedsDiff !== undefined ?
config.HotCatDelNeedsDiff :
HC.del_needs_diff ) );
HC.suggest_delay = window.hotcat_suggestion_delay || config.HotCatSuggestionDelay || HC.suggest_delay;
HC.editbox_width = window.hotcat_editbox_width || config.HotCatEditBoxWidth || HC.editbox_width;
HC.suggestions = window.hotcat_suggestions || config.HotCatSuggestions || HC.suggestions;
if ( typeof HC.suggestions !== 'string' || !suggestionConfigs[ HC.suggestions ] ) HC.suggestions = 'combined';
 
HC.fixed_search = ( window.hotcat_suggestions_fixed !== undefined ?
!!window.hotcat_suggestions_fixed : ( config.HotCatFixedSuggestions !== undefined ?
config.HotCatFixedSuggestions : HC.fixed_search ) );
HC.single_minor = ( window.hotcat_single_changes_are_minor !== undefined ?
!!window.hotcat_single_changes_are_minor :
( config.HotCatMinorSingleChanges !== undefined ?
config.HotCatMinorSingleChanges :
HC.single_minor ) );
HC.bg_changed = window.hotcat_changed_background || config.HotCatChangedBackground || HC.bg_changed;
HC.use_up_down = ( window.hotcat_use_category_links !== undefined ?
!!window.hotcat_use_category_links :
( config.HotCatUseCategoryLinks !== undefined ?
config.HotCatUseCategoryLinks :
HC.use_up_down ) );
HC.listSize = window.hotcat_list_size || config.HotCatListSize || HC.listSize;
if ( conf.wgDBname !== 'commonswiki' ) HC.changeTag = config.HotCatChangeTag || '';
 
// The next whole shebang is needed, because manual tags get not submitted except of save
if ( HC.changeTag ) {
var eForm = document.editform,
catRegExp = new RegExp( '^\\[\\[(' + HC.category_regexp + '):' ),
oldTxt;
// Returns true if minor change
var isMinorChange = function () {
var newTxt = eForm.wpTextbox1;
if ( !newTxt ) return;
newTxt = newTxt.value;
var oldLines = oldTxt.match( /^.*$/gm ),
newLines = newTxt.match( /^.*$/gm ),
cArr; // changes
var except = function ( aArr, bArr ) {
var result = [],
lArr, // larger
sArr; // smaller
if ( aArr.length < bArr.length ) {
lArr = bArr;
sArr = aArr;
} else {
lArr = aArr;
sArr = bArr;
}
for ( var i = 0; i < lArr.length; i++ ) {
var item = lArr[ i ];
var ind = $.inArray( item, sArr );
if ( ind === -1 ) result.push( item );
else sArr.splice( ind, 1 ); // don't check this item again
}
return result.concat( sArr );
};
cArr = except( oldLines, newLines );
if ( cArr.length ) {
cArr = $.grep( cArr, function ( c ) {
c = $.trim( c );
return ( c && !catRegExp.test( c ) );
} );
}
if ( !cArr.length ) {
oldTxt = newTxt;
return true;
}
};
 
if ( conf.wgAction === 'submit' && conf.wgArticleId && eForm && eForm.wpSummary && document.getElementById( 'wikiDiff' ) ) {
var sum = eForm.wpSummary,
sumA = eForm.wpAutoSummary;
if ( sum.value && sumA.value === HC.changeTag ) { // HotCat diff
// MD5 hash of the empty string, as HotCat edit is based on empty sum
sumA.value = sumA.value.replace( HC.changeTag, 'd41d8cd98f00b204e9800998ecf8427e' );
// Attr creation and event handling is not same in all (old) browsers so use $
var $ct = $( '<input type="hidden" name="wpChangeTags">' ).val( HC.changeTag );
$( eForm ).append( $ct );
oldTxt = eForm.wpTextbox1.value;
$( '#wpSave' ).one( 'click', function () {
if ( $ct.val() )
sum.value = sum.value.replace( ( HC.messages.using || HC.messages.prefix ), '' );
 
} );
var removeChangeTag = function () {
$( eForm.wpTextbox1 ).add( sum ).one( 'input', function () {
window.setTimeout( function () {
if ( !isMinorChange() ) $ct.val( '' );
else removeChangeTag();
}, 500 );
} );
};
removeChangeTag();
}
}
}
// Numeric input, make sure we have a numeric value
HC.listSize = parseInt( HC.listSize, 10 );
if ( isNaN( HC.listSize ) || HC.listSize < 5 ) HC.listSize = 5;
 
HC.listSize = Math.min( HC.listSize, 30 ); // Max size
 
// Localize search engine names
if ( HC.engine_names ) {
for ( var key in HC.engine_names )
if ( suggestionConfigs[ key ] && HC.engine_names[ key ] ) suggestionConfigs[ key ].name = HC.engine_names[ key ];
 
}
// Catch both native RTL and "faked" RTL through [[MediaWiki:Rtl.js]]
is_rtl = hasClass( document.body, 'rtl' );
if ( !is_rtl ) {
if ( document.defaultView && document.defaultView.getComputedStyle ) { // Gecko etc.
is_rtl = document.defaultView.getComputedStyle( document.body, null ).getPropertyValue( 'direction' );
} else if ( document.body.currentStyle ) { // IE, has subtle differences to getComputedStyle
is_rtl = document.body.currentStyle.direction;
} else { // Not exactly right, but best effort
is_rtl = document.body.style.direction;
}
is_rtl = ( is_rtl === 'rtl' );
}
}
}
 
    if (mw.config.get('wgCanonicalSpecialPageName') === 'MobileDiff') {
function can_edit() {
        mw.util.addCSS('#mw-mf-userinfo .mobileUndo-ui .mw-ui-icon.mw-ui-icon-before:before{display:none;}\n#mobileUndo > a > span.oo-ui-iconElement-icon.oo-ui-icon-editUndo.oo-ui-image-invert{display:inline-block; position:initial;}\n#mobileUndo > a{padding:0.57142857em 0.9375em;}'+
var container = null;
        '#mw-mf-userinfo > div > div.mobileUndo-ui > a > div{line-height:normal;}');
switch ( mw.config.get( 'skin' ) ) {
        if (mw.config.get('wgVisualEditor').pageLanguageDir === 'ltr') {
case 'cologneblue':
            $('#mw-mf-userinfo .post-content').append($('<div>').attr('class', 'mobileUndo-ui').css({
container = document.getElementById( 'quickbar' );
                'display': 'inline-block',
/* fall through */
                'float': 'right'
case 'standard':
            }));
case 'nostalgia':
        } else {
if ( !container ) container = document.getElementById( 'topbar' );
            $('#mw-mf-userinfo .post-content').append($('<div>').attr('class', 'mobileUndo-ui').css({
var lks = container.getElementsByTagName( 'a' );
                'display': 'inline-block',
for ( var i = 0; i < lks.length; i++ ) {
                'float': 'left'
if (
            }));
param( 'title', lks[ i ].href ) === conf.wgPageName &&
        }
param( 'action', lks[ i ].href ) === 'edit'
        $('.mobileUndo-ui').append($('.mw-mf-action-button').remove().css({
) {
            'clear': 'none'
return true;
        }));
}
        if (!$('.warningbox').length && mw.config.get('wgRelevantPageIsProbablyEditable')) {
}
            mobileUndo = new OO.ui.ButtonWidget({
return false;
                label: (globalmessages.editundo).charAt(0).toUpperCase() + (globalmessages.editundo).slice(1),
default:
                icon: 'editUndo',
// all modern skins:
                title: 'mobileUndo',
return document.getElementById( 'ca-edit' ) !== null;
                flags: ['destructive', 'primary'],
}
                id: 'mobileUndo'
}
            });
 
            $('.mobileUndo-ui').append(mobileUndo.$element);
// Legacy stuff
            if (mw.config.get('wgVisualEditor').pageLanguageDir === 'ltr') {
function closeForm() {
                $('#mobileUndo').css('margin-right', '0.3em');
// Close all open editors without redirect resolution and other asynchronous stuff.
            } else {
for ( var i = 0; i < editors.length; i++ ) {
                $('#mobileUndo').css('margin-left', '0.3em');
var edit = editors[ i ];
            }
if ( edit.state === CategoryEditor.OPEN ) {
        }
edit.cancel();
        window.wgRelevantUser = function() {
} else if ( edit.state === CategoryEditor.CHANGE_PENDING ) {
            var user;
edit.sanitizeInput();
            if ($('.mw-mf-user-link').text() !== '') {
var value = edit.text.value.split( '|' );
                user = $('.mw-mf-user-link').text();
var key = null;
            } else {
if ( value.length > 1 ) key = value[ 1 ];
                user = $('#mw-mf-userinfo .post-content div:nth-child(2)').text();
var v = value[ 0 ].replace( /_/g, ' ' ).replace( /^\s+|\s+$/g, '' );
            }
if ( !v.length ) {
            return user;
edit.cancel();
        };
} else {
        window.wgRevId = ($('#mw-mf-diffarea > div.mw-mf-diff-info > h3 > a').attr('href')).split('&oldid=')[1];
edit.currentCategory = v;
        var revId = wgRevId;
edit.currentKey = key;
        console.log(revId);
edit.currentExists = this.inputExists;
        var username = wgRelevantUser();
edit.close();
        $('#mw-mf-userinfo .post-content .mobileUndo-ui .mw-mf-action-button').click(function(e) {
}
            e.preventDefault();
}
            OO.ui.confirm(i18n[i18n_lang]['mu-thank-confirm']).done(function(confirmed) {
}
                if (confirmed) {
}
                    $('.mw-mf-action-button').css('pointer-events', 'none').text(i18n[i18n_lang]['mu-thank-loading']);
 
                    var api = new mw.Api();
function setup_upload() {
                    api.postWithToken('csrf', {
onUpload = true;
                        action: "thank",
// Add an empty category bar at the end of the table containing the description, and change the onsubmit handler.
                        rev: revId,
var ip = document.getElementById( 'mw-htmlform-description' ) || document.getElementById( 'wpDestFile' );
                    }).done(function(result) {
if ( !ip ) {
                        mw.notify((i18n[i18n_lang]['mu-thank-successful']).replace(/\$1/g, username));
ip = document.getElementById( 'wpDestFile' );
                        $('.mw-mf-action-button').text(i18n[i18n_lang]['mu-thank-success']);
while ( ip && ip.nodeName.toLowerCase() !== 'table' ) ip = ip.parentNode;
                    }).fail(function() {
}
                        mw.notify((i18n[i18n_lang]['mu-thank-failed']).replace(/\$1/g, username));
if ( !ip ) return;
                        $('.mw-mf-action-button').text(i18n[i18n_lang]['mu-failed']);
var reupload = document.getElementById( 'wpForReUpload' );
                    });
var destFile = document.getElementById( 'wpDestFile' );
                }
if (
            });
( reupload && !!reupload.value ) ||
        });
( destFile && ( destFile.disabled || destFile.readOnly ) )
        console.timeEnd('mobileUndo');
) {
        mobileUndo.on('click', function() {
return; // re-upload form...
            OO.ui.prompt(i18n[i18n_lang]['mu-edit-summary-prompt'], {
}
                textInput: {
// Insert a table row with two fields (label and empty category bar)
                    placeholder: i18n[i18n_lang]['mu-edit-summary-prompt-placeholder']
var labelCell = make( 'td' );
                }
var lineCell = make( 'td' );
            }).done(function(customEditSummary) {
// Create the category line
                $.when(mw.loader.using('mediawiki.api')).then(function() {
catLine = make( 'div' );
                    return new mw.Api().getMessages(['undo-summary'], {
catLine.className = 'catlinks';
                        amlang: mw.config.get('wgServerName').split('.wik')[0]
catLine.id = 'catlinks';
                    });
catLine.style.textAlign = is_rtl ? 'right' : 'left';
                }).then(function(message) {
// We'll be inside a table row. Make sure that we don't have margins or strange borders.
                    var editSummaryMessage = message['undo-summary'];
catLine.style.margin = '0';
                    var editSummary = editSummaryMessage.replace(/\$1/g, revId);
catLine.style.border = 'none';
                    editSummary = editSummary.replace(/\$2/g, username);
lineCell.appendChild( catLine );
                    if (customEditSummary !== null) {
// Create the label
                        mobileUndo.setDisabled(true);
var label = null;
                        editSummary = editSummary + ' ' + customEditSummary + (i18n[i18n_lang]['editsummary-ad']);
if ( window.UFUI && window.UIElements && UFUI.getLabel instanceof Function ) {
                        //call the API
try {
                        var api = new mw.Api({
label = UFUI.getLabel( 'wpCategoriesUploadLbl' );
                            ajax: {
} catch ( ex ) {
                                headers: {
label = null;
                                    'Api-User-Agent': 'mobileUndo/2.0.2(https://en.wikipedia.org/wiki/User:FR30799386/undo.js)'
}
                                }
}
                            }
if ( !label ) {
                        });
labelCell.id = 'hotcatLabel';
                        //Feedback UI
labelCell.appendChild( make( HC.categories, true ) );
                        mobileUndo.setLabel(i18n[i18n_lang]['mu-loading']);
} else {
                        api.postWithToken('csrf', {
labelCell.id = 'hotcatLabelTranslated';
                            action: "edit",
labelCell.appendChild( label );
                            title: mw.config.get('wgRelevantPageName'),
}
                            summary: editSummary,
labelCell.className = 'mw-label';
                            undo: revId,
labelCell.style.textAlign = 'right';
                        }).done(function(result) {
labelCell.style.verticalAlign = 'middle';
                            if (result.edit.code === 'abusefilter-warning' || result.edit.code === 'abusefilter-disallowed') {
// Change the onsubmit handler
                                mobileUndo.setLabel(i18n[i18n_lang]['mu-fail']);
var form = document.getElementById( 'upload' ) || document.getElementById( 'mw-upload-form' );
                                OO.ui.alert($('<p>').html(result.edit.warning), {
if ( form ) {
                                    title: result.edit.info
var newRow = ip.insertRow( -1 );
                                }).done(function() {});
newRow.appendChild( labelCell );
                                return;
newRow.appendChild( lineCell );
                            } else if (typeof result.edit.nochange !== 'undefined') {
form.onsubmit = ( function ( oldSubmit ) {
                                mobileUndo.setLabel(i18n[i18n_lang]['mu-fail']);
return function () {
                                OO.ui.alert($('<p>').html(globalmessages['Undo-nochange'])).done(function() {});
var do_submit = true;
                                return;
if ( oldSubmit ) {
                            }
if ( typeof oldSubmit === 'string' ) {
                            console.log(result);
// eslint-disable-next-line no-eval
                            mobileUndo.setLabel(i18n[i18n_lang]['mu-success']);
do_submit = eval( oldSubmit );
                            mw.notify(i18n[i18n_lang]['mu-undo-successful']);
} else if ( oldSubmit instanceof Function ) {
                            setTimeout(function() {
do_submit = oldSubmit.apply( form, arguments );
                                location.href = mw.util.getUrl('Special:MobileDiff/' + result.edit.newrevid);
}
                            }, 1500);
}
                        }).fail(function(code, jqxhr) {
if ( !do_submit ) return false;
                            mobileUndo.setLabel(i18n[i18n_lang]['mu-fail']);
closeForm();
                            var details;
// Copy the categories
                            if (code === 'http' && jqxhr.textStatus === 'error') {
var eb = document.getElementById( 'wpUploadDescription' ) || document.getElementById( 'wpDesc' );
                                details = i18n[i18n_lang]['mu-http-error'] + jqxhr.xhr.status;
var addedOne = false;
                            } else if (code === 'http') {
for ( var i = 0; i < editors.length; i++ ) {
                                details = i18n[i18n_lang]['mu-http-error'] + jqxhr.textStatus;
var t = editors[ i ].currentCategory;
                            } else if (code === 'ok-but-empty') {
if ( !t ) continue;
                                details = i18n[i18n_lang]['mu-empty response-from-server'];
var key = editors[ i ].currentKey;
                            } else {
var new_cat = '[[' + HC.category_canonical + ':' + t + ( key ? '|' + key : '' ) + ']]';
                                details = jqxhr.error.info;
// Only add if not already present
                            }
var cleanedText = eb.value
                            OO.ui.alert($('<p>').html(details)).done(function() {});
.replace( /<!--(\s|\S)*?-->/g, '' )
                        });
.replace( /<nowiki>(\s|\S)*?<\/nowiki>/g, '' );
                    }
if ( !find_category( cleanedText, t, true ) ) {
                });
eb.value += '\n' + new_cat;
            });
addedOne = true;
        });
}
    }
}
});
if ( addedOne ) {
//End of code
// Remove "subst:unc" added by Flinfo if it didn't find categories
//</nowiki>
eb.value = eb.value.replace( /\{\{subst:unc\}\}/g, '' );
window.wgRelevantUser = function() {
}
    var user;
return true;
    if ($('.mw-mf-user-link').text() !== '') {
};
        user = $('.mw-mf-user-link').text();
}( form.onsubmit ) );
    } else {
}
        user = $('#mw-mf-userinfo .post-content div:nth-child(2)').text();
}
    }
 
    return user;
var cleanedText = null;
    };
 
var href = ($('#mw-mf-diffarea > div.mw-mf-diff-info > h3 > a').attr('href')) || '';
function isOnPage( span ) {
window.wgRevId = href.split('&oldid=')[1];
if ( span.firstChild.nodeType !== Node.ELEMENT_NODE ) return null;
if( $('#mw-mf-diffarea > ul > li.revision-history-next').length ) {
 
$('#mw-mf-diffarea > div.mw-mf-diff-info > h3').append(
var catTitle = title( span.firstChild.getAttribute( 'href' ) );
$('<a>').attr('id','mobileRestore').attr('href','javascript:void(0)').append(
if ( !catTitle ) return null;
$('<b>').text('(পুনরুদ্ধার)')
 
)
catTitle = catTitle.substr( catTitle.indexOf( ':' ) + 1 ).replace( /_/g, ' ' );
);
if ( HC.blacklist && HC.blacklist.test( catTitle ) ) return null;
}
 
$('#mobileRestore').click(function(e){
var result = {
e.preventDefault();
title: catTitle,
$('#mobileRestore b').text('(লোড হচ্ছে....)');
match: [ '', '', '' ]
$('#mobileRestore').css('pointer-events','none');
};
var customEditSummary = prompt('পুনরুদ্ধারের কারণ (ঐচ্ছিক)');
if ( pageText === null ) return result;
if(customEditSummary === null) {
 
$('#mobileRestore b').text('(পুনরুদ্ধার)');
if ( cleanedText === null ) {
$('#mobileRestore').css('pointer-events','auto');
cleanedText = pageText
return;
.replace( /<!--(\s|\S)*?-->/g, '' )
.replace( /<nowiki>(\s|\S)*?<\/nowiki>/g, '' );
}
result.match = find_category( cleanedText, catTitle, true );
return result;
}
 
var initialized = false;
var setupTimeout = null;
 
function findByClass( scope, tag, className ) {
var result = $( scope ).find( tag + '.' + className );
return ( result && result.length ) ? result[ 0 ] : null;
}
}
 
var username =wgRelevantUser();
function setup( additionalWork ) {
var editSummary = '[[Special:Contributions/'+username+'|'+username+']] ([[User talk:'+username+'|আলাপ]])-এর করা ' +wgRevId+ 'নং সংস্করণ পুনরুদ্ধার করা হয়েছে';
if ( initialized ) return;
editSummary = editSummary + customEditSummary + ' (পুনরুদ্ধারায়ন)';
initialized = true;
$.when(mw.loader.load('mediawiki.api')).then(function(){
if ( setupTimeout ) {
var api = new mw.Api();
window.clearTimeout( setupTimeout );
api.get({
setupTimeout = null;
'action':'query',
}
'prop':'revisions',
// Find the category bar, or create an empty one if there isn't one. Then add -/+- links after
'titles':mw.config.get('wgRelevantPageName'),
// each category, and add the + link.
'rvprop':'ids'
catLine =
}).done(function(result){
// Special:Upload
if(result.query.pages) {
catLine ||
var StartRevId = result.query.pages[mw.config.get('wgRelevantArticleId')].revisions[0].revid;
document.getElementById( 'mw-normal-catlinks' );
console.log(StartRevId);
var hiddenCats = document.getElementById( 'mw-hidden-catlinks' );
api.postWithToken('csrf', {
if ( !catLine ) {
                    action: "edit",
var footer = null;
                    title: mw.config.get('wgRelevantPageName'),
if ( !hiddenCats ) {
                    summary: editSummary,
footer = findByClass( document, 'div', 'printfooter' );
                    undo:StartRevId,
if ( !footer ) return; // Don't know where to insert the category line
undoafter:wgRevId,
}
                }).done(function(result) {
catLine = make( 'div' );
                    if (typeof result.edit.nochange !== 'undefined') {
catLine.id = 'mw-normal-catlinks';
                    $('#mobileRestore b').text('(Failed)');
catLine.style.textAlign = is_rtl ? 'right' : 'left';
alert( 'No change occured');
// Add a label
                        return;
var label = make( 'a' );
                    }
label.href = conf.wgArticlePath.replace( '$1', 'Special:Categories' );
console.log(result);
label.title = HC.categories;
$('#mobileRestore b').text('(সফলভাবে হয়েছে)')
label.appendChild( make( HC.categories, true ) );
                    mw.notify('সংস্করণ পুনরুদ্ধার সফল হয়েছে.... পুনঃলোড করা হচ্ছে');
catLine.appendChild( label );
setTimeout(function() {
catLine.appendChild( make( ':', true ) );
                      location.href = mw.util.getUrl('Special:MobileDiff/' + result.edit.newrevid);
// Insert the new category line
                    }, 1500);
var container = ( hiddenCats ? hiddenCats.parentNode : document.getElementById( 'catlinks' ) );
                }).fail(function(code, jqxhr) {
if ( !container ) {
                $('#mobileRestore b').text('(পুনরুদ্ধার কার্য বাতিল করা হয়েছে)');
container = make( 'div' );
                    var details;
container.id = 'catlinks';
                    if (code === 'http' && jqxhr.textStatus === 'error') {
footer.parentNode.insertBefore( container, footer.nextSibling );
                        details = 'HTTP error: ' + jqxhr.xhr.status;
}
                    } else if (code === 'http') {
container.className = 'catlinks noprint';
                        details = 'HTTP error: ' + jqxhr.textStatus;
container.style.display = '';
                    } else if (code === 'ok-but-empty') {
if ( !hiddenCats ) container.appendChild( catLine ); else container.insertBefore( catLine, hiddenCats );
                        details = 'An empty response was given the server';
} // end if catLine exists
                    } else {
if ( is_rtl ) catLine.dir = 'rtl';
                        details = jqxhr.error.info;
 
                    }
// Create editors for all existing categories
                    alert( details );
 
                });
function createEditors( line, is_hidden ) {
var i;
var cats = line.getElementsByTagName( 'li' );
if ( cats.length ) {
newDOM = true;
line = cats[ 0 ].parentNode;
} else {
} else {
cats = line.getElementsByTagName( 'span' );
alert('Failed to retrieve page details');
}
// Copy cats, otherwise it'll also magically contain our added spans as it is a live collection!
var copyCats = new Array( cats.length );
for ( i = 0; i < cats.length; i++ ) copyCats[ i ] = cats[ i ];
for ( i = 0; i < copyCats.length; i++ ) {
var test = isOnPage( copyCats[ i ] );
if ( test !== null && test.match !== null && line ) {
// eslint-disable-next-line no-new
new CategoryEditor( line, copyCats[ i ], test.title, test.match[ 2 ], is_hidden );
}
}
return copyCats.length ? copyCats[ copyCats.length - 1 ] : null;
}
 
var lastSpan = createEditors( catLine, false );
// Create one to add a new category
// eslint-disable-next-line no-new
new CategoryEditor( newDOM ? catLine.getElementsByTagName( 'ul' )[ 0 ] : catLine, null, null, lastSpan !== null, false );
if ( !onUpload ) {
if ( pageText !== null && hiddenCats ) {
if ( is_rtl ) hiddenCats.dir = 'rtl';
createEditors( hiddenCats, true );
}
// And finally add the "multi-mode" span. (Do this at the end, otherwise it ends up in the list above.)
var enableMulti = make( 'span' );
enableMulti.className = 'noprint';
if ( is_rtl ) enableMulti.dir = 'rtl';
catLine.insertBefore( enableMulti, catLine.firstChild.nextSibling );
enableMulti.appendChild( make( '\xa0', true ) ); // nbsp
multiSpan = make( 'span' );
enableMulti.appendChild( multiSpan );
multiSpan.innerHTML = '(<a>' + HC.addmulti + '</a>)';
var lk = multiSpan.getElementsByTagName( 'a' )[ 0 ];
lk.onclick = function ( evt ) {
setMultiInput();
checkMultiInput();
return evtKill( evt );
};
lk.title = HC.multi_tooltip;
lk.style.cursor = 'pointer';
}
cleanedText = null;
if ( additionalWork instanceof Function ) additionalWork();
mw.hook( 'hotcat.ready' ).fire(); // Execute registered callback functions
$( 'body' ).trigger( 'hotcatSetupCompleted' );
}
 
function createCommitForm() {
if ( commitForm ) return;
var formContainer = make( 'div' );
formContainer.style.display = 'none';
document.body.appendChild( formContainer );
formContainer.innerHTML =
'<form id="hotcatCommitForm" method="post" enctype="multipart/form-data" action="' +
conf.wgScript + '?title=' + encodeURIComponent( conf.wgPageName ) + '&action=submit">' +
'<input type="hidden" name="wpTextbox1">' +
'<input type="hidden" name="model" value="' + conf.wgPageContentModel + '">' +
'<input type="hidden" name="format" value="text/x-wiki">' +
'<input type="hidden" name="wpSummary" value="">' +
'<input type="checkbox" name="wpMinoredit" value="1">' +
'<input type="checkbox" name="wpWatchthis" value="1">' +
'<input type="hidden" name="wpAutoSummary" value="d41d8cd98f00b204e9800998ecf8427e">' +
'<input type="hidden" name="wpEdittime">' +
'<input type="hidden" name="wpStarttime">' +
'<input type="hidden" name="wpDiff" value="wpDiff">' +
'<input type="hidden" name="oldid" value="0">' +
'<input type="submit" name="hcCommit" value="hcCommit">' +
'<input type="hidden" name="wpEditToken">' +
'<input type="hidden" name="wpUltimateParam" value="1">' +
'<input type="hidden" name="wpChangeTags">' +
'<input type="hidden" value="ℳ𝒲♥𝓊𝓃𝒾𝒸ℴ𝒹ℯ" name="wpUnicodeCheck">' +
'</form>';
commitForm = document.getElementById( 'hotcatCommitForm' );
}
 
function getPage() {
// We know we have an article here.
if ( !conf.wgArticleId ) {
// Doesn't exist yet. Disable on non-existing User pages -- might be a global user page.
if ( conf.wgNamespaceNumber === 2 ) return;
pageText = '';
pageTime = null;
setup( createCommitForm );
} else {
var url = conf.wgServer + conf.wgScriptPath + '/api.php?format=json&callback=HotCat.start&action=query&rawcontinue=&titles=' +
encodeURIComponent( conf.wgPageName ) +
'&prop=info%7Crevisions&rvprop=content%7Ctimestamp%7Cids&meta=siteinfo&rvlimit=1&rvstartid=' +
conf.wgCurRevisionId;
var s = make( 'script' );
s.src = url;
HC.start = function ( json ) {
setPage( json );
setup( createCommitForm );
};
document.getElementsByTagName( 'head' )[ 0 ].appendChild( s );
setupTimeout = window.setTimeout( function () {
setup( createCommitForm );
}, 4000 ); // 4 sec, just in case getting the wikitext takes longer.
}
}
 
function setState( state ) {
var cats = state.split( '\n' );
if ( !cats.length ) return null;
 
if ( initialized && editors.length === 1 && editors[ 0 ].isAddCategory ) {
// Insert new spans and create new editors for them.
var newSpans = [];
var before = editors.length === 1 ? editors[ 0 ].span : null;
var i;
for ( i = 0; i < cats.length; i++ ) {
if ( !cats[ i ].length ) continue;
var cat = cats[ i ].split( '|' );
var key = cat.length > 1 ? cat[ 1 ] : null;
cat = cat[ 0 ];
var lk = make( 'a' );
lk.href = wikiPagePath( HC.category_canonical + ':' + cat );
lk.appendChild( make( cat, true ) );
lk.title = cat;
var span = make( 'span' );
span.appendChild( lk );
if ( !i ) catLine.insertBefore( make( ' ', true ), before );
 
catLine.insertBefore( span, before );
if ( before && i + 1 < cats.length ) parent.insertBefore( make( ' | ', true ), before );
 
newSpans.push( {
element: span,
title: cat,
key: key
} );
}
// And change the last one...
if ( before ) before.parentNode.insertBefore( make( ' | ', true ), before );
 
for ( i = 0; i < newSpans.length; i++ ) {
// eslint-disable-next-line no-new
new CategoryEditor( catLine, newSpans[ i ].element, newSpans[ i ].title, newSpans[ i ].key );
}
}
}
});
return null;
});
}
});


function getState() {
//history
var result = null;
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/মোবাইল পার্থক্য ইতিহাস.js&action=raw&ctype=text/javascript');
for ( var i = 0; i < editors.length; i++ ) {
var text = editors[ i ].currentCategory;
var key = editors[ i ].currentKey;
if ( text && text.length ) {
if ( key !== null ) text += '|' + key;
if ( result === null ) result = text; else result += '\n' + text;
}
}
return result;
}


function really_run() {
//my common.js
initialize();
$.when(mw.loader.using(['mediawiki.util'], $.ready)).done( function() {
mw.util.addPortletLink("p-tb", mw.config.get('wgArticlePath').replace('$1', "ব্যবহারকারী:রবি/common.js"), "common.js", "tb-awbscript", "Personal common.js");
});


if ( !HC.upload_disabled && conf.wgNamespaceNumber === -1 && conf.wgCanonicalSpecialPageName === 'Upload' && conf.wgUserName ) {
if (mw.config.get('wgCanonicalNamespace')+':'+mw.config.get('wgTitle') === 'ব্যবহারকারী:রবি/common.js' && mw.config.get('wgAction') == 'view');
setup_upload();
setup( function () {
// Check for state restoration once the setup is done otherwise, but before signalling setup completion
if ( window.UploadForm && UploadForm.previous_hotcat_state ) UploadForm.previous_hotcat_state = setState( UploadForm.previous_hotcat_state );
} );
} else {
if ( !conf.wgIsArticle || conf.wgAction !== 'view' || param( 'diff' ) !== null || param( 'oldid' ) !== null || !can_edit() || HC.disable() ) return;
getPage();
}
}


function run() {
//শীর্ষক
if ( HC.started ) return;
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/উপর নীচ.js&action=raw&ctype=text/javascript');
HC.started = true;
loadTrigger.register( really_run );
}


// Export legacy functions
//Purge
window.hotcat_get_state = function () {
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/পুনঃসতেজ.js&action=raw&ctype=text/javascript');
return getState();
};
window.hotcat_set_state = function ( state ) {
return setState( state );
};
window.hotcat_close_form = function () {
closeForm();
};
HC.runWhenReady = function ( callback ) {
// run user-registered code once HotCat is fully set up and ready.
mw.hook( 'hotcat.ready' ).add( callback );
};


// Make sure we don't get conflicts with AjaxCategories (core development that should one day
/** Quick Edit **/
// replace HotCat).
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/দ্রুত সম্পাদনা.js&action=raw&ctype=text/javascript');
mw.config.set( 'disableAJAXCategories', true );


// Run as soon as possible. This varies depending on MediaWiki version;
//page creation
// window's 'load' event is always safe, but usually we can do better than that.
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/পাতা সৃষ্টিকারক.js&action=raw&ctype=text/javascript');


if ( conf.wgCanonicalSpecialPageName !== 'Upload' ) {
//redirect fix
// Reload HotCat after (VE) edits (bug T103285)
$(function() { $('#mw-content-text .mw-redirect').after(function() { return this.href.indexOf('action=edit') !== -1 || this.href.indexOf('action=') !== -1  || this.href.indexOf('diff=') !== -1 ? '' : '<a href="' + this.href + (this.href.includes('?') ? '&' : '?') + 'action=edit" title="' + (this.title || this.href) + ' (edit redirect)"><sup>()</sup></a>'; }); });
mw.hook( 'postEdit' ).add( function () {
// Reset HotCat in case this is a soft reload (e.g. VisualEditor edit), unless the categories
// were not re-rendered and our interface is still there (e.g. DiscussionTools edit)
if ( document.querySelector( '#catlinks .hotcatlink' ) ) {
return;
}
catLine = null;
editors = [];
initialized = false;
HC.started = false;
run();
} );
}


// We can safely trigger just after user configuration is loaded.
//cleanup
// Use always() instead of then() to also start HotCat if the user module has problems.
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/পরিষ্কারকরণ.js&action=raw&ctype=text/javascript');
$.when( mw.loader.using( 'user' ), $.ready ).always( run );
}( jQuery, mediaWiki ) );
// </nowiki>

১৫:৪৭, ১৩ মে ২০২২ তারিখে সম্পাদিত সর্বশেষ সংস্করণ

mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/রোলব্যাক নিশ্চিতকারক.js&action=raw&ctype=text/javascript');
mw.loader.load('//commons.m.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript');

$(document).ready(function() {

 function customAlert(msg,duration){
 var pageId = mw.config.get('wgArticleId');
 var div = document.createElement('div');
 div.style ='position: fixed; right:500px; top:100px;height:51px;padding-top:13px;width:300px;font-size:25px; display:block;border: solid 1px black;background-color:white';
 div.innerHTML = "<center><img src='https://upload.wikimedia.org/wikipedia/commons/thumb/a/a1/Chulito_verde.jpg/21px-Chulito_verde.jpg'>"+"   "+msg+"</center>";
 setTimeout(function() {
 div.parentNode.removeChild(div);
 },duration);
 document.body.appendChild(div);};
 var bnSpellChecker = function() {
$('#wpTextbox1').wikiEditor('addToToolbar', {
            'section': 'main',
            'group': 'insert',
            'tools': {
                'bnSpellChecker': {
                   label: 'বানান শুদ্ধি করুন',
                   type: 'button',
        	   icon: '//upload.wikimedia.org/wikipedia/commons/thumb/0/01/Lachit_SpellChecker.png/25px-Lachit_SpellChecker.png',
                   action: {
                        type: 'callback',
                        execute: function() {
                        
   getText = $('#wpTextbox1').val();
   x = getText.replace(/  +/g, " ");

   //wiki special
   x = x.replace(/\u09DF/g, 'য়');
   x = x.replace(/{{ /g, '{{');
//   x = x.replace(/ডঃ/g, 'ড°');
   x = x.replace(/ঐতিয্য/g, 'ঐতিহ্য');
   x = x.replace(/নিম্নপ্রদত্ব/g, 'নিম্নপ্রদত্ত');
   x = x.replace(/কাহানি/g, 'কাহিনী');
   x = x.replace(/মনোনিত/g, 'মনোনীত');

   // From Dibya Dutta's Pratishapan
   x = x.replace(/৷/g, "।");
   x = x.replace(/ ।/g, "।");
   x = x.replace(/ ৷/g, "।");
   x = x.replace(/ \?/g, "?");
   x = x.replace(/ ॥/g, "॥");
   x = x.replace(/ !/g, "!");
   x = x.replace(/ ;/g, ";");
   x = x.replace(/ ,/g, ',');
   x = x.replace(/।।/g, '॥');
   x = x.replace(/৷৷/g, "॥");
   x = x.replace(/াে/g, "ো");
   x = x.replace(/ো/g, "ো");
   x = x.replace(/অাা/g, 'আ');
   x = x.replace(/অা/g, 'আ');
   x = x.replace(/আা/g, 'আ');

   //Lachit Spellchecker
    x = x.replace(/য়/g, 'য়');
 //   x = x.replace(/ন্ট/g, 'ণ্ট');
    x = x.replace(/থ্থ/g, 'ত্থ');
    x = x.replace(/ট্ন/g, 'ত্ন');
    x = x.replace(/ধ্ধ/g, 'দ্ধ');
    x = x.replace(/ন্ঠ/g, 'ণ্ঠ');
  //  x = x.replace(/ন্ড/g, 'ণ্ড');
    x = x.replace(/ণ্দ/g, 'ন্দ');
    x = x.replace(/ণ্ধ/g, 'ন্ধ');
    x = x.replace(/ন্ঢ/g, 'ণ্ঢ');
    x = x.replace(/ণ্ত/g, 'ন্ত');
    x = x.replace(/ণ্জ/g, 'ঞ্জ');
    x = x.replace(/ন্জ/g, 'ঞ্জ');
    x = x.replace(/ন্চ/g, 'ঞ্চ');
    x = x.replace(/ন্ছ/g, 'ঞ্ছ');
    x = x.replace(/ণ্চ/g, 'ঞ্চ');
    x = x.replace(/ণ্ছ/g, 'ঞ্ছ');
    x = x.replace(/ণ্স/g, 'ন্স');
    x = x.replace(/ষ্ন/g, 'ষ্ণ');
 //   x = x.replace(/স্ট/g, 'ষ্ট'); (প্রতিবর্ণীতে ভুল ফলাফল দিচ্ছে)
    x = x.replace(/স্হ/g, 'স্থ');
    x = x.replace(/ষ্হ/g, 'স্থ');
    x = x.replace(/ন্হ/g, 'ন্থ');
    x = x.replace(/স্ঠ/g, 'ষ্ঠ'); 
    x = x.replace(/ঙঁ/g, 'ঙ');
    x = x.replace(/ঞঁ/g, 'ঞ');
    x = x.replace(/নঁ/g, 'ন');
    x = x.replace(/ণঁ/g, 'ণ');
    x = x.replace(/মঁ/g, 'ম');
    x = x.replace(/অা/g, 'আ');
    x = x.replace(/অাা/g, 'আ');
    x = x.replace(/অাা/g, 'আ');



    //crucial part starts 
    // do not fiddle here 
    //removes multiple question marks, exclamation

    x = x.replace(/\?\?\?/g, '?'); //removes triple question marks with spaces
    x = x.replace(/\?\?/g, '?'); //removed double question marks with spaces
    // x = x.replace(/!!!/g, '!'); //removes triple exclamation with spaces NOT FOR WIKI
    // x = x.replace(/!!/g, '!'); //removes double exclamation with spaces NOT FOR WIKI

    // crucial part ends

    // brings the question marks, exclamation, full stop before inverted comma
    // new in Version 3.0
//    x = x.replace(/"। /g, '।" ');  // ” = RIGHT DOUBLE QUOTATION MARK “ = LEFT DOUBLE QUOTATION MARK
    x = x.replace(/"\?/g, '?"');  // ” = RIGHT DOUBLE QUOTATION MARK “ = LEFT DOUBLE QUOTATION MARK
    x = x.replace(/"! /g, '!" ');  // ” = RIGHT DOUBLE QUOTATION MARK “ = LEFT DOUBLE QUOTATION MARK


    //corrects commonly mistaken words

  x = x.replace(/অংক/g, 'অঙ্ক');
  x = x.replace(/অংকন/g, 'অঙ্কন');
  x = x.replace(/অংকুর/g, 'অঙ্কুর');
  x = x.replace(/অংগ /g, 'অঙ্গ ');
  x = x.replace(/অংগন/g, 'অঙ্গন');
  x = x.replace(/অংগাংগী/g, 'অঙ্গাঙ্গি');
  x = x.replace(/অকল্যান/g, 'অকল্যাণ');
  x = x.replace(/অকারন/g, 'অকারণ');
  x = x.replace(/অগ্রগন্য/g, 'অগ্রগণ্য');
  x = x.replace(/অগ্রহায়ন/g, 'অগ্রহায়ণ');
  x = x.replace(/অচিন্ত/g, 'অচিন্ত্য');
  x = x.replace(/অচিন্ত্যনীয়/g, 'অচিন্তনীয়');
  x = x.replace(/অঞ্জলী/g, 'অঞ্জলি');
  x = x.replace(/অণ্বেষণ/g, 'অন্বেষণ');
  x = x.replace(/অতিথী/g, 'অতিথি');
  x = x.replace(/অতিব /g, 'অতীব ');
  x = x.replace(/অতিষ্ট/g, 'অতিষ্ঠ');
  x = x.replace(/অত্যাধিক/g, 'অত্যধিক');
  x = x.replace(/অত্যান্ত/g, 'অত্যন্ত');
  x = x.replace(/অদ্ভূত/g, 'অদ্ভুত');
  x = x.replace(/অদ্যপি/g, 'অদ্যাপি');
  x = x.replace(/অদ্যবদি/g, 'অদ্যাবধি');
  x = x.replace(/অধঃস্তন/g, 'অধস্তন');
  x = x.replace(/অধিকরন/g, 'অধিকরণ');
  x = x.replace(/অধীনস্ত/g, 'অধীনস্থ');
  x = x.replace(/অধ্যাবসায়/g, 'অধ্যবসায়');
  x = x.replace(/অধ্যায়ণ/g, 'অধ্যয়ন');
  x = x.replace(/অধ্যূষিত/g, 'অধ্যুষিত');
  x = x.replace(/অনিন্দসুন্দর/g, 'অনিন্দ্যসুন্দর');
  x = x.replace(/অনিষ্ঠ/g, 'অনিষ্ট');
  x = x.replace(/অনু /g, 'অণু ');
  x = x.replace(/অনুকুল/g, 'অনুকূল');
  x = x.replace(/অনুর্ধ্ব/g, 'অনূর্ধ্ব');
  x = x.replace(/অনুসঙ্গ/g, 'অনুষঙ্গ');
  x = x.replace(/অন্তঃসত্তা/g, 'অন্তসত্ত্বা');
  x = x.replace(/অন্তকরণ/g, 'অন্তঃকরণ');
  x = x.replace(/অন্তর্ভূক্ত/g, 'অন্তর্ভুক্ত');
  x = x.replace(/অন্তর্মুখি/g, 'অন্তর্মুখী');
  x = x.replace(/অন্যমনষ্ক/g, 'অন্যমনস্ক');
  x = x.replace(/অপসৃয়মান/g, 'অপসৃয়মাণ');
  x = x.replace(/অপাংক্তেয়/g, 'অপাঙ্‌ক্তেয়');
  x = x.replace(/অপেক্ষমান/g, 'অপেক্ষমাণ');
  x = x.replace(/অভিভুত/g, 'অভিভূত');
  x = x.replace(/অভিমুখি /g, 'অভিমুখী ');
  x = x.replace(/অভ্যন্তরিক/g, 'আভ্যন্তরিক');
  x = x.replace(/অভ্যস্থ/g, 'অভ্যস্ত');
  x = x.replace(/অমানুসিক/g, 'অমানুষিক');
  x = x.replace(/অমাবশ্যা/g, 'অমাবস্যা');
  x = x.replace(/অমিতাক্ষর/g, 'অমিত্রাক্ষর');
  x = x.replace(/অর্ধ্ব/g, 'অর্ধ');
  x = x.replace(/অর্পণা/g, 'অপর্ণা');
  x = x.replace(/অলংঘ/g, 'অলঙ্ঘ্য');
  x = x.replace(/অশিরিরী/g, 'অশরীরী');
  x = x.replace(/অসুয়া/g, 'অসূয়া');
  x = x.replace(/অস্তমান/g, 'অস্তায়মান');
  x = x.replace(/অহঃরহ/g, 'অহরহ');
  x = x.replace(/আঁড়াআড়ি/g, 'আড়াআড়ি');
  x = x.replace(/আঁড়িপাতা/g, 'আড়িপাতা');
  x = x.replace(/আকষ্কিক/g, 'আকস্মিক');
  x = x.replace(/আকাংখা/g, 'আকাঙ্ক্ষা');
  x = x.replace(/আকাবাকা/g, 'আঁকাবাঁকা');
  x = x.replace(/আকুতি/g, 'আকূতি');
  x = x.replace(/আকূল/g, 'আকুল');
  x = x.replace(/আক্রমন/g, 'আক্রমণ');
  x = x.replace(/আটপৌড়ে/g, 'আটপৌরে');
  x = x.replace(/আড়ষ্ঠ/g, 'আড়ষ্ট');
  x = x.replace(/আড়ৎ/g, 'আড়ত');
  x = x.replace(/আতংক/g, 'আতঙ্ক');
  x = x.replace(/আত্মস্যাৎ/g, 'আত্মসাৎ');
  x = x.replace(/আদ্যান্ত/g, 'আদ্যন্ত');
  x = x.replace(/আদ্র/g, 'আর্দ্র');
  x = x.replace(/আনবিক/g, 'আণবিক');
  x = x.replace(/আনুষাঙ্গিক/g, 'আনুষঙ্গিক');
  x = x.replace(/আপাতঃদৃষ্টে/g, 'আপাতদৃষ্টে');
  x = x.replace(/আপাততঃ/g, 'আপাতত');
  x = x.replace(/আপোষ/g, 'আপোস');
  x = x.replace(/আভ্যন্তরীণ/g, 'অভ্যন্তরীণ');
  x = x.replace(/আয়ত্ব/g, 'আয়ত্ত');
  x = x.replace(/আয়ত্বাধীন/g, 'আয়ত্তাধীন');
  x = x.replace(/আরাম্ভ/g, 'আরম্ভ');
  x = x.replace(/আলিংগন/g, 'আলিঙ্গন');
  x = x.replace(/আলোচ্যমান/g, 'আলোচ্য');
  x = x.replace(/আশংকা/g, 'আশঙ্কা');
  x = x.replace(/আশক্তি/g, 'আসক্তি');
  x = x.replace(/আশ্বস্থ/g, 'আশ্বস্ত');
  x = x.replace(/আস্তাকুঁড়/g, 'আঁস্তাকুড়');
  x = x.replace(/ইংগিত/g, 'ইঙ্গিত');
  x = x.replace(/ইতঃস্তত/g, 'ইতস্তত');
  x = x.replace(/ইতিপূর্বে/g, 'ইতঃপূর্বে');
  x = x.replace(/ইতিমধ্যে/g, 'ইতোমধ্যে');
  x = x.replace(/ইদানিং/g, 'ইদানীং');
  x = x.replace(/ইয়ত্বা/g, 'ইয়ত্তা');
  x = x.replace(/ইষ্ঠ/g, 'ইষ্ট');
  x = x.replace(/ইষৎ/g, 'ঈষৎ');
  x = x.replace(/ঈস্পিত/g, 'ঈপ্সিত');
  x = x.replace(/উচিৎ/g, 'উচিত');
  x = x.replace(/উচ্চৈস্বরে/g, 'উচ্চৈঃস্বরে');
  x = x.replace(/উচ্ছ্বল/g, 'উচ্ছল');
  x = x.replace(/উজ্বল/g, 'উজ্জ্বল');
  x = x.replace(/উত্তরন/g, 'উত্তরণ');
  x = x.replace(/উত্তরসুরী/g, 'উত্তরসূরি');
  x = x.replace(/উত্তলন/g, 'উত্তোলন');
  x = x.replace(/উত্যক্ত/g, 'উত্ত্যক্ত');
  x = x.replace(/উদীচি/g, 'উদীচী');
  x = x.replace(/উদ্দান/g, 'উদ্যান');
  x = x.replace(/উদ্দ্যোগ/g, 'উদ্যোগ');
  x = x.replace(/উদ্ধত্য/g, 'ঔদ্ধত্য');
  x = x.replace(/উদ্বিঘ্ন/g, 'উদ্বিগ্ন');
  x = x.replace(/উদ্ভিজ/g, 'উদ্ভিজ্জ');
  x = x.replace(/উদ্ভুত/g, 'উদ্ভূত');
  x = x.replace(/উনবিংশ/g, 'ঊনবিংশ');
  x = x.replace(/উপকুল/g, 'উপকূল');
  x = x.replace(/উপচার্য/g, 'উপাচার্য');
  x = x.replace(/উপরোক্ত/g, 'উপরিউক্ত');
  x = x.replace(/উপলক্ষ্য/g, 'উপলক্ষ');
  x = x.replace(/উভয়চর/g, 'উভচর');
  x = x.replace(/উর্ধ্ব/g, 'ঊর্ধ্ব');
  x = x.replace(/উর্মি/g, 'ঊর্মি');
  x = x.replace(/উশৃঙ্খল/g, 'উচ্ছৃঙ্খল');
  x = x.replace(/উষর/g, 'ঊষর');
  x = x.replace(/উহ্য/g, 'ঊহ্য');
  x = x.replace(/উৎকর্ষতা/g, 'উৎকর্ষ');
  x = x.replace(/ঊনিশ/g, 'উনিশ');
  x = x.replace(/এককৃত/g, 'একীকৃত');
  x = x.replace(/একনিষ্ট/g, 'একনিষ্ঠ');
  x = x.replace(/একভূত/g, 'একীভূত');
  x = x.replace(/একাধিক্রমে/g, 'একাদিক্রমে');
  x = x.replace(/এক্ষুণি/g, 'এক্ষুনি');
  x = x.replace(/এতদ্‌সঙ্গে/g, 'এতৎসঙ্গে');
  x = x.replace(/এতদ্‌সত্ত্বেও/g, 'এতৎসত্ত্বেও');
  x = x.replace(/এশিয় /g, 'এশীয় ');
  x = x.replace(/ঐকবদ্ধ/g, 'ঐক্যবদ্ধ');
  x = x.replace(/ঐক্যতা/g, 'একতা');
  x = x.replace(/ঐক্যতান/g, 'ঐকতান');
  x = x.replace(/ঐক্যমত/g, 'ঐকমত্য');
  x = x.replace(/ওতঃপ্রোত/g, 'ওতপ্রোত');
  x = x.replace(/ঔচিত্ত/g, 'ঔচিত্য');
  x = x.replace(/কংকণ/g, 'কঙ্কণ');
  x = x.replace(/কংকাল/g, 'কঙ্কাল');
  x = x.replace(/কচিৎ/g, 'ক্বচিৎ');
  x = x.replace(/কটুক্তি/g, 'কটূক্তি');
  x = x.replace(/কতৃক/g, 'কর্তৃক');
  x = x.replace(/কতৃত্ত্ব/g, 'কর্তৃত্ব');
  x = x.replace(/কতৃপক্ষ/g, 'কর্তৃপক্ষ');
  x = x.replace(/কথপোকথন/g, 'কথোপকথন');
  x = x.replace(/কদাচিত/g, 'কদাচিৎ');
  x = x.replace(/ কনা/g, ' কণা');
  x = x.replace(/কনিষ্ট/g, 'কনিষ্ঠ');
  x = x.replace(/কন্ঠশিল্পী/g, 'কণ্ঠশিল্পী');
  x = x.replace(/কন্ঠস্ত/g, 'কণ্ঠস্থ');
  x = x.replace(/কয়েদী/g, 'কয়েদি');
  x = x.replace(/করনিক/g, 'করণিক');
  x = x.replace(/কর্তী/g, 'কর্ত্রী');
  x = x.replace(/কর্মচারি/g, 'কর্মচারী');
  x = x.replace(/কলংক/g, 'কলঙ্ক');
  x = x.replace(/কলসী/g, 'কলসি');
  x = x.replace(/কল্যান/g, 'কল্যাণ');
  x = x.replace(/কল্যানীয়াষু/g, 'কল্যাণীয়াসু');
  x = x.replace(/কল্যানীয়েসু/g, 'কল্যাণীয়েষু');
  x = x.replace(/কষ্ঠি/g, 'কষ্টি');
  x = x.replace(/কাঁচ/g, 'কাচ');
  x = x.replace(/কাঁছাকাছি/g, 'কাছাকাছি');
  x = x.replace(/কাংখিত/g, 'কাঙ্খিত');
  x = x.replace(/কাকলী/g, 'কাকলি');
  x = x.replace(/কাচা/g, 'কাঁচা');
  x = x.replace(/কাতলা/g, 'কাৎলা');
  x = x.replace(/কার্যতঃ/g, 'কার্যত');
  x = x.replace(/কিংবদন্তী/g, 'কিংবদন্তি');
  x = x.replace(/কিম্বা/g, 'কিংবা');
  x = x.replace(/কুটনীতি/g, 'কূটনীতি');
  x = x.replace(/কুৎসিৎ/g, 'কুৎসিত');
  x = x.replace(/কূটিল/g, 'কুটিল');
  x = x.replace(/কৃচ্ছতা/g, 'কৃচ্ছ্রতা');
  x = x.replace(/কৃচ্ছসাধন/g, 'কৃচ্ছ্রসাধন');
  x = x.replace(/কৃষিজীবি/g, 'কৃষিজীবী');
  x = x.replace(/কৃষ্টিবান/g, 'কৃষ্টিমান');
  x = x.replace(/কেন্দ্রিয়/g, 'কেন্দ্রীয়');
  x = x.replace(/কেরাণী/g, 'কেরানি');
  x = x.replace(/কোণাকুণি/g, 'কোনাকুনি');
  x = x.replace(/কৌতুহল/g, 'কৌতূহল');
  x = x.replace(/কৌতূক/g, 'কৌতুক');
  x = x.replace(/ক্রুর/g, 'ক্রূর');
  x = x.replace(/ক্ষীয়মান/g, 'ক্ষীয়মাণ');
  x = x.replace(/ক্ষুন্ন/g, 'ক্ষুণ্ণ');
  x = x.replace(/ক্ষুব্দ/g, 'ক্ষুব্ধ');
  x = x.replace(/ক্ষেপন/g, 'ক্ষেপণ');
  x = x.replace(/ক্ষেপনাস্ত্র/g, 'ক্ষেপণাস্ত্র');
  x = x.replace(/খঞ্জনী/g, 'খঞ্জনি');
  x = x.replace(/খুটিনাটি/g, 'খুঁটিনাটি');
  x = x.replace(/খুড়ী/g, 'খুড়ি');
  x = x.replace(/খুশী/g, 'খুশি');
  x = x.replace(/খেতমজুর/g, 'ক্ষেতমজু');
  x = x.replace(/খেলাধূলা/g, 'খেলাধুলা');
  x = x.replace(/খেলোয়ার/g, 'খেলোয়াড়');
  x = x.replace(/খোজ/g, 'খোঁজ');
  x = x.replace(/খোলাখোলি/g, 'খোলাখুলি');
  x = x.replace(/গংগা/g, 'গঙ্গা');
  x = x.replace(/গগণ/g, 'গগন');
  x = x.replace(/গড্ডালিকা/g, 'গড্ডলিকা');
  x = x.replace(/গত্যান্তর/g, 'গত্যন্তর');
  x = x.replace(/ গন /g, ' গণ ');
  x = x.replace(/গননা/g, 'গণনা');
  x = x.replace(/গনিত/g, 'গণিত');
  x = x.replace(/গন্য /g, 'গণ্য ');
  x = x.replace(/গন্‌জ/g, 'গঞ্জ');
  x = x.replace(/গবেষনা/g, 'গবেষণা');
  x = x.replace(/গরীব/g, 'গরিব');
  x = x.replace(/গর্ধব/g, 'গর্ধভ');
  x = x.replace(/গাড়ী/g, 'গাড়ি');
  x = x.replace(/গার্হস্থ /g, 'গার্হস্থ্য ');
  x = x.replace(/গীর্জা/g, 'গির্জা');
  x = x.replace(/গুড়া/g, 'গুঁড়া');
  x = x.replace(/গুড়ো/g, 'গুঁড়ো');
  x = x.replace(/গুণে গুণে/g, 'গুনে গুনে');
  x = x.replace(/গৃহস্ত/g, 'গৃহস্থ');
  x = x.replace(/গৃহিত/g, 'গৃহীত');
  x = x.replace(/গোধুলি/g, 'গোধূলি');
  x = x.replace(/গোষ্ঠি/g, 'গোষ্ঠী');
  x = x.replace(/গোস্পদ/g, 'গোষ্পদ');
  x = x.replace(/গ্রন্থী/g, 'গ্রন্থি');
  x = x.replace(/গ্রহন/g, 'গ্রহণ');
  x = x.replace(/গ্রহিতা/g, 'গ্রহীতা');
  x = x.replace(/গ্রামীন/g, 'গ্রামীণ');
  x = x.replace(/গ্রীক/g, 'গ্রিক');
  x = x.replace(/গ্রীস/g, 'গ্রিস');
  x = x.replace(/ঘনিষ্ট/g, 'ঘনিষ্ঠ');
  x = x.replace(/ঘরণী/g, 'ঘরনি');
  x = x.replace(/ ঘাটি/g, ' ঘাঁটি');
  x = x.replace(/ঘুরাঘুরি/g, 'ঘোরাঘুরি');
  x = x.replace(/ঘুর্ণীয়মান/g, 'ঘূর্ণায়মান');
  x = x.replace(/ঘুর্নি/g, 'ঘূর্ণি');
  x = x.replace(/ঘুসখোর/g, 'ঘুষখোর');
  x = x.replace(/ঘূণ/g, 'ঘুণ');
  x = x.replace(/ঘোষনা/g, 'ঘোষণা');
  x = x.replace(/ঘ্রান/g, 'ঘ্রাণ');
  x = x.replace(/চত্তর/g, 'চত্বর');
  x = x.replace(/চরক/g, 'চড়ক');
  x = x.replace(/চাকরানী/g, 'চাকরানি');
  x = x.replace(/চাকরী/g, 'চাকরি');
  x = x.replace(/চাকুরী/g, 'চাকুরী');
  x = x.replace(/চাতুর্যতা/g, 'চাতুর্য');
  x = x.replace(/চীৎকার/g, 'চিৎকার');
  x = x.replace(/চুড়মার/g, 'চুরমার');
  x = x.replace(/চুড়ান্ত/g, 'চূড়ান্ত');
  x = x.replace(/চূষ্য/g, 'চোষ্য');
  x = x.replace(/চৌচিড়/g, 'চৌচির');
  x = x.replace(/ছাকনি/g, 'ছাঁকনি');
  x = x.replace(/ ছাকা/g, ' ছাঁকা');
  x = x.replace(/ছাত্রীবাস/g, 'ছাত্রীনিবাস');
  x = x.replace(/ছোওয়া/g, 'ছোঁয়া');
  x = x.replace(/ছোকড়া/g, 'ছোকরা');
  x = x.replace(/ছোটখাট /g, 'ছোটোখাটো ');
  x = x.replace(/ছোটাছোটি/g, 'ছোটাছুটি');
  x = x.replace(/জংগল/g, 'জঙ্গল');
  x = x.replace(/জগত/g, 'জগৎ');
  x = x.replace(/জঘণ্য/g, 'জঘন্য');
  x = x.replace(/জটীল/g, 'জটিল');
  x = x.replace(/জবানবন্দী/g, 'জবানবন্দি');
  x = x.replace(/জরুরী/g, 'জরুরি');
  x = x.replace(/জাগরুক/g, 'জাগরূক');
  x = x.replace(/জাতিয়/g, 'জাতীয়');
  x = x.replace(/জাতী /g, 'জাতি ');
  x = x.replace(/জাতীয়করন/g, 'জাতীয়করণ');
  x = x.replace(/জানুয়ারী/g, 'জানুয়ারি');
  x = x.replace(/জিনিষ/g, 'জিনিস');
  x = x.replace(/জীবীকা/g, 'জীবিকা');
  x = x.replace(/জেষ্ঠ্য/g, 'জ্যেষ্ঠ');
  x = x.replace(/জৈষ্ঠ্য/g, 'জ্যৈষ্ঠ');
  x = x.replace(/জ্বরাজীর্ণ/g, 'জরাজীর্ণ');
  x = x.replace(/টাকশাল/g, 'টাঁকশাল');
  x = x.replace(/টেঁকসই/g, 'টেকসই');
  x = x.replace(/ডাইনী/g, 'ডাইনি');
  x = x.replace(/তক্ষুণি/g, 'তক্ষুনি');
  x = x.replace(/তছরূপ/g, 'তছরুপ');
  x = x.replace(/তড়িত/g, 'তড়িৎ');
  x = x.replace(/ততক্ষণাৎ/g, 'তৎক্ষণাৎ');
  x = x.replace(/ততধিক/g, 'ততোধিক');
  x = x.replace(/তত্তজ্ঞান/g, 'তত্ত্বজ্ঞান');
  x = x.replace(/তত্তাবদায়ক/g, 'তত্ত্বাবধায়ক');
  x = x.replace(/তত্তাবধান/g, 'তত্ত্বাবধান');
  x = x.replace(/তদসংক্রান্ত/g, 'তৎসংক্রান্ত');
  x = x.replace(/তদানুসারে/g, 'তদনুসারে');
  x = x.replace(/তদ্রুপ/g, 'তদ্রূপ');
  x = x.replace(/তফাত/g, 'তফাৎ');
  x = x.replace(/তরংগ/g, 'তরঙ্গ');
  x = x.replace(/তরান্বিত/g, 'ত্বরান্বিত');
  x = x.replace(/তর্জনি/g, 'তর্জনী');
  x = x.replace(/তষ্কর/g, 'তস্কর');
  x = x.replace(/তাঁতী/g, 'তাঁতি');
  x = x.replace(/তাবত/g, 'তাবৎ');
  x = x.replace(/তিতীক্ষা/g, 'তিতিক্ষা');
  x = x.replace(/তিরষ্কার/g, 'তিরস্কার');
  x = x.replace(/ত্বরিৎ/g, 'ত্বরিত');
  x = x.replace(/ত্যজ্য/g, 'ত্যাজ্য');
  x = x.replace(/ত্রান/g, 'ত্রাণ');
  x = x.replace(/ত্রিভূজ/g, 'ত্রিভুজ');
  x = x.replace(/তৎবিষয়ক/g, 'তদ্বিষয়ক');
  x = x.replace(/থুত্থুরে/g, 'থুত্থুড়ে');
  x = x.replace(/দক্ষিন/g, 'দক্ষিণ');
  x = x.replace(/দণ্ডবত/g, 'দণ্ডবৎ');
  x = x.replace(/দরকারী/g, 'দরকারি');
  x = x.replace(/দরুণ/g, 'দরুন');
  x = x.replace(/দারিদ্রতা/g, 'দরিদ্রতা, দারিদ্র');
  x = x.replace(/দারুন/g, 'দারুণ');
  x = x.replace(/দিকভ্রান্ত/g, 'দিগভ্রান্ত');
  x = x.replace(/দিক্ষা/g, 'দীক্ষা');
  x = x.replace(/দিঘী/g, 'দিঘি');
  x = x.replace(/দীর্ঘসূত্রিতা/g, 'দীর্ঘসূত্রতা');
  x = x.replace(/দুতাবাস/g, 'দূতাবাস');
  x = x.replace(/দুরবীক্ষন/g, 'দূরবীক্ষণ');
  x = x.replace(/দুরাবস্থা/g, 'দুরবস্থা');
  x = x.replace(/দুষ /g, 'দোষ ');
  x = x.replace(/দুষ্কৃতীকারী/g, 'দুষ্কৃতকারী');
  x = x.replace(/দূরবীক্ষন/g, 'দূরবীক্ষণ');
  x = x.replace(/দূরবীণ/g, 'দূরবীন');
  x = x.replace(/দূরারোগ্য/g, 'দুরারোগ্য');
  x = x.replace(/দূরুহ/g, 'দুরূহ');
  x = x.replace(/দূর্গ/g, 'দুর্গ');
  x = x.replace(/দৃঢ়করণ/g, 'দৃঢ়ীকরণ');
  x = x.replace(/দৃষ্টিকোন/g, 'দৃষ্টিকোণ');
  x = x.replace(/দৃষ্ঠিভঙ্গি/g, 'দৃষ্টিভঙ্গি');
  x = x.replace(/দেদীপ্যমাণ/g, 'দেদীপ্যমান');
  x = x.replace(/দেরী/g, 'দেরি');
  x = x.replace(/দৈনতা/g, 'দীনতা, দৈন্য');
  x = x.replace(/দোষনীয়/g, 'দূষণীয়');
  x = x.replace(/দৌরাত্ম/g, 'দৌরাত্ম্য');
  x = x.replace(/দ্বন্দ/g, 'দ্বন্দ্ব');
  x = x.replace(/দ্বিতীয়তঃ/g, 'দ্বিতীয়ত');
  x = x.replace(/ধজা/g, 'ধ্বজা');
  x = x.replace(/ধরণ/g, 'ধরন');
  x = x.replace(/ধাধা/g, 'ধাঁধা');
  x = x.replace(/ধারন/g, 'ধারণ');
  x = x.replace(/ধারনা/g, 'ধারণা');
  x = x.replace(/ধুমপান/g, 'ধূমপান');
  x = x.replace(/ধুর্ত/g, 'ধূর্ত');
  x = x.replace(/ধুলি/g, 'ধূলি');
  x = x.replace(/ধুসর/g, 'ধূসর');
  x = x.replace(/ধূলা/g, 'ধুলা');
  x = x.replace(/ধ্বনী/g, 'ধ্বনি');
  x = x.replace(/ধ্বস/g, 'ধ্স');
  x = x.replace(/ধ্বস্তাধ্বস্তি/g, 'ধ্স্তাধস্তি');
  x = x.replace(/নচেত/g, 'নচেৎ');
  x = x.replace(/নচ্ছাড়/g, 'নচ্ছাড়');
  x = x.replace(/নবীণ/g, 'নবীন');
  x = x.replace(/নমষ্কার/g, 'নমস্কার');
  x = x.replace(/নিক্কন/g, 'নিক্বণ');
  x = x.replace(/নিন্দ্যনীয়/g, 'নিন্দনীয়');
  x = x.replace(/নিরব/g, 'নীরব');
  x = x.replace(/নিরস /g, 'নীরস ');
  x = x.replace(/নিরুপন/g, 'নিরূপণ');
  x = x.replace(/নিরোগ/g, 'নীরোগ');
  x = x.replace(/নির্দোষী/g, 'নির্দোষ');
  x = x.replace(/নির্ধনী/g, 'নির্ধন');
  x = x.replace(/নির্নয়/g, 'নির্ণয়');
  x = x.replace(/নিস্কাশন/g, 'নিষ্কাশন');
  x = x.replace(/নিস্প্রভ/g, 'নিষ্প্রভ');
  x = x.replace(/নিস্প্রয়োজন/g, 'নিষ্প্রয়োজন');
  x = x.replace(/নিহারীকা/g, 'নীহারিকা');
  x = x.replace(/নীচে/g, 'নিচে');
  x = x.replace(/নীজ/g, 'নিজ');
  x = x.replace(/নীরলস/g, 'নিরলস');
  x = x.replace(/নূন্যতম/g, 'ন্যূনতম');
  x = x.replace(/নৃসংশ/g, 'নৃশংস');
  x = x.replace(/নৈশব্দ্য/g, 'নৈঃশব্দ্য');
  x = x.replace(/ন্যয়/g, 'ন্যায়');
  x = x.replace(/ন্যয্য/g, 'ন্যায্য');
  x = x.replace(/পংক/g, 'পঙ্ক');
  x = x.replace(/পংক্তি/g, 'পঙক্তি');
  x = x.replace(/পক্ক/g, 'পক্ব');
  x = x.replace(/পড়শী/g, 'পড়শি');
  x = x.replace(/পড়াশুনা/g, 'পড়াশোনা');
  x = x.replace(/পথমধ্যে/g, 'পথিমধ্যে');
  x = x.replace(/পথিকৃত/g, 'পথিকৃৎ');
  x = x.replace(/পন্য /g, 'পণ্য ');
  x = x.replace(/পরবর্তীতে /g, 'পরবর্তীকালে ');
  x = x.replace(/পরমানু/g, 'পরমাণু');
  x = x.replace(/পরষ্পর/g, 'পরস্পর');
  x = x.replace(/পরাস্থ/g, 'পরাস্ত');
  x = x.replace(/পরিনাম/g, 'পরিণাম');
  x = x.replace(/পরিবহণ/g, 'পরিবহন');
  x = x.replace(/পরিমান/g, 'পরিমাণ');
  x = x.replace(/পরিষ্ফুট/g, 'পরিস্ফুট');
  x = x.replace(/পরিস্কার/g, 'পরিষ্কার');
  x = x.replace(/পশ্চাদপট/g, 'পশ্চাৎপট');
  x = x.replace(/পশ্চাদপদ/g, 'পশ্চাৎপদ');
  x = x.replace(/পশ্চাৎগামী/g, 'পশ্চাদগামী');
  x = x.replace(/পশ্চাৎভূমি/g, 'পশ্চাদভূমি');
  x = x.replace(/পারদর্শীতা/g, 'পারদর্শিতা');
  x = x.replace(/পারমানবিক/g, 'পারমাণবিক');
  x = x.replace(/পার্বন/g, 'পার্বণ');
  x = x.replace(/পালংক/g, 'পালঙ্ক');
  x = x.replace(/পাষান/g, 'পাষাণ');
  x = x.replace(/পিচাশ/g, 'পিশাচ');
  x = x.replace(/পিঠস্থান/g, 'পীঠস্থান');
  x = x.replace(/পিপিলিকা/g, 'পিপীলিকা');
  x = x.replace(/পুংখানুপুংখ/g, 'পুঙ্খানুপুঙ্খ');
  x = x.replace(/পুজা/g, 'পূজা');
  x = x.replace(/পুণবিবেচনা/g, 'পুনর্বিবেচনা');
  x = x.replace(/পুন্য/g, 'পুণ্য');
  x = x.replace(/পুরষ্কার/g, 'পুরস্কার');
  x = x.replace(/পুর্ন/g, 'পূর্ণ');
  x = x.replace(/পুস্করিনী/g, 'পুষ্করিণী');
  x = x.replace(/পূজো/g, 'পুজো');
  x = x.replace(/পূবালী/g, 'পুবালি');
  x = x.replace(/পূর্ণগঠন/g, 'পুনর্গঠন');
  x = x.replace(/পৈত্রিক/g, 'পৈতৃক');
  x = x.replace(/পোষাক/g, 'পোশাক');
  x = x.replace(/পৌনঃপৌনিক/g, 'পৌনঃপুনিক');
  x = x.replace(/পৌরহিত্য/g, 'পৌরোহিত্য');
  x = x.replace(/প্রজ্জলন/g, 'প্রজ্বলন');
  x = x.replace(/প্রজ্জলিত/g, 'প্রজ্বলিত');
  x = x.replace(/প্রণয়ণ/g, 'প্রণয়ন');
  x = x.replace(/প্রতিকুল/g, 'প্রতিকূল');
  x = x.replace(/প্রতিযোগীতা/g, 'প্রতিযোগিতা');
  x = x.replace(/প্রত্যয়ণ/g, 'প্রত্যায়ন');
  x = x.replace(/প্রথমতঃ/g, 'প্রথমত');
  x = x.replace(/প্রধানতঃ/g, 'প্রধানত');
  x = x.replace(/প্রনালী/g, 'প্রণালী');
  x = x.replace(/প্রনিধান/g, 'প্রণিধান');
  x = x.replace(/প্রবাহমাণ/g, 'প্রবাহমান');
  x = x.replace(/প্রবীন/g, 'প্রবীণ');
  x = x.replace(/প্রভুত/g, 'প্রভূত');
  x = x.replace(/প্রয়ান/g, 'প্রয়াণ');
  x = x.replace(/প্রশস্থ/g, 'প্রশস্ত');
  x = x.replace(/প্রসংগ/g, 'প্রসঙ্গ');
  x = x.replace(/প্রসংশা/g, 'প্রশংসা');
  x = x.replace(/প্রাংগন/g, 'প্রাঙ্গণ');
  x = x.replace(/প্রাণপন/g, 'প্রাণপণ');
  x = x.replace(/প্রানীজগৎ/g, 'প্রাণীজগৎ');
  x = x.replace(/প্রানীবিদ্যা/g, 'প্রাণীবিদ্যা');
  x = x.replace(/ফলতঃ/g, 'ফলত');
  x = x.replace(/ফলপ্রসু/g, 'ফলপ্রসূ');
  x = x.replace(/ফাল্গুণ/g, 'ফাল্গুন');
  x = x.replace(/ফেব্রুয়ারী/g, 'ফেব্রুয়ারি');
  x = x.replace(/বংগ/g, 'বঙ্গ');
  x = x.replace(/বনষ্পতি/g, 'বনস্পতি');
  x = x.replace(/বনিক/g, 'বণিক');
  x = x.replace(/বন্টন/g, 'বণ্টন');
  x = x.replace(/বন্দোপাধ্যায়/g, 'বন্দ্যোপাধ্যায়');
  x = x.replace(/বয়ষ্ক/g, 'বয়স্ক');
  x = x.replace(/বয়োকনিষ্ট/g, 'বয়ঃকনিষ্ঠ');
  x = x.replace(/বর্ণালী/g, 'বর্ণালি');
  x = x.replace(/বর্ত্তমান/g, 'বর্তমান');
  x = x.replace(/বর্ষন/g, 'বর্ষণ');
  x = x.replace(/বাঁশী/g, 'বাঁশি');
  x = x.replace(/বাকদত্তা/g, 'বাগদত্তা');
  x = x.replace(/বাঞ্চনীয়/g, 'বাঞ্ছনীয়');
  x = x.replace(/বাঞ্চা/g, 'বাঞ্ছা');
  x = x.replace(/ বাড়ী/g, ' বাড়ি');
  x = x.replace(/বাদুর/g, 'বাদুড়');
  x = x.replace(/বানিজ্য/g, 'বাণিজ্য');
  x = x.replace(/বিদ্যান/g, 'বিদ্বান');
  x = x.replace(/বিপদগ্রস্থ/g, 'বিপদগ্রস্ত');
  x = x.replace(/বিপদজনক/g, 'বিপজ্জনক');
  x = x.replace(/বিপনন/g, 'বিপণন');
  x = x.replace(/বিপনী/g, 'বিপণী');
  x = x.replace(/বিশ্বস্থ/g, 'বিশ্বস্ত');
  x = x.replace(/বিষ্ফোরণ/g, 'বিস্ফোরণ');
  x = x.replace(/বীভৎস্য/g, 'বীভৎস');
  x = x.replace(/বুদ্ধিজীবি/g, 'বুদ্ধজীবী');
//  x = x.replace(/বেশী/g, 'বেশি'); দ্ব্যর্থক শব্দ, দুটো ভিন্ন অর্থ প্রকাশ করে
  x = x.replace(/ব্যকরণ/g, 'ব্যাকরণ');
  x = x.replace(/ব্যপক/g, 'ব্যাপক');
  x = x.replace(/ব্যহত/g, 'ব্যাহত');
  x = x.replace(/ব্যাতিক্রম/g, 'ব্যতিক্রম');
  x = x.replace(/ব্যাথা/g, 'ব্যথা');
  x = x.replace(/ব্যাপি/g, 'ব্যাপী');
  x = x.replace(/ব্যাবধান/g, 'ব্যবধান');
  x = x.replace(/ব্যাবহার/g, 'ব্যবহার');
  x = x.replace(/ব্যাভিচার/g, 'ব্যভিচার');
  x = x.replace(/ব্যায় /g, 'ব্যয় ');
  x = x.replace(/ব্যার্থ/g, 'ব্যর্থ');
  x = x.replace(/ব্যুৎপত্তি/g, 'বুৎপত্তি');
  x = x.replace(/ব্রাক্ষণ/g, 'ব্রাহ্মণ');
  x = x.replace(/ভংগ/g, 'ভঙ্গ');
  x = x.replace(/ভংগী/g, 'ভঙ্গি');
  x = x.replace(/ভংগুর/g, 'ভঙ্গুর');
  x = x.replace(/ভনিতা/g, 'ভণিতা');
  x = x.replace(/ভবিষ্যৎবাণী/g, 'ভবিষ্যদ্বাণী');
  x = x.replace(/ভরনপোষণ/g, 'ভরণপোষণ');
  x = x.replace(/ভষ্ম/g, 'ভস্ম');
  x = x.replace(/ভাষ্কর/g, 'ভাস্কর');
  x = x.replace(/ভিখারী/g, 'ভিখারি');
  x = x.replace(/ভিরু/g, 'ভীরু');
  x = x.replace(/ভীড়/g, 'ভিড়');
  x = x.replace(/ভুড়ি/g, 'ভুঁড়ি');
  x = x.replace(/ভুতপূর্ব/g, 'ভূতপূর্ব');
  x = x.replace(/ভুমিষ্ট/g, 'ভূমিষ্ঠ');
  x = x.replace(/ভুয়সী/g, 'ভূয়সী');
  x = x.replace(/ভুরিভোজন/g, 'ভূরিভোজন');
  x = x.replace(/ভূবন/g, 'ভুবন');
  x = x.replace(/ভূয়া/g, 'ভুয়া');
  x = x.replace(/ভূল/g, 'ভুল');
  x = x.replace(/ভৌগলিক/g, 'ভৌগোলিক');
  x = x.replace(/ভ্রমন/g, 'ভ্রমণ');
  x = x.replace(/ভ্রাম্যমান/g, 'ভ্রাম্যমাণ');
  x = x.replace(/ভ্রুক্ষেপ/g, 'ভ্রূক্ষেপ');
  x = x.replace(/মজুরী/g, 'মজুরি');
  x = x.replace(/মণিষা/g, 'মনীষা');
  x = x.replace(/মনমালিন্য/g, 'মনোমালিন্য');
  x = x.replace(/মনিষী/g, 'মনীষী');
  x = x.replace(/মন্ত্রনালয়/g, 'মন্ত্রণালয়');
  x = x.replace(/ময়ুর/g, 'ময়ূর');
  x = x.replace(/মরুদ্যান/g, 'মরূদ্যান');
  x = x.replace(/মশারী/g, 'মশারি');
  x = x.replace(/মস্তিস্ক/g, 'মস্তিষ্ক');
  x = x.replace(/মহত্ত/g, 'মহত্ত্ব');
  x = x.replace(/মহামতী/g, 'মহামতি');
  x = x.replace(/মহামারি/g, 'মহামারী');
  x = x.replace(/মহিয়সী/g, 'মহীয়সী');
  x = x.replace(/ মাংশ /g, ' মাংস ');
  x = x.replace(/মানিক্য/g, 'মানিক');
  x = x.replace(/মাসী/g, 'মাসি');
  x = x.replace(/মাহাত্ম/g, 'মাহাত্ম্য');
  x = x.replace(/মিতালী/g, 'মিতালি');
  x = x.replace(/মিমাংসা/g, 'মীমাংসা');
  x = x.replace(/মিরিচিকা/g, 'মরীচিকা');
  x = x.replace(/মুখস্ত/g, 'মুখস্থ');
  x = x.replace(/মুঢ়/g, 'মূঢ়');
  x = x.replace(/মুত্র/g, 'মূত্র');
  x = x.replace(/মুদ্রন/g, 'মুদ্রণ');
  x = x.replace(/মুমুর্ষ/g, 'মুমূর্ষু');
  x = x.replace(/মুর্খ/g, 'মূর্খ');
  x = x.replace(/মুর্তি/g, 'মূর্তি');
  x = x.replace(/মুর্ধন্য/g, 'মূর্ধন্য');
  x = x.replace(/মুষ্ঠি/g, 'মুষ্টি');
  x = x.replace(/মুহুর্ত/g, 'মুহূর্ত');
  x = x.replace(/মুহূর্মুহু/g, 'মুহুর্মুহু');
  x = x.replace(/মুহ্যবান/g, 'মোহ্যমান/মুহ্যমান');
  x = x.replace(/মূখ্য/g, 'মুখ্য');
  x = x.replace(/মূল্যায়ণ/g, 'মূল্যায়ন');
  x = x.replace(/মৃয়মান/g, 'ম্রিয়মাণ');
  x = x.replace(/মোটামোটি/g, 'মোটামুটি');
  x = x.replace(/মৌনতা/g, 'মৌন');
  x = x.replace(/যক্ষা/g, 'যক্ষ্মা');
  x = x.replace(/যথেষ্ঠ/g, 'যথেষ্ট');
  x = x.replace(/যদ্যাপি/g, 'যদ্যপি');
  x = x.replace(/যন্ত্রনা/g, 'যন্ত্রণা');
  x = x.replace(/যাদুঘর/g, 'জাদুঘর');
  x = x.replace(/রংগ/g, 'রঙ্গ');
  x = x.replace(/রঙিণ/g, 'রঙিন');
  x = x.replace(/রঙ্গিণ/g, 'রঙ্গিন');
  x = x.replace(/রথি/g, 'রথী');
  x = x.replace(/রসায়ণ/g, 'রসায়ন');
  x = x.replace(/রাংগামাটি/g, 'রাঙ্গামাটি');
  x = x.replace(/রামায়ন/g, 'রামায়ণ');
  x = x.replace(/রাষ্ট্রিয়/g, 'রাষ্ট্রীয়');
  x = x.replace(/রূপায়ন/g, 'রূপায়ণ');
  x = x.replace(/রোপন/g, 'রোপণ');
  x = x.replace(/লংকা/g, 'লঙ্কা');
  x = x.replace(/লংঘন/g, 'লঙ্ঘন');
  x = x.replace(/লক্ষী/g, 'লক্ষ্মী');
  x = x.replace(/লক্ষ্যণীয়/g, 'লক্ষণীয়');
  x = x.replace(/লঘুকরণ/g, 'লঘূকরণ');
  x = x.replace(/লজ্জাষ্কর/g, 'লজ্জাকর');
  x = x.replace(/লবন/g, 'লবণ');
  x = x.replace(/লাইব্রেরী/g, 'লাইব্রেরি');
  x = x.replace(/লাবন্য/g, 'লাবণ্য');
  x = x.replace(/শংকর/g, 'শঙ্কর');
  x = x.replace(/শংকা/g, 'শঙ্কা');
  x = x.replace(/শংকিত/g, 'শঙ্কিত');
  x = x.replace(/শরীক/g, 'শরিক');
  x = x.replace(/শশাংক/g, 'শশাঙ্ক');
  x = x.replace(/শশুর/g, 'শ্বশুর');
  x = x.replace(/শশ্মান/g, 'শ্মশান');
  x = x.replace(/শাড়ী/g, 'শাড়ি');
  x = x.replace(/শাষণ/g, 'শাসন');
  x = x.replace(/শারীরীক/g, 'শারীরিক');
  x = x.replace(/শাশুড়ী/g, 'শাশুড়ি');
  x = x.replace(/শিক্ষাঙ্গন/g, 'শিক্ষাঙ্গণ');
  x = x.replace(/শিরচ্ছেদ/g, 'শিরশ্ছেদ');
  x = x.replace(/শিরধার্য/g, 'শিরোধার্য');
  x = x.replace(/শিরনাম/g, 'শিরোনাম');
  x = x.replace(/শিরমণি/g, 'শিরোমণি');
  x = x.replace(/শুভাকাংখী/g, 'শুভাকাঙ্খী');
  x = x.replace(/শুশ্রুষা/g, 'শুশ্রূষা');
  x = x.replace(/শূণ্য/g, 'শুন্য');
  x = x.replace(/শৃংখলা/g, 'শৃঙ্খলা');
  x = x.replace(/শ্বাশত/g, 'শাশ্বত');
  x = x.replace(/শ্রদ্ধাঞ্জলী/g, 'শ্রদ্ধাঞ্জলি');
  x = x.replace(/শ্রদ্ধাভাজনীয়/g, 'শ্রদ্ধাভাজন');
  x = x.replace(/শ্রদ্ধাষ্পদ/g, 'শ্রদ্ধাস্পদ');
  x = x.replace(/শ্রমজীবি/g, 'শ্রমজীবী');
  x = x.replace(/শ্রাবন/g, 'শ্রাবণ');
  x = x.replace(/শ্রীমতি/g, 'শ্রীমতী');
  x = x.replace(/শ্রেষ্ট/g, 'শ্রেষ্ঠ');
  x = x.replace(/ষষ্ট/g, 'ষষ্ঠ');
  x = x.replace(/ষষ্ঠদশ/g, 'ষোড়শ');
  x = x.replace(/সংগা/g, 'সংজ্ঞা');
  x = x.replace(/সংগী/g, 'সঙ্গী');
  x = x.replace(/সখ/g, 'শখ');
  x = x.replace(/সতীন/g, 'সতিন');
  x = x.replace(/সত্বেও/g, 'সত্ত্বেও');
  x = x.replace(/সত্যয়িত/g, 'সত্যায়িত');
  x = x.replace(/সদ্যজাত/g, 'সদ্যোজাত');
  x = x.replace(/সদ্যস্নাত/g, 'সদ্যঃস্নাত');
  x = x.replace(/সনাক্ত/g, 'শনাক্ত');
  x = x.replace(/সন্মান/g, 'সম্মান');
  x = x.replace(/সন্মানীত/g, 'সম্মানীত');
  x = x.replace(/সন্মুখ/g, 'সম্মুখ');
  x = x.replace(/সন্মেলন/g, 'সম্মেলন');
  x = x.replace(/সমীচিন/g, 'সমীচীন');
  x = x.replace(/সম্বরণ/g, 'সংবরণ');
  x = x.replace(/সম্বর্ধনা/g, 'সংবর্ধনা');
  x = x.replace(/সম্বলিত/g, 'সংবলিত');
  x = x.replace(/সরকারী/g, 'সরকারি');
  x = x.replace(/সরণী/g, 'সরণি');
  x = x.replace(/সরনী/g, 'সরণি');
  x = x.replace(/সর্বাঙ্গীন/g, 'সর্বাঙ্গীণ');
  x = x.replace(/সলজ্জিত/g, 'সলজ্জ');
  x = x.replace(/সশংকিত/g, 'সশঙ্ক');
  x = x.replace(/সহকারি/g, 'সহকারী');
  x = x.replace(/সাংগ/g, 'সাঙ্গ');
  x = x.replace(/সাক্ষাতকার/g, 'সাক্ষাৎকার');
  x = x.replace(/সাড়াশী/g, 'সাঁড়াশি');
  x = x.replace(/সাধারন/g, 'সাধারণ');
  x = x.replace(/সান্তনা/g, 'সান্ত্বনা');
  x = x.replace(/সামগ্রীক/g, 'সামগ্রিক');
  x = x.replace(/সৌখিন/g, 'শৌখিন');
  x = x.replace(/স্বচ্ছল/g, 'সচ্ছল');
  x = x.replace(/স্বরস্বতী/g, 'সরস্বতী');
  x = x.replace(/স্বস্ত্রীক/g, 'সস্ত্রীক');
  x = x.replace(/স্বাতন্ত্র/g, 'স্বাতন্ত্র্য');
  x = x.replace(/স্বাধীকার/g, 'স্বাধিকার');
  x = x.replace(/স্বায়ত্ত্বশাসন/g, 'স্বায়ত্তশাসন');
  x = x.replace(/স্মরন/g, 'স্মরণ');
  x = x.replace(/স্রোতঃস্বতী/g, 'স্রোতস্বতী');
  x = x.replace(/হীনমন্যতা/g, 'হীনম্মন্যতা');
  x = x.replace(/হৃদপিণ্ড/g, 'হৃৎপিণ্ড');
  x = x.replace(/হৃদস্পন্দন/g, 'হৃৎস্পন্দন');
  x = x.replace(/হৃৎরোগ/g, 'হৃদরোগ');

//added by YAHYA
    x = x.replace(/আঘাট/g, 'আঘাত');
    x = x.replace(/সাংঘাটিক/g, 'সাংঘাতিক');
    x = x.replace(/আবিস্কার/g, 'আবিষ্কার');
    x = x.replace(/আনুসংগিক/g, 'আনুষঙ্গিক');
    x = x.replace(/শীততাপ/g, 'শীতাতপ');
    x = x.replace(/অতীষ্ঠ/g, 'অতিষ্ঠ');
    x = x.replace(/আষ্ফালন/g, 'আস্ফালন');
    x = x.replace(/আয়ত্ব/g, 'আয়ত্ত');
    x = x.replace(/ঐশ্চর্য/g, 'ঐশ্বর্য');
    x = x.replace(/ক্রুটি/g, 'ত্রুটি');
    x = x.replace(/অংকণ/g, 'অঙ্কন');
    x = x.replace(/কোরাণ/g, 'কোরান');
    x = x.replace(/খরছ/g, 'খরচ');
    x = x.replace(/আরো /g, 'আরও ');
    x = x.replace(/বাহ্যিক লিঙ্ক/g, 'বহিঃসংযোগ');
     x = x.replace(/বাহ্যিক লিংক/g, 'বহিঃসংযোগ');

//নতুন শব্দ এই লাইনের উপরে যোগ হবে।

    // wiki formatting
   x = x.replace(/। </g, '।<');
   x = x.replace(/! -/g, '!-');
   x = x.replace(/“।/g, '।”');
   x = x.replace(/। ”/g, '।”');
   x = x.replace(/! \|/g, '!|');
   x = x.replace(/! }/g, '!}');
   x = x.replace(/! !/g, '!!');
   x = x.replace(/। "/g, '।" ');
   x = x.replace(/! "/g, '!" ');

	// some more formatting for bnwiki
   x = x.replace(/ <ref>/g, '<ref>');
   x = x.replace(/ <ref /g, '<ref ');
   x = x.replace(/{{reflist/g, '{{সূত্র তালিকা');
   x = x.replace(/{{Reflist/g, '{{সূত্র তালিকা');
   x = x.replace(/<\/references>/g, '{{সূত্র তালিকা}}');

   // fixing error

     x = x.replace(/বৈচিত্র/g, 'বৈচিত্র্য');
     x = x.replace(/বৈচিত্র্য্য/g, 'বৈচিত্র্য');
     x = x.replace(/তামুল/g, 'তামোল');
     x = x.replace(/ফূর্তি/g, 'স্ফূর্তি');
     x = x.replace(/স্ফুর্তি/g, 'স্ফূর্তি');
     x = x.replace(/স্স্স্ফূর্তি/g, 'স্ফূর্তি');
     x = x.replace(/স্স্ফূর্তি/g, 'স্ফূর্তি');
     x = x.replace(/নৈশব্দ/g, 'নৈঃশব্দ্য');
     x = x.replace(/নৈঃশব্দ/g, 'নৈঃশব্দ্য');
     x = x.replace(/নৈঃশব্দ্য্য্য/g, 'নৈঃশব্দ্য');
     x = x.replace(/নৈঃশব্দ্য্য/g, 'নৈঃশব্দ্য');
     x = x.replace(/নৈঃশব্দ্যতা/g, 'নৈঃশব্দ্য');
     x = x.replace(/বৈশিষ্ট্য্য/g, 'বৈশিষ্ট্য');
     x = x.replace(/নিরালস্য্য/g, 'নিরালস্য');
     x = x.replace(/দৈর্ঘ্য্য/g, 'দৈর্ঘ্য');
     x = x.replace(/কেচাঁ/g, 'কেঁচা');
     x = x.replace(/কেঁচাঁ/g, 'কেঁচা');
     x = x.replace(/অন্তঃসত্বা/g, 'অন্তঃসত্ত্বা');
     x = x.replace(/অন্তসত্তা/g, 'অন্তঃসত্ত্বা');
     x = x.replace(/অন্তঃসত্তা/g, 'অন্তঃসত্ত্বা');
     x = x.replace(/ন্দ্ব্ব/g, 'ন্দ্ব');
     x = x.replace(/ধ্ব্ব/g, 'ধ্ব');
     x = x.replace(/ত্ব্ব/g, 'ত্ব');
     x = x.replace(/ঁঁ/g, 'ঁ');
     x = x.replace(/মাননি\u09DF/g, 'মাননী\u09DF');
     x = x.replace(/মাননিয়/g, 'মাননীয়');
     x = x.replace(/বিদূষী/g, 'বিদুষী');
     x = x.replace(/বয়সীয়াল/g, 'বয়সিয়াল');
     x = x.replace(/রিস্কা/g, 'রিক্সা');
     //x = x.replace(/অনসুয়া/g, 'অনসূয়া');
     x = x.replace(/অনুসূয়া/g, 'অনসুয়া');
     x = x.replace(/মুমূর্ষুু/g, 'মুমূর্ষু');
     x = x.replace(/নিরবিচ্ছিন্ন/g, 'নিরবচ্ছিন্ন');
     x = x.replace(/ণ্ধ/g, 'ন্ধ');

    // removes double space between anything
    x = x.replace(/  /g, ' '); // makes double space into one
    x = x.replace(/   /g, ' '); //makes triple space into one

    x = x.replace(/য়/g, '\u09DF');

   $('#wpTextbox1').val(x);
     customAlert('বানান শুদ্ধি সম্পন্ন!','3000');
                        }
                    }
                }
            }
        });

    };
    
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
    if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
        $.when(mw.loader.using('ext.wikiEditor'), $.ready)
            .then(bnSpellChecker);
    }
});


// This script aligns dates into one of two formats allowed by [[WP:MOSNUM]].
// PLEASE READ THE DOCUMENTATION at [[User:Ohconfucius/script/MOSNUM dates]] (click on the link above) before using.

// Feedback and constructive criticism are welcome

/**
 * TemplateScript adds configurable templates and scripts to the sidebar, and adds an example regex editor.
 * @see https://meta.wikimedia.org/wiki/TemplateScript
 */
// <pre>
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
	$.ajax(
		'//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js',
		{dataType: 'script', cache: true}
	).done(function () {
		$.when(
			mw.loader.using(['mediawiki.util']),
			$.ajax('//en.wikipedia.org/w/index.php?title=User:Ohconfucius/script/MOSNUM_utils.js&action=raw&ctype=text/javascript',
				{dataType: 'script', cache: true}),
			$.ready
		).done(function () {
			var add = function() {
            return mw.util.addPortletLink.apply(mw.util, arguments);
			};

			$(add('p-tb', '#', 'DATES to dmy', 'dmy-unitfixer', 'Align all dates to dmy', '', '')).click(ohc_all_to_dmy_driver);
			$(add('p-tb', '#', 'DATES to mdy', 'mdy-unitfixer', 'Align all dates to mdy', '', '')).click(ohc_all_to_mdy_driver);
//			$(add('p-tb', '#', 'Expand ref dates', 't-expandref', 'Expand month names within refs', '', '')).click(ohc_expand_ref_dates_driver);
//			$(add('p-tb', '#', 'Expand all dates', 't-expandall', 'Expand month names throughout', '', '')).click(ohc_expand_all_dates_driver);
			$( add('p-tb', '#', 'US-slash dates', 't-US', 'US-slash', '', '') ).click(ohc_US_slash_dates_driver);
			$( add('p-tb', '#', 'UK-slash dates', 't-UK', 'UK-slash', '', '') ).click(ohc_UK_slash_dates_driver);
		});
	});
}

function ohc_fix_unambiguous_dates()
{
	// resolvable ambiguous date formats
	// UK style
	ohc_regex(/([^-\w/:\.])@DD\.@MM\.@YYYY(?=[^-–/\w&])/gi, "$1@Day @Month @YYYY", function(d) {
		if (d.d == d.m) return true;
		if (d.d > 12) return true;
		return false;
		});
	ohc_regex(/([^-\w/:\.])@DD\/@MM\/@YYYY(?=[^-–/\w&])/gi, "$1@Day @Month @YYYY", function(d) {
		if (d.d == d.m) return true;
		if (d.d > 12) return true;
		return false;
		});

	// US style
	ohc_regex(/([^-\w/:\.])@MM\.@DD\.@YYYY(?=[^-–/\w&])/gi, "$1@Month @Day, @YYYY", function(d) {
		if (d.d > 12) return true;
		return false;
		});
	ohc_regex(/([^-\w/:\.])@MM\/@DD\/@YYYY(?=[^-–/\w&])/gi, "$1@Month @Day, @YYYY", function(d) {
		if (d.d > 12) return true;
		return false;
		});
}

function ohc_US_slash_dates_to_mdy()
{
//ranges
	ohc_regex(/([^-\d/:\.])@MM\/@DD\/@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@MM\/@DD\/@YYNN(?=[^-–/\w&])/gi, "$1@Mon1 @Day1, @Year1$2 – @Mon2 @Day2, @Year2");
	ohc_regex(/([^-\d/:\.])@MM\.@DD\.@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@MM\.@DD\.@YYNN(?=[^-–/\w&])/gi, "$1@Mon1 @Day1, @Year1$2 – @Mon2 @Day2, @Year2");
	ohc_regex(/(\| ?)@MM\/@DD\/@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@MM\/@DD\/@YYNN(?=\s*\|)/gi, "$1@Mon1 @Day1, @Year1$2 – @Mon2 @Day2, @Year2");
	ohc_regex(/(\| ?)@MM\.@DD\.@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@MM\.@DD\.@YYNN(?=\s*\|)/gi, "$1@Mon1 @Day1, @Year1$2 – @Mon @Day2, @Year2");

// resolvable ambiguous date formats
	ohc_regex(/([^-\d/:\.])@MM\/@DD\/@YYNN(?=[^-–/\w&])/gi, '$1@Month @Day, @YYYY');
	ohc_regex(/([^-\d/:\.])@MM\.@DD\.@YYNN(?=[^-–/\w&])/gi, '$1@Month @Day, @YYYY');
	ohc_regex(/([^-\d/:\.])@MM[-–]@DD[-–]@YYNN(?=[^-–/\w&])/gi, '$1@Month @Day, @YYYY');
	ohc_regex(/(\| ?)@MM\/@DD\/@YYNN(?=\s*\|)/gi, '$1@Month @Day, @YYYY');
	ohc_regex(/(\| ?)@MM\.@DD\.@YYNN(?=\s*\|)/gi, '$1@Month @Day, @YYYY');
//	ohc_regex(/(\| ?)@MM[-–]@DD[-–]@YYNN(?=\s*\|)/gi, '$1@Month @Day, @YYYY');
}
 
function ohc_UK_slash_dates_to_dmy()
{
//ranges
	ohc_regex(/([^-\d/:\.])@DD\/@MM\/@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@DD\/@MM\/@YYNN(?=[^-–/\w&])/gi, "$1@Day1 @Mon1 @Year1$2 – @Day2 @Mon2 @Year2");
	ohc_regex(/([^-\d/:\.])@DD\.@MM\.@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@DD\.@MM\.@YYNN(?=[^-–/\w&])/gi, "$1@Day1 @Mon1 @Year1$2 – @Day2 @Mon2 @Year2");
	ohc_regex(/(\| ?)@DD\/@MM\/@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@DD\/@MM\/@YYNN(?=\s*\|)/gi, "$1@Day1 @Mon1 @Year1$2 – @Day2 @Mon2 @Year2");
	ohc_regex(/(\| ?)@DD\.@MM\.@YYNN(&nbsp;|\s)?(?:(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?)@DD\.@MM\.@YYNN(?=\s*\|)/gi, "$1@Day1 @Mon1 @Year1$2 – @Day2 @Mon2 @Year2");

// resolvable ambiguous date formats
	ohc_regex(/([^-\d/:\.])@DD\/@MM\/@YYNN(?=[^-–/\w&])/gi, '$1@Day @Month @YYYY');
	ohc_regex(/([^-\d/:\.])@DD\.@MM\.@YYNN(?=[^-–/\w&])/gi, '$1@Day @Month @YYYY');
	ohc_regex(/([^-\d/:\.])@DD[-–]@MM[-–]@YYNN(?=[^-–/\w&])/gi, '$1@Day @Month @YYYY');
	ohc_regex(/(\| ?)@DD\/@MM\/@YYNN(?=\s*\|)/gi, '$1@Day @Month @YYYY');
	ohc_regex(/(\| ?)@DD\.@MM\.@YYNN(?=\s*\|)/gi, '$1@Day @Month @YYYY');
//	ohc_regex(/(\| ?)@DD[-–]@MM[-–]@YYNN(?=\s*\|)/gi, '$1@Day @Month @YYYY');
}

function ohc_remove_leading_zeroes()
{
	ohc_regex(/(\D[^\w\/])@Month\s@ZD@th?,?\s@YYYY(?=\W\D)/gi, "$1@LMonth @Day, @LYear");
	ohc_regex(/(\D[^\w\/])@Month\s@ZD@th?(?=\W\D)/gi, "$1@LMonth @Day");
	ohc_regex(/(\D[^\w\/])@ZD@th?\s@Month\s@YYYY(?=\W\D)/gi, "$1@Day @LMonth @LYear");
	ohc_regex(/(\D[^\w\/])@ZD@th?\s@Month(?=\W\D)/gi, "$1@Day @LMonth");
}

function ohc_delink_dates()
{
	//add missing space between wikilinks
	regex(/(\]\])(\[\[)/gi, '$1 $2');  //remove (?!file:) to ensure a space between all links
 
	 // rem redundant quote marks and parentheses
	regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)\'\'\'([^|}\[\]]*)\'\'\'(?=\s*[|}])/gi, "$1$2");
	regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)\'\'([^|}\[\]]*)\'\'(?=\s*[|}])/gi, "$1$2");
	regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)\"([^|}\[\]]*)\"(?=\s*[|}])/gi, "$1$2");
	regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)\(([^|}\[\]]*)\)(?=\s*[|}])/gi, "$1$2");

//delink unpiped dates
	//delink full dates
	ohc_regex(/\[\[@Day[\s_](?:of[\s_])?@Month(?:\]\]\s?\[\[\| )@YYYY\]\]/gi, "@Day @LMonth @YYYY");
	ohc_regex(/\[\[@Month (?:the\s)?@Day(?:\]\],? \[\[|, )@YYYY\]\]/gi, "@LMonth @Day, @YYYY");

	//delink yyyy-mm-dd dates
	ohc_regex(/\[\[@YYYY(?:\]\]-\[\[|-)@MM-@DD\]\]/gi, "@YYYY-@MM-@DD");
	ohc_regex(/@YYYY-\[\[@MM-@DD\]\]/gi, "@YYYY-@MM-@DD");

	//underscore and nbsp in linked dates
	ohc_regex(/\[\[@DD@th?(?:\s|_|&nbsp;)@Month\]\]/gi, "@Day @LMonth");
	ohc_regex(/\[\[@Month(?:\s|_|&nbsp;)@DD@th?\]\]@th?/gi, "@LMonth @Day"); //consolidated regex with flexible removal of ordinal simple date
	ohc_regex(/\[\[@Day @Month\]\]/gi, "@Day @LMonth");
	ohc_regex(/\[\[@Month @YYYY\]\]/gi, "@LMonth @YYYY");
	ohc_regex(/\[\[@YYYY\]\]/gi, "@YYYY");

	//remove leading zero and links from linked date
	ohc_regex(/\[\[@Month(?:[ _]|&nbsp;)@ZD@th\]\]/gi, "@LMonth @Day");
	ohc_regex(/\[\[@ZD@th(?:[ _]|&nbsp;)@Month\]\]/gi, "@Day @LMonth");

	// remove nowrap template from dm and md dates
	ohc_regex(/(date[ ]*=[ ]*)\{\{(?:j|no ?(?:break|wrap))\|(?:@DD(?:[ _]|&nbsp;)@Month)( @yyyy|)\}\}/gi, '$1@DD @LMonth$2');
	ohc_regex(/(date[ ]*=[ ]*)\{\{(?:j|no ?(?:break|wrap))\|(?:@Month(?:[ _]|&nbsp;)@DD)( @yyyy|)\}\}/gi, '$1@LMonth @DD$2');
	
	//delink single dm or 'dth the m'
	ohc_regex(/(?:the\s)?\[\[@Day@th?[\s_](?:of[\s_])?@Month\]\]/gi, "@Day @LMonth");
	//delink single md or 'm the dth'
	ohc_regex(/\[\[@Month[\s_](?:the[\s_])?@Day@th?\]\](?=\W)/gi, "@LMonth @Day");

//month+day piped
	ohc_regex(/\[\[(?:@dd@th?[\s_](?:of[\s_])?@month|@month[\s_]@dd@th?)\|((?:@month |)@day)@th?\]\]/gi, "$1");
	ohc_regex(/\[\[(?:@dd@th?[\s_](?:of[\s_])?@month|@month[\s_]@dd@th?)\|@Day@th?[\s_](@month|)\]\]/gi, "@Day $1");

//	ohc_regex(/\[\[@month @dd(?:#[^|]+|)\|([^|\]]+)@th?\]\]/gi, "$1");
//	ohc_regex(/\[\[@dd @month(?:#[^|]+|)\|([^|\]]+)@th?\]\]/gi, "$1");
	ohc_regex(/\[\[@month @yyyy(?:#[^|]+|)\|([^|\]]+)\]\]/gi, "$1");

	//month+day+year pseudo-ISO dates
	ohc_regex(/\[\[@Month @DD\|\d\d-\d\d\]\]-(?:\[\[)?(?:@yyyy[^|]*\|)?@YYYY(?:\]\])/gi, "@Day @LMonth @YYYY");
	ohc_regex(/\[\[@DD\s@Month\|\d\d-\d\d\]\]-(?:\[\[)?(?:@yyyy[^|]*\|)?@YYYY(?:\]\])/gi, "@Day @LMonth @YYYY");

	//'[[month day|xxXxx]]Xyyyy ' to 'month day, year'
	ohc_regex(/\[\[@Month\s@Day\|@dd.@dd\]\].@YYYY/gi, "@LMonth @Day, @YYYY");
	 //'[[day month|xxXxx]]Xyyyy' to 'day month year'
	ohc_regex(/\[\[@Day\s@Month\|@dd.@dd\]\].@YYYY/gi, "@Day @LMonth @YYYY");

// century
	regex(/\[\[((?:first|second|third|(?:four|fif|six|seven|eigh|nin|ten|eleven|twelf|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twentie)th|twenty[\s\-]first[\s\-])centur(?:y|ies)(?:\s(?:AD|BC|CE|BCE))?)\]\]/gi, '$1');
	regex(/\[\[(?:first|second|third|(?:four|fif|six|seven|eigh|nin|ten|eleven|twelf|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twentie)th|twenty[\s\-]first)[\s\-_]centur(?:y|ies)(?:\s(?:AD|BC|CE|BCE))?\|([^\]]{1,30})\]\]/gi, '$1');
	regex(/\[\[(\d{1,2}(?:st|[nr]d|th))[\s\-_](centur(?:y|ies))(\s(?:AD|BC|CE|BCE)|)\]\]/gi, '$1 $2$3');
	ohc_regex(/\[\[\d{1,2}@th[\s\-_]centur(?:y|ies)(?:\s(?:AD|BC|CE|BCE)|)\|([^\]]{1,30})\]\]/gi, '$1');

	// months
	ohc_regex(/\[\[@Month\]\]/gi, "@LMonth");
	ohc_regex(/\[\[@FullMonth\|([^\]]{1,30})\]\]/gi, "$1");

	// decades and years
	regex(/(\d{1,3}0)[‘`´’′]?s/g, '$1s');
	regex(/\[\[(\d{1,3}0)\'?s\]\]/g, '$1s');
	regex(/\[\[\d{1,3}0\'?s?\|([^\]]{1,30})\]\]/g, '$1');
	regex(/\[\[(\d{1,3}0)\'?(s)?\s(AD|BC|CE|BCE)\]\]/gi, '$1$2 $3');
	regex(/\[\[(\d{1,4}[\s_]?)(AD|BC|CE|BCE)\]\]/gi, '$1$2');
	regex(/\[\[(AD|BC|CE|BCE)([\s_]?)(\d{1,4})\]\]/gi, '$1$2$3');
	ohc_regex(/([-–])\[\[\s?@yyyy\s?\|\s?(\d{2,4})\s?\]\]/gi, '$1$2'); //piped year
	regex(/\[\[([12]\d{3}|[1-9]\d{0,2})\]\]/gi, '$1');
	regex(/\[\[\d{1,3}0\'?s?\s(?:AD|BC|CE|BCE)\|([^\]]{1,30})\]\]/gi, '$1');
	regex(/\[\[\d{1,3}0\'?s?\s\(decade\)\|([^\]]{1,30})\]\]/gi, '$1');

	//month+year
	//Identify surprise or 'Easter egg' diversions linking month+years to year articles. Turn them into month+year links to be dealt with below
	ohc_regex(/\[\[@yyyy in[^|\]]+\|@Day @Month @YYYY\]\]/gi, "@Day @LMonth @YYYY");
	ohc_regex(/\[\[@yyyy in[^|\]]+\|@Month @Day,? @YYYY\]\]/gi, "@LMonth @Day, @YYYY");
	ohc_regex(/\[\[@yyyy#[^|\]]+\|(@month\s|)(@yyyy)\]\]/gi, "$1$2");
	ohc_regex(/\[\[@yyyy#[^|\]]+\|(@month|@yyyy)\]\]/gi, "$1");
	ohc_regex(/\[\[(@month\s@yyyy)\]\]/gi, "$1");
	ohc_regex(/\[\[@month\s@yyyy\|([^\]]{1,30})\]\]/gi, "$1");
	ohc_regex(/\[\[(?:List of |)Bollywood films of @yyyy\|@YYYY\]\](?= [^\[]{2}^B)/gi, "@YYYY");

	ohc_regex(/(\[\[@yyyy[^|\]]+\|@yyyy)(\]\])( season)/gi, "$1$3$2");

	//removed piped years when in full date (excepting disambiguated parentheses - updated 24/2/2012)
//	ohc_regex(/\[\[[^|\]\(\)]{1,32}\|@YYYY\]\]/gi, '@Year');  // 23/6/2021 – disabled delinking "other" year-in articles

	//Identify surprise or 'Easter egg' diversions linking months to year or "year in" articles.
	ohc_regex(/\[\[\d{1,4}#[^|\]]+\|@Month\]\]/gi, "@LMonth");
	ohc_regex(/\[\[@yyyy \w[^|\]]{3,12}\|@Year\]\]/gi, '@Year');

	// month and day piped
	ohc_regex(/\[\[@month[\s_]@day\|@MM-@DD\]\]/gi, "@MM-@DD");
	ohc_regex(/\[\[@month[\s_]@day\|([^\]]{1,30})\]\]/gi, "$1");
	ohc_regex(/\[\[@day(?:\s|_|@th )(?:of[\s_]|)?@month\|([^\]]{1,30})\]\]/gi, "$1");

	//years piped
	regex(/\[\[\d{1,4}\|([^\]]{1,30})\]\]/gi, '$1');
}

function ohc_fix_common_errors()
{
	ohc_regex(/(\d)<sup>@th<\/sup>/gi, '$1th');
	// remove dashbot comment from dates
	regex(/<!-- ?DASHBot ?-->/gi, '');
	ohc_regex(/(\|\s*(?:date|year)\s*=)\s*c(?:irca|a\.)?\s?((?:@day |)@month @year)(?=[\s\n]*[<|}])/gi, '$1c. $2'); //add space
//common cs1 errors
	regex(/(\|\s*(?:date|year)\s*=)\s*(1[7-9]\d|20[0-1])\?(?=[\s\n]*[<|}])/gi, '$1c. $20'); 
	regex(/(\|\s*(?:date|year)\s*=\s*(1[7-9])\d{2})[-–](\d{2})(?=[\s\n]*[<|}])/gi, '$1–$2$3'); 
//	regex(/(\|\s*(?:date|year)\s*=\s*(20)[0-1]\d)[-–]([0-2]\d)(?=[\s\n]*[<|}])/gi, '$1–$2$3'); 
	regex(/(\|\s*(?:date|year)\s*=\s*)@YYYY\s*[-–/]\s*@YYYY(?=[\s\n]*[<|}])/gi, '$1@YYYY1–@YYYY2'); //common cs1 error
	regex(/(\|\s*(?:date)\s*=)\s*s(pring|ummer),?\s*((?:1[7-9]\d|20[0-1])\d)(?=[\s\n]*[<|}])/gi, '$1S$2 $3'); //common cs1 error
	regex(/(\|\s*(?:date)\s*=)\s*a(utumn),?\s*((?:1[7-9]\d|20[0-1])\d)(?=[\s\n]*[<|}])/gi, '$1A$2 $3'); //common cs1 error
	regex(/(\|\s*(?:date)\s*=)\s*f(all),?\s*((?:1[7-9]\d|20[0-1])\d)(?=[\s\n]*[<|}])/gi, '$1F$2 $3'); //common cs1 error
	regex(/(\|\s*(?:date)\s*=)\s*w(inter),?\s*((?:1[7-9]\d|20[0-1])\d)(?=[\s\n]*[<|}])/gi, '$1W$2 $3'); //common cs1 error
	ohc_regex(/(\|\s*access-?date\s*=)\s*(@month @year)(?=[\s\n]*[<|}])/gi, '$11 $2'); //common cs1 error
//	ohc_regex(/(\|\s*date\s*=\s*)@year\?(?=[\s\n]*[<|}])/gi, '$1@Year'); //common cs1 error
//	ohc_regex(/(\|\s*(?:date|year)\s*=)\s*@year\?(?=[\s\n]*[<|}])/gi, '$1c. @Year'); //common cs1 error
//	ohc_regex(/(\|\s*(?:date|year)\s*=)\s*(@month @year)\?(?=[\s\n]*[<|}])/gi, '$1c. $2'); //common cs1 error
	ohc_regex(/(\|\s*access-?date\s*=)\s*@month @day, (1[7-9]\d{2}|2000)(?=[\s\n]*[<|}])/gi, '$1'); //rem access date before Wikipedia (জানুয়ারি 2001)
	ohc_regex(/(\|\s*access-?date\s*=)\s*@day @month.? (1[7-9]\d{2}|2000)(?=[\s\n]*[<|}])/gi, '$1'); //rem access date before Wikipedia (জানুয়ারি 2001)
	ohc_regex(/(\|\s*access-?date\s*=)\s*31( (?:এপ্রিল|জুন|সেপ্টেম্বর|নভেম্বর) @year)(?=[\s\n]*[<|}])/gi, '$130$2'); //rem nonsense access date (short months)
	ohc_regex(/(\|\s*access-?date\s*=)\s*29( ফেব্রুয়ারি (?:200[1235679]|201[1345789]))(?=[\s\n]*[<|}])/gi, '$128$2'); //rem nonsense access date 29 ফেব্রুয়ারি (non-leap year)
	ohc_regex(/(\|\s*access-?date\s*=)\s*(?:3[01])( ফেব্রুয়ারি @yyyy)(?=[\s\n]*[<|}])/gi, '$128$2'); //rem nonsense access dates ফেব্রুয়ারি
	regex(/(\|\s*access-?date\s*=)\s*(\d{4})(?=[\s\n]*[<|}])/gi, ''); //common cs1 error
	
	//month+day+year pseudo-ISO dates
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*@dd)-@Mon-@YYYY/gi, "$1 @FullMonth @YYYY");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@YYYY-@DD-@Mon/gi, "$1 @DD @FullMonth @YYYY");

	regex(/(\|\s*(?:date|year)\s*=)\s*(?:(?:date |)unknown|(?:not? |non-|un)date[ds])(?=[\s\n]*[<|}])/gi, '$1n.d.'); //common cs1 error
	regex(/(\|\s*(?:date|year)\s*=)\s*n\.?d(?=[\s\n]*[<|}])/gi, '$1n.d.'); //common cs1 error
	regex(/(\|\s*)year(\s*=\s*)(?=n\.?d\.)(?=[\s\n]*[<|}])/gi, '$1date$2'); //common cs1 error

   // remove parasitic metadata -  days of the week/descriptives
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:[^|}\d]*|)@Day\s+@Month\s+@YYYY((?:[a-z]\b|)\s?)[^|<}]*(?=[\s\n]*[<|}])/gi, "$1@Day @Month @YYYY$2"); //rem negate "<", "hyphens" "dashes" 26/6/2020
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)[^|}]*@Month\s+@Day,\s+@YYYY((?:[a-z]\b|)\s?)[^|<}]*(?=[\s\n]*[<|}])/gi, "$1@Month @Day, @YYYY$2"); //rem negate "<", "hyphens" "dashes" 26/6/2020
//	ohc_regex(/(\|\s*date\s*=\s*)(?:[^|}–<]*\D|)@Day\s+@Month\s+@YYYY ?– ?@Day\s+@Month\s+@YYYY[^|}–<]*(?=[\s\n]*[<|}])/gi, "$1@Day1 @Mon1 @Year1 – @Day2 @Mon2 @Year2");
//	ohc_regex(/(\|\s*date\s*=\s*)[^|}–<]*@Month\s+@Day,\s+@YYYY ?– ?@Month @Day, @YYYY[^|}–<]*(?=[\s\n]*[<|}])/gi, "$1@Mon1 @Day1, @Year1 – @@Mon2 Day2, @Year2");
//	regex(/(\|\s*author\s*=\s*)(?:posted|published)(?: by\b| on\b|)[\s:](?=\w)/gi, "$1");
//	regex(/(\|\s*(?:date|archive-?date|access-?date|author|year)\s*=\s*)(?:accessed|retrieved|entered|posted|published|(?:last |)updated?|©)(?: by\b| on\b|)[\s:]*(?=\w)/gi, "$1");
	regex(/(\|\s*(?:author|first|last)\s*=\s*)(?:by\b|on\b)[\s:]*(?=\w)/gi, "$1");
	regex(/(\|\s*(?:date|archive-?date|access-?date|author|first|last)\s*=\s*)(?:(?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day,?)\s/gi, "$1");
	regex(/(\|\s*(?:date|archive-?date|access-?date|author|first|last)\s*=\s*)(?:Mon|Tues?|Wed|Thur?|Fri|Sat)[\.,]?\s/gi, "$1"); //<!-- rem "Sun" - false positives -->

   // remove deprecated parameters (|day= and |month)
 	ohc_regex(/(\|\s*)day(?:\s*=\s*)@DD ?\| ?month(?:\s*=\s*)@Month ?\| ?year(?:\s*=\s*)@YYYY(?=[|}\s])/gi, '$1date=@Day @Month @Year'); 
 	ohc_regex(/(\|\s*)year(?:\s*=\s*)@YYYY ?\| ?month(?:\s*=\s*)@Month ?\| ?day(?:\s*=\s*)@DD(?=[|}\s])/gi, '$1date=@Month @Day, @Year'); 
 	
// typos
	ohc_regex(/(date *= *)@Day @Month ?@th/gi, '$1@Day @Month'); 
	ohc_regex(/(date *= *)@Day @Month\w(?= \d{3,4})/gi, '$1@Day @Month'); 

	ohc_regex(/(date *= *(?:[12]?\d|30|31) )(জানুয়ারি|Febr)[\w ]?[aur]{3,4}\w{0,2}(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1$2uary'); 
	ohc_regex(/(date *= *(?:[12]?\d|30|31) )J[anu]{3,5}r\w{0,2}(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1জানুয়ারি');
	ohc_regex(/(date *= *(?:[12]?\d) )Febua?r\w{0,2}(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1ফেব্রুয়ারি');
	ohc_regex(/(date *= *(?:[12]?\d|30|31) )M\w{2,3}ch(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1মার্চ'); 
	ohc_regex(/(date *= *(?:[12]?\d|30) )A[bpv\[]\w{2,3}l\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1এপ্রিল');
	ohc_regex(/(date *= *(?:[12]?\d|30|31) )Ma[tui](?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1মে'); 
	ohc_regex(/(date *= *(?:[12]?\d|30) )J\wn\w(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুন'); 
	ohc_regex(/(date *= *(?:[12]?\d|30) )J\w{1,2}e(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুন'); 
	ohc_regex(/(date *= *(?:[12]?\d|30|31) )জুলাই\w{1,2}(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুলাই'); 
	ohc_regex(/(date *= *(?:[12]?\d|30|31) )A[oug]{2,3}\w{1,4}t(?:\w|us)?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1আগষ্ট'); 
	ohc_regex(/(date *= *(?:[12]?\d|30|31) )(সেপ্টেম্বর|নভেম্বর|ডিসেম্বর)\w{2,4}b[er]{1,2}\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1$2ember'); 
	ohc_regex(/(date *= *(?:[12]?\d|30) )S\w{0,2}p[ \[]?\w{2,5}[er]{2,3}\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1সেপ্টেম্বর'); 
	ohc_regex(/(date *= *(?:[12]?\d|30|31) )O\w{0,2}t\w{1,3}[er]{2,3}\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1অক্টোবর'); 
	ohc_regex(/(date *= *(?:[12]?\d|30) )[MN]\w{1,2}[bv] ?\w{1,3}b[er]{1,2}\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1নভেম্বর'); 
	ohc_regex(/(date *= *(?:[12]?\d|30|31) )D[ie]?[cs] ?\w{1,4}b[er]{1,2}\w?(?= (?:1[6-9]\d|20[01])\d\b)/gi, '$1ডিসেম্বর'); 

	ohc_regex(/(date *= *)@Month\w(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1@Month'); //rem stray digit at the end of year string
 
	ohc_regex(/(date *= *)(জানুয়ারি|Febr)[\w ]?[aur]{3,4}\w{0,2}(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1$2uary'); 
	ohc_regex(/(date *= *)J[anu]{3,5}r\w{0,2}(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1জানুয়ারি');
	ohc_regex(/(date *= *)Febua?r\w{0,2}(?=(?: (?:[12]?\d),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1ফেব্রুয়ারি');
	ohc_regex(/(date *= *)M\w{2,3}ch(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1মার্চ'); 
	ohc_regex(/(date *= *)A[bpv\[]\w{2,3}l\w?(?=(?: (?:[12]?\d|30),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1এপ্রিল');
	ohc_regex(/(date *= *)Ma[tui](?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1মে'); 
	ohc_regex(/(date *= *)J\wn\w(?=(?: (?:[12]?\d|30),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুন'); 
	ohc_regex(/(date *= *)J\w{1,2}e(?=(?: (?:[12]?\d|30),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুন'); 
	ohc_regex(/(date *= *)জুলাই\w{1,2}(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1জুলাই'); 
	ohc_regex(/(date *= *)A[oug]{2,3}\w{1,4}t(?:\w|us)?(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1আগষ্ট'); 
	ohc_regex(/(date *= *)(সেপ্টেম্বর|নভেম্বর|ডিসেম্বর)\w{2,4}b[er]{1,2}\w?(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1$2ember'); 
	ohc_regex(/(date *= *)S\w{0,2}p[ \[]?\w{2,5}[er]{2,3}\w?(?=(?: (?:[12]?\d|30),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1সেপ্টেম্বর'); 
	ohc_regex(/(date *= *)O\w{0,2}t\w{1,3}[er]{2,3}\w?(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1অক্টোবর'); 
	ohc_regex(/(date *= *)[MN]\w{1,2}[bv] ?\w{1,3}b[er]{1,2}\w?(?=(?: (?:[12]?\d|30),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1নভেম্বর'); 
	ohc_regex(/(date *= *)D[ie]?[cs] ?\w{1,4}b[er]{1,2}\w?(?=(?: (?:[12]?\d|30|31),?|) (?:1[6-9]\d|20[01])\d\b)/gi, '$1ডিসেম্বর'); 

//insert comma to separate date from army unit
	ohc_regex(/@FullMonth ((?:the |)\d\d*@th (?:Air(?:borne|)|Arm(?:ou?red|y)|Artillery|Battalion|Brigade|Co(?:mpan|)y|Division|Fleet|Group|Infantry|Land|Panzer|Regiment|Squadron|Sqn)\b)/g, "@Month, $1");

	// remove parasitic metadata - time
	ohc_regex(/(\|\s*\w*date\s*=\s*@yyyy-@mm-@dd)\s?(?:T[0-2]\d:[0-5]\d:[0-5]\d(?:\s*|&nbsp;|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|Z))(?=\s*[|}])/g, "$1");
	ohc_regex(/(\|\s*\w*date\s*=\s*@month @day,? @yyyy)\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|))(?=\|)/g, "$1");
	ohc_regex(/(\|\s*\w*date\s*=\s*@day @month,? @yyyy)\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|))(?=\|)/g, "$1");
	ohc_regex(/(\|\s*\w*date\s*=\s*\w[\w\s]+@month @day,? @yyyy)\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|))(?=\|)/g, "$1");
	ohc_regex(/(\|\s*\w*date\s*=\s*\w[\w\s]+@day @month,? @yyyy)\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|))(?=\|)/g, "$1");
	ohc_regex(/(\|\s*\w*date\s*=[^:|}]*)\s?(?:T?[0-2]\d:[0-5]\d:[0-5]\d(?:\s*|&nbsp;|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|Z))/g, "$1");

//  add back spaces or comma or remove other single artefact after date string	
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:on |)@Day\s{,2}@Month\s{,2}@YYYY[^a-z{}]?(?=\s*[|}\n])/gi, "$1@Day @Month @YYYY$2");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:on |)@Month\s{,2}@Day,?\s{,2}@YYYY[^a-z{}]?(?=\s*[|}\n])/gi, "$1@Month @Day, @YYYY$2");
	//long-hand palliative for observed failure to insert spaces
	ohc_regex(/(\|\s*(?:archive|access|air)-?date\s*=\s*)(?:on |)([0-2]?\d|30|31)\s*(জানুয়ারি|ফেব্রুয়ারি|মার্চ|এপ্রিল|মে|জুন|জুলাই|আগষ্ট|সেপ্টেম্বর|অক্টোবর|নভেম্বর|ডিসেম্বর)\s*((?:19\d|20[0-1])\d\s?)[^|{}\s<>]*(?=\s*[|}])/gi, "$1$2 $3 $4");
//	ohc_regex(/(\|\s*(?:publication|)-?date\s*=\s*)(?:on |)@Day\s*@Month\s*@YYYY([a-z]\s?|\s?)\w*[^|{}<>]*(?=[|}])/gi, "$1@Day @Month @YYYY$2");
//	ohc_regex(/(\|\s*(?:publication|)-?date\s*=\s*)(?:on |)@Month\s*@Day,\s*@YYYY([a-z]\s?|\s?)\w*[^|{}<>]*(?=[|}])/gi, "$1@Month @Day, @YYYY$2");

//remove extraneous bracket //from Batty
	ohc_regex(/{{(\s*[Cc]it(?:e|ation))([^}]+)(\s*\|\s*(?:archive-?|access-?|publication-?)?date\s*=\s*)([\w\s-]+)\](?=\s*[\|}<])/gi, '{{$1$2$3$4');  

	//fix bda template redirect
//	regex(/\{\{bda\|([^}]+)\}\}/gi, '{{birth date and age|$1}}');
//	regex(/\{\{dda\|([^}]+)\}\}/gi, '{{death date and age|$1}}');

	//zap redundant {{date}}, {{accessdate}} {{retrieved}}, {{monthname}} and {{#dateformat}}
//	regex(/({{(?:end|start)[-–]date)\|df=y(?:es|)/gi, "$1"); //rem deprecated parameter - disabled: doesn't work here, so ejected to the formatting script
	ohc_regex(/{{#formatdate:@YYYY-@MM-@DD(?:[^\}]*)}}/gi, "@Day @Month @YYYY");
	regex(/{{#formatdate:([^}]+)}}/gi, "$1");
	regex(/\{\{#dateformat:([^}\|]+)(?:\|dmy|\|mdy)?\}\}/gi, '$1');
//	ohc_regex(/(date[ ]*=[ ]*)\{\{(?:Start|End) ?date(?:\|df=y(?:es|)|)\|@YYYY\|@MM\|@DD(?:\|df=y(?:es|)|)\}\}/gi, '$1@Month @DD, @YYYY');  //stripping start/end template notes inside "|date=" parameter (line 72)
	ohc_regex(/{{#formatdate:@YYYY-@MM-@DD(?:\|(?:[dmy]{3}|iso)|)}}/gi, "@Day @Month @YYYY");
	ohc_regex(/\{\{date\|@YYYY-@MM-@DD\}\}/gi, "@Day @Month @YYYY");
	ohc_regex(/\{\{date\|(@DD[\-\s]@Mon|@Mon[\-\s]@DD)\}\}/gi, "@Day @Month");
	regex(/\{\{date\|([^}\|]+)(?:\|l?(?:[dmy]{3}|iso|none|link))?\}\}/gi, '$1');
	ohc_regex(/[ ]*\{\{accessdate\|@YYYY-@MM-@DD[ ]*\}\}/gi, " Retrieved @YYYY-@MM-@DD");
	ohc_regex(/[ ]*\{\{retrieved[ ]*\|[ ]accessdate=([\-\w, ]*)\}\}/gi, " Retrieved $1");
//	ohc_regex(/(date[ ]*=[ ]*|\w{2,}[ ]*)\{\{(?:start|end).date[^|}]*(?:\|df=y(?:es|)|)\|@YYYY(?:\|df=y(?:es|)|)\}\}/gi, '$1@YYYY');  //stripping start/end template (disabling to placate Pigsonthewing)
//	ohc_regex(/\{\{(?:Start|End) date(?:\|df=y(?:es|)|)\|@YYYY\|@MM\}\}/gi, '@Month @YYYY')  //stripping start/end template notes
//	ohc_regex(/<!--(?:Use)? \{\{(?:Start|End) date\|@YYYY\|@MM\|@DD\}\} -->/gi, '');  //stripping start/end template notes
	ohc_regex(/(\{\{MONTHNAME\|@MM\}\})/gi, "@Month")

//expand one and two-digit years in ranges
	regex(/(\()@Month @YYYY[-–]@Month @YYNN(\))/gi, '$1@Month1 @YYYY1 – @Month2 @YYYY2$2');
	regex(/(\(1[789])(\d)(1)[-–]([2-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(1[789])(\d)(2)[-–]([3-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(1[789])(\d)(3)[-–]([4-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(1[789])(\d)(4)[-–]([5-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(1[789])(\d)(5)[-–]([6-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(1[789])(\d)(6)[-–]([7-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(1[789])(\d)(7)[-–]([8-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(1[789])(\d)(8)[-–](9\))/gi, '$1$2$3–$2$4');
	regex(/(\(20)([01])(1)[-–]([2-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(20)([01])(2)[-–]([3-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(20)([01])(3)[-–]([4-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(20)([01])(4)[-–]([5-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(20)([01])(5)[-–]([6-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(20)([01])(6)[-–]([7-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(20)([01])(7)[-–]([8-9]\))/gi, '$1$2$3–$2$4');
	regex(/(\(20)([01])(8)[-–](9\))/gi, '$1$2$3–$2$4');

	ohc_regex(/(\W)@DD@th?, @DD@th?((?:[ ]|&nbsp;)(?:and|&|to|or)(?:[ ]|&nbsp;))@DD@th?(?:\sof\s?)?([ ]|&nbsp;)@Month(?=\W)/gi, '$1@Day1, @Day2$2@Day3$3@LMonth');
	ohc_regex(/(\W)@DD@th?((?:[ ]|&nbsp;)(?:and|&|to|or)(?:[ ]|&nbsp;))@DD@th?(?:\sof\s?|)([ ]|&nbsp;)@Month(?=\W)/gi, '$1@Day1$2@Day2$3@LMonth');
	ohc_regex(/(\W)the @DD@th(?:\sof|)\s@Month,? @YYYY(?=\W\D)/g, '$1@Day @LMonth @YYYY');
	ohc_regex(/(\W)the @DD@th(?:\sof|)\s@Month(?=\W\D)/g, '$1@Day @LMonth');
	ohc_regex(/(\W)@Day@th?(?:\sof|)([ _]|&nbsp;|{{(?:break|nbsp)}})@Month(?=[^|\]\w])/gi, '$1@Day$2@LMonth');
	ohc_regex(/(\W)@Month\s(?:the\s)?@DD@th?,(?:\sthe\s)?(?: |&nbsp;)@DD@th?(\s(?:and|&|to|or)(?:[ _]|&nbsp;))(?:the\s)?@DD@th?(?=[^|\]\w])/gi, '$1@LMonth @Day1, @Day2$2@Day3');
	ohc_regex(/(\W)(@month)\s(@day)((?:,\s@day){0,6}),?(\/|\s?[-–]\s?|\s(?:and|&|to|or)\s+?)@Day@th?(?:,?(?:[ _]|&nbsp;)|\sof\s)?(\d{3,4}\W\D)/gi, '$1$2 $3$4$5@Day, $6');
	ohc_regex(/(\W)(@month)\s(@day)((?:,\s@day){0,6}),?(\/|\s?[-–]\s?|\s(?:and|&|to|or)\s+?)@Day@th?(?=\W\D)/gi, '$1$2 $3$4$5@Day');
	ohc_regex(/(\W)@Month([ _]|&nbsp;|{{(?:break|nbsp)}})(?:the\s)?@DD@th?,? @Year/gi, '$1@LMonth$2@Day, @Year');
	ohc_regex(/(\W)@Month @Day(?:\sof|,|)([ _]|&nbsp;|{{(?:break|nbsp)}})@Year(?=[^|\]\w])/gi, '$1@Month @Day,$2@Year');

	// consolidating/amalgamating date fields
	ohc_regex(/(\|[ ]*date[ ]*=[ ]*@day)\s*\|[ ]*month=[ ]*(@month)\s*\|[ ]*year=[ ]*(@yyyy[ ]*)(?=[|}\s])/gi, "$1 $2 $3");
	ohc_regex(/(\|[ ]*date[ ]*=[ ]*@day.?@month)\s*\|[ ]*year=[ ]*(@yyyy[ ]*)(?=[|}\s])/gi, "$1 $2");
	ohc_regex(/(\|[ ]*date[ ]*=[ ]*@month.?@day)\s*\|[ ]*year=[ ]*(@yyyy[ ]*)(?=[|}\s])/gi, "$1 $2");

	// eliminating dates and time placed in author parameter
	//removing artefacts from Indian news sites (TNN আগষ্ট 30, 2012, 05.46AM)
	ohc_regex(/(\|\s*author\s*=\s*(?:[A-Z]{2,3}\b))(?:[^|}]*)\d{4}, [\d\.:]{4,5}(&nbsp;|)[AP]M IST(?=[ ]*\|)/g, '$1$2');
//	ohc_regex(/(\|\s*author=(?:[^\[\]|{}]*))(TNN|PTI) @day @month @yyyy, [\d\.:]{4,5}(&nbsp;|)[AP]M IST(?=[ ]*\|)/g, '$1$2');

	ohc_regex(/(\|\s*author\s*=\s*)@month @day,? @yyyy\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|)|)(?=\|)/g, "$1");
	ohc_regex(/(\|\s*author\s*=\s*)@day @month,? @yyyy\s?(?:,? [0-2]?\d[\.:][0-5]\d(?:\s*|&nbsp;)(?:[apAP][mM]\s*|)(?:GMT\s*|UTC\s*|[A-Z]{1,2}[DS]T\s*|)|)(?=\|)/g, "$1");
	ohc_regex(/(\|\s*author\s*=\s*\w[\w\s]+)@month @day,? @yyyy(?:[^\[\]|{}]*)(?=[|}])/g, "$1");
	ohc_regex(/(\|\s*author\s*=\s*\w[\w\s]+)@day @month,? @yyyy(?:[^\[\]|{}]*)(?=[|}])/g, "$1");
	ohc_regex(/(\|\s*author\s*=\s*(?:\w[\w\s]+)?)@dd-@mm-@yyyy/gi, "$1");
	ohc_regex(/(\|\s*author\s*=\s*(?:\w[\w\s]+)?)@YYYY-@MM-@DD ?/gi, "$1");
	regex(/(\|\s*(?:date|archive-?date|access-?date|author)\s*=\s*(?:\w[\w\s]+)?)[0-2]\d:[0-5]\d(?:[ ]|&nbsp;)?(?:[ap]m|[ap]\.m\.|)(?: ?(?:[A-Z]{1,2}T|UTC)[\.,]?|)/gi, "$1");
//	ohc_regex(/(\|\s*author\s*=\s*(?:\w[\w\s]+)?)\s*[0-2]\d[\.:][0-5]\d(?:[\.:][0-5]\d|)/gi, "$1"); //let's see later if we need this

	// eliminating mm-dd-yyyy dates
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@MM[-–\/\.=\s](1[3-9]|2\d|3[01])[-–\/\.=\s]@YYYY/gi, "$1@Month $2, @YYYY");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Mon[-–\/\.=\s](1[3-9]|2\d|3[01])[-–\/\.=\s]@YYYY/gi, "$1@Month $2, @YYYY");
	ohc_regex(/[ ](?:Accessed|Retrieved)(?:(?: online|) on|:?)[ ]@MM[-–\/\.=\s](1[3-9]|2\d|3[01])[-–\/\.=\s]@YYYY(?=\D)/gi, " Retrieved @Month $1, @YYYY");
//	ohc_regex(/[ ](?:Accessed|Retrieved)(?:(?: online|) on|:?)[ ]@YYYY,? @Month @DD(?=\D)/gi, " Retrieved @Day @Month @YYYY");

	ohc_regex(/([ =|])@Mon[-–](1[3-9]|2\d|3[01])[-–]@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY"); 
	ohc_regex(/([ =|])@Mon\/(1[3-9]|2\d|3[01])\/@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY"); 
	ohc_regex(/([ =|])@Mon\.(1[3-9]|2\d|3[01])\.@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY"); 
	ohc_regex(/([ =|])@Mon (1[3-9]|2\d|3[01]) @YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY"); 
	ohc_regex(/([ =|])@MM[-–](1[3-9]|2\d|3[01])[-–]@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY"); 
	ohc_regex(/([ =|])@MM\/(1[3-9]|2\d|3[01])\/@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY"); 
	ohc_regex(/([ =|])@MM\.(1[3-9]|2\d|3[01])\.@YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY"); 
	ohc_regex(/([ =|])@MM (1[3-9]|2\d|3[01]) @YYYY(?=[^-–\d/])/gi, "$1@Mon $2, @YYYY"); 

	// eliminating dd-mm-yyyy dates (assumed default)
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@DD[-–\/\.=\s]@MM[-–\/\.=\s]@YYYY/gi, "$1@Day @Month @YYYY");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@DD[-–\/\.=\s]@Mon[-–\/\.=\s]@YYYY/gi, "$1@Day @Month @YYYY");
	ohc_regex(/[ ](?:Accessed|Retrieved)(?:(?: online|) on|:?)[ ]@DD[-–\/\.=\s]@MM[-–\/\.=\s]@YYYY(?=\D)/gi, " Retrieved @Day @Month @YYYY");
	ohc_regex(/[ ](?:Accessed|Retrieved)(?:(?: online|) on|:?)[ ]@YYYY,? @Month @DD(?=\D)/gi, " Retrieved @Day @Month @YYYY");
	ohc_regex(/([ =|])@DD[-–]@Mon[-–]@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY"); 
	ohc_regex(/([ =|])@DD\/@Mon\/@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY"); 
	ohc_regex(/([ =|])@DD\.@Mon\.@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY");
	ohc_regex(/([ =|])@DD @Mon @YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY"); 
	ohc_regex(/([ =|])@DD[-–]@MM[-–]@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY"); 
	ohc_regex(/([ =|])@DD\/@MM\/@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY"); 
	ohc_regex(/([ =|])@DD\.@MM\.@YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY");
	ohc_regex(/([ =|])@DD @MM @YYYY(?=[^-–\d/])/gi, "$1@Day @Month @YYYY"); 
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@DD[-–\/\.=\s]@Month[-–\/\.=\s]@YYNN(?=\s*[|}\n])/gi, '$1@Day @Month @YYYY');

//convert yyyy-dd-mm to yyyy-mm-dd
	ohc_regex(/{{(\s*[Cc]it(?:e|ation))([^}]+)(\s*\|\s*(?:publication|archive|access|air|)-?date\s*=\s*(?:1[0-9]|20)\d{2})[-/\.=\s](1[3-9]|2\d|3[01])[-/\.=\s](0?\d|1[0-2])(\s*[\|}<])/gi, '{{$1$2$3-$5-$4$6'); //from Batty

// eliminating other errant formats
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)([0-2]?\d|30|31) @Month \2,? @YYYY(?=\s*[|}])/gi, "$1$2 @Month @YYYY"); //repeated digits
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Day ?@Month ?200([01]\d)[^\s|}]?(?=\s*[|}])/gi, "$1@Day @Month 20$2");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month ?@Day,? ?200([01]\d)[^\s|}]?(?=\s*[|}])/gi, "$1@Month @Day, 20$2");

	ohc_regex(/([ ]\()@DD-@MM-@YYYY(\)\W)/gi, '$1@Day @Month @YYYY$2');
	ohc_regex(/([ ]\()@DD-@Month-@YYYY(\)\W)/gi, '$1@Day @Month @YYYY$2');
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@Month, @DD, @YYYY(?=\s*[|}])/gi, "$1@Day @Month @YYYY");
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@DD[\.,] @Month,? @YYYY(?=\s*[|}])/gi, "$1@Day @Month @YYYY");
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@YYYY,? @Month @DD(?=\s*[|}])/gi, "$1@Day @Month @YYYY");
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@YYYY,? @DD @Month(?=\s*[|}])/gi, "$1@Day @Month @YYYY");
	ohc_regex(/[ ]\(@YYYY,? @Month @DD\)/gi, " (@Day @Month @YYYY)");
	ohc_regex(/[ ]\(@YYYY @MM @DD\)/gi, " (@Day @Month @YYYY)");
	ohc_regex(/[ ]\(@YYYY, @DD @Month\)/gi, " (@Day @Month @YYYY)");
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@YYYY,? @Month(?=\s*[|}])/gi, "$1@Month @YYYY");
	ohc_regex(/[ ]\(@YYYY, @Month\)/gi, " (@Month @YYYY)");
	ohc_regex(/[ ]\(@Mon@YYYY\)/gi, " (@Mon @YYYY)");

	//CS1 errors ISO-like dates (too few or too many digits)
	ohc_regex(/(date\s*=\s*)(?:\[\[)?@YYYY(?:\]\][–—‐]\[\[|[–—‐])@MM[\-–—‐]@DD(?:\]\])?(?=\s*[|}])/gi, "$1@YYYY-@ZM-@ZD"); //ndashes and emdashes
	ohc_regex(/(\|\s*access-?date\s*=)\s*@YYYY-0[–—]@DD(?=\s*[|}])/gi, ""); //rem nonsense access date
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@YYYY[-–—]@MM[-–—]@DD(?=\s*[|}])/gi, "$1@YYYY-@ZM-@ZD"); //ndashes and emdashes
//	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)@YYYY[\-–—‐]@MM(?=\s*[|}])/gi, "$1@Month @YYYY"); //transform "yyyy-mm" to "month year"
	ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[–—]@MM[–—]@DD([^-\w\/%,<][^<]*?<\/ref>)/gi, "$1$2@Day @Month @YYYY$3");
	ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-]@MM[-]([1-9])([^-\w\/%,<][^<]*?<\/ref>)/gi, "$1$2$3 @Month @YYYY$4");  

	// spaces and commas between month and year
	ohc_regex(/@Month(?:,?|\s+of|)(\s|&nbsp;)@YYYY(?=\D)/gi, "@LMonth$1@YYYY");

// fix month names (capitalize, remove dots)
	ohc_regex(/(\W)@DD\s@FullMonth(\s+|\s*,)/gi, "$1@Day @FullMonth$2");
	ohc_regex(/(\W)@DD\s@Mon(\s+|\s*,)/gi, "$1@Day @Mon$2");
	ohc_regex(/(\W)@FullMonth\s@DD(\s+|\s*,)/gi, "$1@FullMonth @Day$2");
	ohc_regex(/(\W)@Mon\s@DD(\s+|\s*,)/gi, "$1@Mon @Day$2");
	regex(/(\d(?:st|nd|rd|th) )C(entur(?:ies|y))(?=[ ]*(=|BC|AD|CE))/g, '$1c$2');
//	regex(/(\d(?:st|nd|rd|th) )C(entur(?:ies|y))(?![ \-][A-Z]\w*|''|")/g, '$1c$2');

	//spaces and commas - in date formats
	ohc_regex(/(\D\W\[?\[?@dd)[ ]+(@month)(\]\])?[ ]*,[ ]*(\[?\[?@yyyy(\sAD|\sBC|\sCE|\sBCE|)\]?\]?\W\D)/gi, "$1 $2$3 $4");
	ohc_regex(/(\D\W\[?\[?)(@month)[ ]+(@dd)(\]?\]?)(?:[ ]*,[ ]*)(\[?\[?@yyyy(\sAD|\sBC|\sCE|\sBCE|)\]?\]?\W\D)/gi, "$1$2 $3$4, $5");
	ohc_regex(/(\D\W\[?\[?)(@month)[ ]+(@dd)(\]?\]?)[ ]+(\[?\[?@yyyy(\sAD|\sBC|\sCE|\sBCE|)\]?\]?\W\D)/gi, "$1$2 $3$4, $5");

	ohc_regex(/(@month)(?:, | of )(@yyyy\w)/gi, "$1 $2"); //repeat after delinking

	// spaces and commas - md-md and dm-dm date ranges
	ohc_regex(/(\D\W)@Month\s@DD(&nbsp;|\s)(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?@Month\s@DD(?=\W\D)/gi, "$1@LMonth1 @Day1$2– @LMonth2 @Day2");
	ohc_regex(/(\D\W)@Month\s@DD(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?@Month\s@DD(?=\W\D)/gi, "$1@LMonth1 @Day1 – @LMonth2 @Day2");
	ohc_regex(/(\D\W)@DD\s@Month(&nbsp;|\s)(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?@DD\s@Month(?=\W\D)/gi, "$1@Day1 @LMonth1$2– @Day2 @LMonth2");
	ohc_regex(/(\D\W)@DD\s@Month(?:[-–—]|&[mn]dash;)(?:&nbsp;|\s)?@DD\s@Month(?=\W\D)/gi, "$1@Day1 @LMonth1 – @Day2 @LMonth2");

	// spaces and commas - d-dm and md-d date ranges
	ohc_regex(/(\D\W)@Month(\s|&nbsp;)@DD@th?(?:(?:\s*|&nbsp;|)[-–](?:\s*|&nbsp;|))@DD@th?(?=\W\D)/gi, "$1@LMonth1$2@Day1–@Day2");
	ohc_regex(/(\D\W)@DD@th?(?:(?:\s*|&nbsp;|)[-–](?:\s*|&nbsp;|))@DD@th?(\s|&nbsp;)@Month(?=\W\D)/gi, "$1@Day1–@Day2$2@LMonth1");

	// spaces and commas between month and year (again)
	ohc_regex(/@Month(?:,\s+|\s+of\s+)@YYYY(\w)/gi, "@LMonth @YYYY$1");
}

/** ------------------------------------------------------------------------- */
/// ISO to long format

function ohc_ISO_to_dmy_in_citations()
{
	//ISO dates within single citation
	ohc_regex(/(\|\s*(?:publication|archive|access|air|designation\d?_|)-?date\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Day @Month @YYYY");
}

function ohc_ISO_to_mdy_in_citations()
{
	//ISO dates within single citation
	ohc_regex(/(\|\s*(?:publication|archive|access|air|designation\d?_|)-?date\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi,  "$1@Month @Day, @YYYY");
}

function ohc_ISO_to_dmy_in_references()
{
	//multiple calls for multiple dates within single citation
	ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD([^-\w\/%,<][^<]*?<\/ref>)/gi, "$1$2@Day @Month @YYYY$3");
	ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD(<\/ref>)/gi, "$1$2@Day @Month @YYYY$3");
}

function ohc_ISO_to_mdy_in_references()
{
	//multiple calls for multiple dates within single citation
	ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD([^-\w\/%,<][^<]*?<\/ref>)/gi, "$1$2@Month @Day, @YYYY$3");
	ohc_regex(/(<ref[^>]*>[^<]+?)([\s\(])@YYYY[-–]@MM[-–]@DD(<\/ref>)/gi, "$1$2@Month @Day, @YYYY$3");
}

// currently unused
function ohc_ISO_to_dmy_anywhere()
{
	//multiple calls for multiple dates within single citation
	ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Day @Month @YYYY$2');
	ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Day @Month @YYYY$2');
	ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Day @Month @YYYY$2');
}

// currently unused
function ohc_ISO_to_mdy_anywhere()
{
	//multiple calls for multiple dates within single citation
	ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Month @Day, @YYYY$2');
	ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Month @Day, @YYYY$2');
	ohc_regex(/([^-\w/])@YYYY[-–]@MM[-–]@DD([^-\w/])/gi, '$1@Month @Day, @YYYY$2');
}

function ohc_delink_ISO_to_dmy()
{
	ohc_ISO_to_dmy_in_citations();
	ohc_ISO_to_dmy_in_references();
	regex(/([^\w\/\-%,])@YYYY-@MM-@DD(<\s?\/ref.*?>)/g, '$1@Day @Month @Year$2');
	ohc_regex(/(\|\|[ ]*)@YYYY[-–]@MM[-–]@DD([ ]*\|\|)/gi, '$1{{dts|format=dmy|@YYYY|@MM|@DD}}$2');  //dts template for sortable tables
	ohc_regex(/(\{\{dts\|format=)mdy\|/gi, '$1dmy|');  //flip dts template formats
}

function ohc_delink_ISO_to_mdy()
{
	ohc_ISO_to_mdy_in_citations();
	ohc_ISO_to_mdy_in_references();
	regex(/([^\w\/\-%,])@YYYY-@MM-@DD(<\s?\/ref.*?>)/g, '$1@Month @Day, @Year$2');
	ohc_regex(/(\|\|[ ]*)@YYYY[-–]@MM[-–]@DD([ ]*\|\|)/gi, '$1{{dts|@YYYY|@MM|@DD}}$2');  //dts template for sortable tables (mdy is default)
	ohc_regex(/(\{\{dts\|)format=(?:mdy|dmy|) ?\|/gi, '$1');  //flip dts template formats
}

function ohc_delink_year_in_X()
{
//	ohc_regex(/\{\{(?:avyear|by|baseball\syear|fy|ly|mlby|mlb\syear|scy|sdy)\|(@year)\}\}/gi, "$1"); //disabled 3/5/21 discussion at https://en.wikipedia.org/w/index.php?title=Wikipedia_talk:WikiProject_Baseball&oldid=1021203365#Links_to_baseball_year_articles_in_infobox?
//	ohc_regex(/\{\{(?:avyear|by|baseball\syear|fy|ly|mlby|mlb\syear|scy|sdy)\|@year\|(@year)\}\}/gi, "$1");
	ohc_regex(/\[\[@yyyy\sin\s[^|\]]+\|((?:(?:@day |)@month |)@yyyy)\]\]/gi, '$1');
	regex(/\[\[(?:\d{4}[-–]\d{2} in English football)\|((?:(?:@Day |)@Month |)@YYYY)\]\]/gi, '$1'); 

	regex(/\[\[\d{4} Major League Baseball season\|(\d{4})(\sseason)?\]\]/gi, '$1$2');
}


// format parameter must be 'dmy' or 'mdy'
function ohc_fix_dts_template(format)
{
	// dts - format=dmy in this case (per D12000)
	// per {{dts}} doc, remove the obsolete link=off param
	regex(/(\{\{dts[^}]*)(?:\|link=off)/gi, '$1');
	ohc_regex(/(\{\{dts\s*\|\s*@year\s*\|\s*@month\s*\|\s*@day\s*\|\s*format=)(?:dmy|mdy)(\}\})/gi, '$1'+format+'$2');
	ohc_regex(/(\{\{dts\s*\|\s*format=)(?:dmy|mdy)(\s*\|\s*@year\s*\|\s*@month\s*\|\s*@day\s*\}\})/gi, '$1'+format+'$2');
	ohc_regex(/(\{\{dts\s*\|\s*@year\s*\|\s*@month\s*\|\s*@day\s*)(\}\})/gi, '$1|format='+format+'$2');

   // stripping – {{dts}} serves no purpose inside date parameters
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)\{\{dts\s*\|\s*format=(?:dmy|mdy)\s*\|\s*([|}]*)\}\}(?=\s*[|}])/gi, "$1$2");
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)\{\{dts\s*\|\s*([|}]*)(?:\|\s*format=(?:dmy|mdy)\s*|)\}\}(?=\s*[|}])/gi, "$1$2");
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)\{\{dts\s*\|\s*format=(?:dmy|mdy)\s*\|\s*@YYYY(\s*\|\s*|-)@MM(\s*\|\s*|-)@DD\s*\}\}(?=\s*[|}])/gi, "$1@YYYY-@MM-@DD ");
	ohc_regex(/(\|(?:[\w ]*)date\s*=\s*)\{\{dts\s*\|\s*@YYYY(\s*\|\s*|-)@MM(\s*\|\s*|-)@DD\s*\|\s*format=(?:dmy|mdy)\s*\}\}(?=\s*[|}])/gi, "$1@YYYY-@MM-@DD ");
}

// format parameter must be 'dmy' or 'mdy'
function ohc_fix_gr_template(format)
{
	// GR - date formatting parameter
	// per {GR} doc, insert date formatting param
	regex(/(\{\{GR\|\d\d?)(?!\|date)/gi, '$1|dateform=' + format);
}

function ohc_dates_to_dmy()
{
	regex(/\|df=[mdy]{3}(?:-all|)(?=\s*[|}])/gi, '');
	regex(/\|format=mdy/gi, '|format=dmy');
	//change start and end templates; vgrelease new v=2 or mdy is default
	regex(/(\{\{(?:start date|end date)[^|}]*\|)df=ye?s?\|([^}]*df=ye?s?)/gi, '$1$2');
	regex(/(\{\{vgrelease new[^|}]*\|)(?:v=1\||)([A-Z]{2,3}\|)/g, '$1v=2|$2');
	ohc_regex(/(\|\s*(?:begin|end|first|last)\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Day @Month @YYYY"); //spotted at [[Template:Infobox recurring event]]
 
	//change birth and death templates
	regex(/(\{\{(?:(?:Birth|Death) date(?: and age|)|launch|release|start)[^}]*\|)m(f=ye?s?)/gi, '$1d$2'); // substitute df for mf 
	regex(/(\{\{(?:(?:Birth|Death) date(?: and age|)|launch|release|start|film ?date|Wayback)[\|\d]+)(\}\})/gi, '$1|df=y$2'); //insert df parameter
	regex(/(\{\{(?:(?:Birth|Death) date(?: and age|)|launch|release|start|film ?date|Wayback)[\|\d]+\|)df=ye?s?\|([^}]*df=ye?s?)/gi, '$1$2'); //put date format parameter at the end
	regex(/(\{\{(?:start date|end date)\|)df=ye?s?\|((?:1[789]|20)\d{2}\}\})/gi, '$1$2');  //date format parameter not needed – year only

	//convert date ranges (md,d,d-dy to d,d,d-dmy; md,d,d-d to d,d,d-dm; md,d,d to d,d,dm)
	ohc_regex(/(\D\W)@Month((?:\s@day?,?){1,6}),?(\/|\s?(?:[-–]|&ndash;)\s?|(?:[ _]|&nbsp;)(?:and|&|to|or)(?:[ _]|&nbsp;)+?)@Day,?\s(?:of\s)?(@yyyy\W\D)/gi, "$1$2$3@Day @LMonth $4");
	ohc_regex(/(\D\W)@Month((?:\s@day?,?){1,6}),?(\/|\s?(?:[-–]|&ndash;)\s?|(?:[ _]|&nbsp;)(?:and|&|to|or)(?:[ _]|&nbsp;)+?)@Day(?=\W\D)/gi, "$1$2$3@Day @LMonth");

//	ohc_regex(/(\D\W)@Month((?:\s@day?,?){1,6}) @Day(?=\W\D)/gi, "$1$2 @Day @LMonth"); //disabling as unlikely and ungrammatical constructions causing false positives

	//'md, md,' to 'dm, dm,'
	ohc_regex(/(\D\W)@Month @Day, @Month @Day(?=[,\.]\W\D)/gi, "$1@Day1 @LMonth1, @Day2 @LMonth2");

	//convert simple mdy dates to dmy
	ohc_regex(/(p(?:g?\.?|age) ?\d+|p(?:p\.?|ages) ?\d+[-–]\d+), @Month((?:\s@day?,?){1,6}) @Day(?=\W\D)/gi, "$1. $2 @Day @LMonth");
	ohc_regex(/(\D\W)@Month\s@Day,?\s@Year(\s?(?:AD|BC|CE|BCE)\W\D)/gi, "$1@Day @LMonth @Year$2");
	ohc_regex(/(\|\s*term_(?:end|start)\d\s*=\s*|\D\W)@Month\s@Day,?\s@YYYY(?=\W\D)/gi, "$1@Day @LMonth @Year");
	ohc_regex(/(\|\s*term_(?:end|start)\d\s*=\s*|\D\W)@Month\s@Day(?=\W\D)/gi, "$1@Day @LMonth");

	//Month+day_number " 7th মার্চ" -> "7 মার্চ"
	ohc_regex(/(\D\W)@Day\s@Month\s@YYYY(?=\W\D)/gi, "$1@Day @LMonth @Year");
	ohc_regex(/(\D\W)@Day\s@Month(?=\W\D)/gi, "$1@Day @LMonth");
	ohc_regex(/(\D\W)@Month\s@Day,?\s@Year(?=\W\D)/gi, "$1@Day @LMonth @Year");

	//dates with embedded nbsp
	ohc_regex(/(\D\W)@Month([ _]|&nbsp;)(\d{1,2},(?: |&nbsp;)\d{1,2}(?:\s(?:and|&|to|or)(?:[ _]|&nbsp;))\d{1,2})(?=[^|\]\w])/gi, '$1$3$2@LMonth ');
	ohc_regex(/(\D\W)@Month([ _]|&nbsp;|{{(?:break|nbsp)}})@Day,([ _]|&nbsp;|{{(?:break|nbsp)}})@YYYY(?=[^|\]\w])/gi, '$1@Day$2@Month$3@Year');

	//remove comma
	ohc_regex(/(\D\W)@Day\s@Month,\s?@Year(?=\W\D)/gi, "$1@Day @LMonth @Year");

	//	remove "the" from "on the dd month"
	ohc_regex(/(on |by )the @Day\s@Month(?=[ ,\)\.])/gi, "$1@Day @LMonth");

	//remove space from date range conversion
	ohc_regex(/(\D ) @Day(\/|\s?(?:[-–]|&ndash;)\s?|(?:[ _]|&nbsp;)(?:and|&|to|or)(?:[ _]|&nbsp;)+?)/gi, "$1@Day$2");
}

function ohc_dates_to_mdy()
{
	//change birth and death templates – mf=y is the default; vgrelease new v=2 or mdy is default
	regex(/\|df=[mdy]{3}(?:-all|)(?=\s*[|}])/gi, '');
	regex(/\|df=y(?:es|)(?=[|}\s])/gi, '');
	regex(/(mf=y(?:es|)\|[^}]*\|)(?:mf=y(?:es|)\|)/gi, '$1');
	regex(/(\{\{vgrelease new[^|}]*\|)(?:v=2\||)([A-Z]{2,3}\|)/g, '$1$2');
	ohc_regex(/(\|\s*(?:begin|end|first|last)\s*=\s*)@YYYY[-–]@MM[-–]@DD(?=\W\D)/gi, "$1@Month @Day, @YYYY");

	//convert date ranges (d,d,d-dmy to md,d,d-dy; d,d,d-dm to md,d,d-d; dm,d,d to md,d,d)
	ohc_regex(/(\D\W)@Day((?:, @day){0,5})(\/|\s?(?:[-–]|&ndash;)\s?|\s(?:and|&|to|or)\s+?)@Day\s@Month,? @YYYY(?=\W\D)/gi, "$1@LMonth @Day1$2$3@Day2, @YYYY");
	ohc_regex(/(\D\W)@Day((?:, @day){0,5})(\/|\s?(?:[-–]|&ndash;)\s?|\s(?:and|&|to|or)\s+?)@Day\s@Month(?=\W\D)/gi, "$1@LMonth @Day1$2$3@Day2");
//	ohc_regex(/(\D\W)@Day((?:, @day){0,5})\s@Month,? @YYYY(?=\W\D)/gi, "$1@LMonth @Day1$2, @YYYY"); //disabling as unlikely and ungrammatical constructions causing false positives
//	ohc_regex(/(\D\W)@Day((?:, @day){0,5})\s@Month(?=\W\D)/gi, "$1@LMonth @Day1$2"); //disabling as unlikely and ungrammatical constructions causing false positives

	//'dm, dm,' to 'md, md,'
	ohc_regex(/(\D\W)@Day @Month, @Day @Month(?=[,\.]?\W\D)/gi, "$1@LMonth1 @Day1, @LMonth2 @Day2");

	//convert simple dmy dates to mdy
	ohc_regex(/(p(?:g?\.?|age) ?\d+|p(?:p\.?|ages) ?\d+[-–]\d+), @Month((?:\s@day?,?){1,6}) @Day(?=\W\D)/gi, "$1. @LMonth $2 @Day");
	ohc_regex(/(\D\W)@Day(\s|&nbsp;)@Month,?(\s|&nbsp;)@Year(?=\W\D)/gi, "$1@LMonth$2@Day,$3@Year");
	ohc_regex(/(\|\s*term_(?:end|start)\d\s*=\s*|\D\W)@Day[ ]+@Month,?\s@YYYY(?=\W\D)/gi, "$1@LMonth @Day, @Year");
	ohc_regex(/(\|\s*term_(?:end|start)\d\s*=\s*|\D\W)@Day[ ]+@Month(?=\W\D)/gi, "$1@LMonth @Day");

	//Month+day_number "মার্চ 7th" -> "মার্চ 7"
	ohc_regex(/(\D\W)@Month\s@Day@th?,?\s@YYYY(?=\W\D)/gi, "$1@LMonth @Day, @YYYY");
	ohc_regex(/(\D\W)@Day@th?(\s|&nbsp;)@Month(\s|&nbsp;)@YYYY(?=\W\D)/gi, "$1@LMonth$2@Day,$3@YYYY");
	ohc_regex(/(\D\W)@Month(\s|&nbsp;)@Day(?=\W\D)/gi, "$1@LMonth$2@Day");
	ohc_regex(/(\D\W)@Day@th?(\s|&nbsp;)@Month([,\.])(?=\W\D)/gi, "$1@LMonth$2@Day$3");

	//add comma where missing
	ohc_regex(/(\D\W)@Month\s@Day,?\s@YYYY,?(?=\s\w)/gi, "$1@LMonth @Day, @YYYY,");
	//rem superfluous comma where applicable
	ohc_regex(/(\D[^\w\/])@Month\s@ZD,,(?=\W\D|\b)/gi, "$1@LMonth @Day,");
}

function ohc_fix_dmy_redundancies()
{
	//month-range redundancies (repeating month names)
	ohc_regex(/([\D]@dd)@th? @Month[ ]{1,2}((?:to|and|-|–)[ ]{1,2}@dd)@th? @Month/, "$1 $2 @LMonth", function(d1, d2) {
		if (d1.m == d2.m) return true;
		return false;
	});
}
//not currently used
function ohc_fix_mdy_redundancies()
{
	//month-range redundancies (repeating month names)
	ohc_regex(/(@Month[ ]{1,2}@dd)@th? (to|and|-|–)[ ]{1,2}@Month[ ]{1,2}@DD@th?/, "$1 $2 @LDay", function(d1, d2) {
		if (d1.m == d2.m) return true;
		return false;
	});
}

function ohc_expand_ref_dates()
{
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month @YYYY(?=\s*[|}])/gi, "$1@FullMonth @YYYY");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Day @Month @YYYY(?=\s*[|}])/gi, "$1@Day @FullMonth @YYYY");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month @Day, @YYYY(?=\s*[|}])/gi, "$1@FullMonth @Day, @YYYY");

	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)((?:[01-2]?\d|30|31) |)@Month @YYYY ?(?:-|–|&ndash;) ?((?:[01-3]?\d|30|31) |)@Month @YYYY(?=\s*[|}])/gi, "$1$2 @FullMonth1 @YYYY1 – $3@FullMonth2 @YYYY2");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month @Day(, (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @Day, @YYYY(?=\s*[|}])/gi, "$1@FullMonth1 @Day1$2 – @FullMonth2 @Day2, @YYYY");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Day @Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Day @Month @YYYY(?=\s*[|}])/gi, "$1@Day1 @FullMonth1$2 – @Day2 @FullMonth2 @YYYY");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month,? @YYYY(?=\s*[|}])/gi, "$1@FullMonth1$2 – @FullMonth2 @YYYY");
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)((?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @YYYY(?=\s*[|}])/gi, "$1@$2 – @FullMonth @YYYY");

	ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))((?:[01-2]?\d|30|31) |)@Month @YYYY ?(?:-|–|&ndash;) ?((?:[01-3]?\d|30|31) |)@Month @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1$2@FullMonth1 @YYYY1 – $3@FullMonth2 @YYYY2");
	ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))@Month @Day(, (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @Day, @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1@FullMonth1 @Day1$2 – @FullMonth2 @Day2, @YYYY");
	ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))@Day @Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Day @Month @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1@Day1 @FullMonth1$2 – @Day2 @FullMonth2 @YYYY");
	ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))@Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month,? @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1@FullMonth1$2 – @FullMonth2 @YYYY");
	ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))((?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @YYYY(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1$2 – @FullMonth @YYYY");
}

function ohc_expand_all_dates()
{
	ohc_regex(/([^-\w/])@Month @YYYY(?=[^-\w/])/gi, '$1@FullMonth @YYYY');
	ohc_regex(/([^-\w/])@Day @Month @YYYY(?=[^-\w/])/gi, '$1@Day @FullMonth @YYYY');
	ohc_regex(/([^-\w/])@Month @Day, @YYYY(?=[^-\w/])/gi, '$1@FullMonth @Day, @YYYY');

	ohc_regex(/([^-\w/])((?:[01-2]?\d|30|31) |)@Month @YYYY ?(?:-|–|&ndash;) ?((?:[01-3]?\d|30|31) |)@Month @YYYY(?=[^-\w/])/gi, "$1$2@FullMonth1 @YYYY1 – $3@FullMonth2 @YYYY2");
	ohc_regex(/([^-\w/])@Month @Day(, (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @Day, @YYYY(?=[^-\w/])/gi, "$1@FullMonth1 @Day1$2 – @FullMonth2 @Day2, @YYYY");
	ohc_regex(/([^-\w/])@Day @Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Day @Month @YYYY(?=[^-\w/])/gi, "$1@Day1 @FullMonth1$2 – @Day2 @FullMonth2 @YYYY");
	ohc_regex(/([^-\w/])@Month,?( (?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month,? @YYYY(?=[^-\w/])/gi, "$1@FullMonth1$2 – @FullMonth2 @YYYY");
	ohc_regex(/([^-\w/])((?:19|20)\d\d) ?(?:-|–|&ndash;) ?@Month @YYYY(?=[^-\w/])/gi, "$1$2 – @FullMonth @YYYY");

	ohc_regex(/([ ]\(|\|\s*)@Day @Month @YYYY(?=\)\W|\s*[|\n])/gi, "$1@Day @FullMonth @YYYY");
	ohc_regex(/([ ]\(|\|\s*)@Month @Day,? @YYYY(?=\)\W|\s*[|\n])/gi, "$1@FullMonth @Day, @YYYY");
	ohc_regex(/([ ]\((?:c\. |))@Month @YYYY ?(?:-|–|&nbsp;) ?@Day @Month @YYYY(?=\)\W)/gi, "$1@FullMonth1 @YYYY1 – @Day @FullMonth2 @YYYY2");
	ohc_regex(/([ ]\((?:c\. |))@Month @YYYY ?(?:-|–|&nbsp;) ?@Month @YYYY(?=\)\W)/gi, "$1@FullMonth1 @YYYY1 – @FullMonth2 @YYYY2");
	ohc_regex(/([ ]\((?:c\. |))@YYYY ?(?:-|–|&nbsp;) ?@Month @YYYY(?=\)\W)/gi, "$1@YYYY1 – @FullMonth @YYYY2");
	ohc_regex(/([ ]\((?:c\. |))@Month ?(?:-|–|&nbsp;) ?@Month @YYYY(?=\)\W)/gi, "$1@FullMonth1 – @FullMonth2 @YYYY");
	ohc_regex(/([ ]\((?:c\. |))@Month @YYYY(?=\)\W)/gi, "$1@FullMonth @YYYY");
}

function ohc_abbrev_ref_dates()
{
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Day @Month @YYYY(?=\s*[|}])/gi, "$1@Day @Mon @YYYY");
	ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))([12]?\d|30|31) (জানুয়ারি|ফেব্রুয়ারি|মার্চ|এপ্রিল|মে|জুন|জুলাই|আগষ্ট|অক্টোবর|Oct|নভেম্বর|ডিসেম্বর)(?:r?uary|ch|il|[ey]|ust|(?:t?em|o)ber)( (?:19\d|20[01])\d)(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1$2 $3$4");
	ohc_regex(/([ ]\()@Day @Month @YYYY([^-\w\/])/gi, "$1@Day @Mon @YYYY$2");
 
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month @Day, @YYYY(?=\s*[|}])/gi, "$1@Mon @Day, @YYYY");
	ohc_regex(/(<ref[^>]*>(?:[^<]+?[\s\(]|))(জানুয়ারি|ফেব্রুয়ারি|মার্চ|এপ্রিল|মে|জুন|জুলাই|আগষ্ট|অক্টোবর|Oct|নভেম্বর|ডিসেম্বর)(?:r?uary|ch|il|[ey]|ust|(?:t?em|o)ber) ([12]?\d|30|31),( (?:19\d|20[01])\d)(?=(?:[^-\w\/%,<][^<]*?|)<\/ref>)/gi, "$1$2 $3,$4");
	ohc_regex(/([^-\w\/])@Month @Day, @YYYY([^-\w\/])/gi, '$1@Mon @Day, @YYYY$2');
}
 
//not currently used
function ohc_abbrev_all_dates()
{
	ohc_regex(/([^-\w/])@Day @Month @YYYY(?=[^-\w/])/gi, '$1@Day @Mon @YYYY');
	ohc_regex(/([^-\w/])@Month @Day, @YYYY(?=[^-\w/])/gi, '$1@Mon @Day, @YYYY');
}

//not currently used
function ohc_dmy_publication_dates()
{
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Month @Day,? @YYYY/gi, "$1@Day @Month @YYYY"); // conversion of dates in references outside of the protection loop (eg for quotations etc.)
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:\[\[)?@YYYY(?:\]\][-–]\[\[|[-–])@MM[-–]@DD(?:\]\])?(?=\s*[|}])/gi, "$1@Day @Month @YYYY");
	//replace ISO dates (within parentheses) only within refs
	ohc_regex(/(<ref[^>]*>[^<]+?)([ ]\()@YYYY-@MM-@DD(\))(\W[^<]*?<\/ref>)/gi, "$1$2@Day @Month @YYYY$3$4");
}

function ohc_mdy_publication_dates()
{
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)@Day @Month @YYYY/gi, "$1@Month @Day, @YYYY"); // conversion of dates in references outside of the protection loop (eg for quotations etc.)
	ohc_regex(/(\|\s*(?:publication|archive|access|air|)-?date\s*=\s*)(?:\[\[)?@YYYY(?:\]\][-–]\[\[|[-–])@MM[-–]@DD(?:\]\])?(?=\s*[|}])/gi, "$1@Month @Day, @YYYY"); 
	//replace ISO dates (within parentheses) only within refs
	ohc_regex(/(<ref[^>]*>[^<]+?)([ ]\()@YYYY-@MM-@DD(\))(\W[^<]*?<\/ref>)/gi, "$1$2@Month @Day, @YYYY$3$4");
}

function ohc_Bigendian_ref_dates() {
	// Add a tag to the summary box
	regex(/(\{\{use (?:mdy|dmy) dates)(?:\|cs1-dates=\w{1,2}|)(\|[^\}\|]+\}\})/gi, '$1|cs1-dates=y$2');
}

/** ------------------------------------------------------------------------ **/
/// EDIT SUMMARIES & USE DMY TEMPLATE
// this function modified 2019-03-27 from [[Special:Permalink/846525463]]
// format parameter must be 'dmy' or 'mdy'
function ohc_use_dates_template(format) 
{
	var txt = document.editform.wpTextbox1;
	// current month-year
	var currentDate = new Date();
	var currmonth = currentDate.getMonth();
	var curryear = currentDate.getFullYear();
	var myMonths = ["জানুয়ারি", "ফেব্রুয়ারি", "মার্চ", "এপ্রিল", "মে", "জুন", "জুলাই", "আগষ্ট", "সেপ্টেম্বর", "অক্টোবর", "নভেম্বর", "ডিসেম্বর"];
	var curryyyymm = myMonths[currmonth] + ' ' + curryear;

// step 1: normalize redirect template names to canonical template names 'Use dmy dates' or 'Use mdy dates' according to 'format' argument 
// rename redirects 'dmy', 'mdy', 'usedmydates', 'usemdydates' ('usedmydates' and 'usemdydates' are not currently listed as redirects but might be encountered?)
	regex(/\{\{ *(?:use(?:dmy|mdy)dates|dmy|mdy) *([\|\}])/gi, '{{Use ' + format + ' dates$1');
// rename redirects 'usedmy', 'usemdy', 'use dmy', 'use mdy' to canonical form
	regex(/\{\{ *use *(?:dmy|mdy) *([\|\}])/gi, '{{Use ' + format + ' dates$1');
// strip leading / trailing whitespace from 'use xxx dates'
	regex(/\{\{ *use (?:dmy|mdy) dates *([\|\}])/gi, '{{Use ' + format + ' dates$1');

// step 2: look for a canonical template name (the above might not have had anthing to work on) ; if found continue, write new template else
	var rxpdd = new RegExp("{{Use " + format + " dates", "gi");	// here we search for canonical form {{use xxx dates}} that has current date
	var dflagfound = txt.value.search(rxpdd);
	if (dflagfound === -1) {
		txt.value = '{{Use ' + format + ' dates|date=' + curryyyymm + '}}\r\n' + txt.value;	// not found so insert new template at top of wikitext
		return;																	// and done
	}

// step 3: rewrite existing canonical templates; add or refresh |date= to current month year; preserve |cs1-dates= as is
	regex(/(\{\{use (?:dmy|mdy) dates)\| *date *=[^\|]*\| *cs1\-dates *= *([^\|\}]*?) *\}\}/gi, '$1|date=' + curryyyymm + '|cs1-dates=$2}}');	// with |date= followed by |cs1-dates=
	regex(/(\{\{use (?:dmy|mdy) dates)\| *cs1\-dates *= *([^\|\}]*?) *\| *date *=[^\}]*\}\}/gi, '$1|date=' + curryyyymm + '|cs1-dates=$2}}');	// with |cs1-dates= followed by |date=
	regex(/(\{\{use (?:dmy|mdy) dates)\| *date *=[^\|\}]*\}\}/gi, '$1|date=' + curryyyymm + '}}');												// with |date=
	regex(/(\{\{use (?:dmy|mdy) dates)\| *cs1\-dates *= *([^\|\}]*?) \}\}/gi, '$1|date=' + curryyyymm + '|cs1-dates=$2}}');						// with |cs1-dates
	regex(/(\{\{use (?:dmy|mdy) dates)\}\}/gi, '$1|date=' + curryyyymm + '}}');																	// no parameters so add |date=curryyyymm 
	regex(/(\{\{[\t_ ]*use[\t_ ]+(?:dmy|mdy)[\t_ ]+dates[^{}]*\}\})([\r\n\t ]*)(\{\{[\t ]*short description[^{}]*\}\})/gi, '$3$2$1');			// repositioning "short description" template at the top
}



/** ------------------------------------------------------------------------ **/
/// DATE PROTECTION

var linkmap = [];

function ohc_protect_dates()
{
	// protects dates within links, quotes, etc
	// the sensitive part is stored and replaced with a unique identifier,
	// which is later replaced with the stored part.
 
	var protect_function = function(s, begin, replace, end) {
		linkmap.push(replace);
		return begin + "⍌"+(linkmap.length-1)+"⍍" + end;
	};
//\|x=
	regex(/(<timeline>)([\s\S]*?)(<\/timeline>)/gi, protect_function);
	regex(/(<!--)([^<\{\}]*?)(-->)/gi, protect_function);
	regex(/(<math>)([\s\S]*?)(<\/math>)/gi, protect_function);
	regex(/((?:{(?:Wikimedia |)Commons ?|C ?))(Cat(?:egory|))\|[^{}*](})/gi, protect_function);
	regex(/(<ref)([^>]+)(>)/gi, protect_function);
	regex(/((?:Category|Image|File):)([^|\]]*)([|\]])/gi, protect_function);
	regex(/(\{(?:See ?also|Main))(\|[^}]*)(\})/gi, protect_function);
	regex(/(\{\{(?:double ?|external ?|wide ?)image\s?\|)([^}]+)(\})/gi, protect_function);
	regex(/(\{\{(?:harvnb|r|wikisource)\|)([^}]+)(\})/gi, protect_function);
	regex(/(\{\{(?:Canadian federal by-election))([^}]+)(\}\})/gi, protect_function);
	
	regex(/(\[(?:https?:|ftp:))([^\]]*)(\])/gi, protect_function);
	regex(/(>[ ]*(?:https?:|ftp:))([^< >\]]*)([ ]*<)/gi, protect_function);
//	regex(/(https?:|ftp:)([^\s\]]*)([\s\]])/gi, protect_function);
	regex(/(<blockquote>)([\s\S]*?)(<\/blockquote>)/gi, protect_function);
	regex(/(<noinclude>)([\s\S]*?)(<\/noinclude>)/gi, protect_function);
	regex(/(<gallery)([\s\S]*?)(<\/gallery>)/gi, protect_function);
	regex(/(<poem>)([\s\S]*?)(<\/poem>)/gi, protect_function);
	regex(/(\{[^\{]{0,6}(?:quot[^|]{1,7}\s?|sic)\|)([^}]+)(\})/gi, protect_function);
	regex(/((?:image\d?|image_skyline|image[ _]location\d?|image[ _]name|image[ _]file|img|map\d|pic)\s*=)([^|}]*)([|}])/gi, protect_function);
	regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|(?:trans-?|)title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
	regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|(?:trans-?|)title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
	regex(/([\|\{]\s*(?:season)\s*=)(\s*\[\[[^\]]*\]\]\s*)([|}])/gi, protect_function);
	regex(/([\|\{]\s*(?:[xy])\s*=)(\s*[^\|]+\s*)(\|)/gi, protect_function);
	regex(/(\{\{navsource\|)([^}]+)(\})/gi, protect_function);
	regex(/(\{\{(?:singlechart)\|)([^}]+)(\})/gi, protect_function);
	regex(/(\{\{(?:defaultsort|graph):)([^}]+)(\})/gi, protect_function);
	regex(/(["“])([^"”\n]*)(["”])/gi, protect_function);
	regex(/(.)(\(\{\{by\|[12]\d{3}\}\}[-–]\{\{by\|)([12]\d{3}[ ]*\}\}\))/gi, protect_function);
	regex(/(.)(\(\{\{by\|[12]\d{3}\}\}(?:[-–]present|))(\))/gi, protect_function);
	regex(/(\[\[)(4AD)(\]\]|\|)/gi, protect_function);

	//retraining redirects containing a date
	regex(/(\[\[)(?:সেপ্টেম্বর 3 Society)(\]\]|\|)/gi, '$1Jiusan Society$2');
	regex(/(\[\[)(?:জুন 4th incident)(\]\]|\|)/gi, '$1Tiananmen Square protests of 1989$2');
	regex(/(\[\[)(?:5@th? অক্টোবর (?:\(Serbia\)|overthrow))(\]\]|\|)/gi, '$1Overthrow of Slobodan Milošević$2');
	regex(/(\[\[)(?:অক্টোবর 5@th?(?: \(Serbia\)| overthrow|, 2000))(\]\]|\|)/gi, '$1Overthrow of Slobodan Milošević$2');

	//protect alternate meanings of 'মে' and 'মার্চ' (note: not case insensitive)
//	ohc_regex(/([^\w])(@day,?\s{0,3}মে)([^\w][^\d])/g, protect_function);  //disabled 26 মে – not case senstitve: false negatives in converting dates in মে
	ohc_regex(/([^\w])(মার্চ\s@day)(\s(?:mile|kilomet|met))/g, protect_function);

	//protect all links containing a date and some text
	ohc_regex(/(\[\[)(\s*\w[^\]\|\n]+?@day[^\]\|\n]+?@fullmonth[^\]\|\n]*)(\]\]|\|)/gi, protect_function);
	ohc_regex(/(\[\[)([^\]\|\n]*?@day[^\]\|\n]+?@fullmonth(?:,? @year|) \D[^\]\|\n]+\w\s*)(\]\]|\|)/gi, protect_function);
	ohc_regex(/(\[\[)(\s*\w[^\]\|\n]+?@fullmonth[^\]\|\n]+?@day[^\]\|\n]*)(\|)/gi, protect_function);
	ohc_regex(/(\[\[)([^\]\|\n]*?@fullmonth[^\]\|\n]+?@day(?:, @year|) \D[^\]\|\n]+\w\s*)(\]\]|\|)/gi, protect_function);

	//protects certain dates
	regex(/(\[\[)(4AD)([\s\S])/gi, protect_function);
	regex(/([\s\S])(মার্চ (?:8|14) Alliance)([\s\S])/gi, protect_function);
	regex(/([\s\S])(23rd মার্চ 1931: Shaheed)([\s\S])/gi, protect_function);
	regex(/([\s\S])(Long মার্চ [1-7])([\s\S])/gi, protect_function);
	regex(/([\s\S])(National সেপ্টেম্বর 11 Memorial & Museum)([\s\S])/gi, protect_function);
	regex(/([\s\S])(Queen Elizabeth II সেপ্টেম্বর 11th Garden)([\s\S])/gi, protect_function);
	regex(/([\s\S])(Bombay মার্চ 12)([\s\S])/gi, protect_function);
	regex(/([\s\S])(movement 2 জুন)([\s\S])/gi, protect_function);
	regex(/([\s\S])(6th\sof অক্টোবর City)([\s\S])/gi, protect_function);
	regex(/([\s\S])(Party Workers' Liberation Front 30th of মে)([\s\S])/gi, protect_function);
	regex(/([\s\S])(4th\sof আগষ্ট regime)([\s\S])/gi, protect_function);
	regex(/([\s\S])(19th\sof এপ্রিল movement)([\s\S])/gi, protect_function);
	regex(/([\s\S])(জুন 4th (?:incident|museum))([\s\S])/gi, protect_function);
	regex(/([\s\S])(The Battle Of Marston Moor \(জুলাই 2nd,? 1644\))([\s\S])/gi, protect_function);
	regex(/([\s\S])(Night of জানুয়ারি 16th)([\s\S])/gi, protect_function);
	regex(/([\s\S])(Observance of 5th নভেম্বর Act)([\s\S])/gi, protect_function);
	regex(/(\[\[)(13 মে incident)(\|)/gi, protect_function);
	regex(/(\'\'\')(22nd\sof মে)(\'\'\')/gi, protect_function);
	regex(/(\[\[)(22nd\sof মে \(film\))([|\]\'])/gi, protect_function);
	regex(/(\[\[)(জুলাই 12, 2007, Baghdad airstrike)(\|)/gi, protect_function);
	
	regex(/(\[\[)(নভেম্বর 1828)(\]\])/gi, protect_function);
	regex(/(.)(4th\sof জুলাই)(.)/gi, protect_function);
	regex(/(\[\[)((?:2300|2000)\s?AD)(\]\])/gi, protect_function);
	regex(/(\[\[)(29 ফেব্রুয়ারি)(\]\])/gi, protect_function);
	regex(/(\[\[)(ফেব্রুয়ারি 29)(\]\])/gi, protect_function);

	// works names
//	regex(/(.)(protect string)(.)/gi, protect_function);
	regex(/(.)(11\/22\/63)(.)/gi, protect_function);
	regex(/(.)(1\.1\.1994)(.)/gi, protect_function);
	regex(/([\s\S])(2\.13\.61)([\s\S])/gi, protect_function);
//	regex(/(.)(4th of জুলাই, Asbury)(.)/gi, protect_function); //protected above globally
	regex(/(.)(26 অক্টোবর 1993)(.)/gi, protect_function);
	regex(/(\[\[|\'\')(জুন 1, 1974)(.)/gi, protect_function);
	regex(/(\[\[|\'\')(জুলাই 15, 1972)(.)/gi, protect_function);
	regex(/(\[\[|\'\')(আগষ্ট 1914)(.)/gi, protect_function);
	ohc_regex(/(\[\[|\'\')(@fullmonth @dd@th? \((?:@yyyy |)film\)(?:\|@fullmonth @dd@th?|))([\s\S])/gi, protect_function);
	ohc_regex(/(\[\[|\'\')(@dd@th? @fullmonth \((?:@yyyy |)film\)(?:\|@dd@th? @fullmonth|))([\s\S])/gi, protect_function);
//	regex(/(Les Bains Douches 18)( ডিসেম্বর 1979)(.)/gi, protect_function);
	regex(/(আগষ্ট)( 7, 4:15)(.)/gi, protect_function);
	regex(/(In Concert, Zürich, অক্টোবর)( 28, 1979)(.)/gi, protect_function);
	regex(/(CBGB OMFUG Masters: Live জুন)( 29, 2001)(.)/gi, protect_function);
	ohc_regex(/(Live at [\w ]*,? [1-3]\d)( @fullmonth)(.)/gi, protect_function);
	ohc_regex(/(Live at [\w ]*,? @fullmonth)( @dd)(.)/gi, protect_function);
	ohc_regex(/(Bootmoon Series: [\w ]*[-–] @fullmonth)( @day, @YYYY)(.)/gi, protect_function);

// expressions and grammatical strings including modal "মে"
	regex(/(\W)((?:\d{1,3}) মে)((?: have(?: \w+|)|) be)/g, protect_function);
	regex(/(\W)((?:\d{3}|3[2-9]|[4-9]\d)\/\d ডিসেম্বর(?:l\.?|))(\W)/gi, protect_function);
	regex(/(\W)((?:\d{2,3})\/\d ডিসেম্বর(?:l\.?|))( \(\d\d? overs)/gi, protect_function);
}

/** ------------------------------------------------------------------------ **/
/// DATE PROTECTION FOR ALL REF SECTION

var linkmap = [];

function ohc_protect_dates_ref() 
{
	// protects dates within links, quotes, etc
	// the sensitive part is stored and replaced with a unique identifier,
	// which is later replaced with the stored part.

	var protect_function = function (s, begin, replace, end) {
		linkmap.push(replace);
		return begin + "⍌" + (linkmap.length - 1) + "⍍" + end;
	};

	regex(/(<ref\s?(?:>|name=[^>]+))([^<]+)(<\/ref>)/gi, protect_function);
	regex(/(<timeline>)([\s\S]*?)(<\/timeline>)/gi, protect_function);
	regex(/(<math>)([\s\S]*?)(<\/math>)/gi, protect_function);
	regex(/((?:{(?:Wikimedia |)Commons ?|C ?))(Cat(?:egory|))\|[^{}*](})/gi, protect_function);
	regex(/((?:Category|Image|File):)([^|\]]*)([|\]])/gi, protect_function);
	regex(/(\{(?:See ?also|Main))(\|[^}]*)(\})/gi, protect_function);
	regex(/(\{\{(?:double ?|external ?|wide ?)image\s?\|)([^}]+)(\})/gi, protect_function);
	regex(/(\{\{(?:harvnb|wikisource)\|)([^}]+)(\})/gi, protect_function);
	regex(/(\[(?:https?:|ftp:))([^\]]*)(\])/gi, protect_function);
	regex(/(>[ ]*(?:https?:|ftp:))([^< >\]]*)([ ]*<)/gi, protect_function);
	//regex(/(https?:|ftp:)([^\s\]]*)([\s\]])/gi, protect_function);
	regex(/(<blockquote>)([\s\S]*?)(<\/blockquote>)/gi, protect_function);
	regex(/(\{[^\{]{0,6}(?:quot[^|]{1,7}\s?|sic)\|)([^}]+)(\})/gi, protect_function);
	regex(/((?:image\d?|image_skyline|image[ _]location\d?|image[ _]name|image[ _]file|img|pic)\s*=)([^|}]*)([|}])/gi, protect_function);
	regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
	regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
	regex(/([\|\{]\s*(?:season)\s*=)(\s*\[\[[^\]]*\]\]\s*)([|}])/gi, protect_function);
	regex(/(\{\{navsource\|)([^}]+)(\})/gi, protect_function);
	regex(/(\{\{singlechart\|)([^}]+)(\})/gi, protect_function);
	regex(/(\{\{defaultsort:)([^}]+)(\})/gi, protect_function);
	regex(/([\s\(>]")([^"\n]*)(")/gi, protect_function);
	regex(/([\s\(>]“)([^”\n]*)(”)/gi, protect_function);
	regex(/(.)(\(\{\{by\|[12]\d{3}\}\}[-–]\{\{by\|)([12]\d{3}[ ]*\}\}\))/gi, protect_function);
	regex(/(.)(\(\{\{by\|[12]\d{3}\}\}(?:[-–]present|))(\))/gi, protect_function);

	//retraining redirects containing a date
	regex(/(\[\[)(?:সেপ্টেম্বর 3 Society)(\]\]|\|)/gi, '$1Jiusan Society$2');
	regex(/(\[\[)(?:জুন 4th incident)(\]\]|\|)/gi, '$1Tiananmen Square protests of 1989$2');
	ohc_regex(/(\[\[)(?:5@th? অক্টোবর (?:\(Serbia\)|overthrow))(\]\]|\|)/gi, '$1Overthrow of Slobodan Milošević$2');
	ohc_regex(/(\[\[)(?:অক্টোবর 5@th?(?: \(Serbia\)| overthrow|, 2000))(\]\]|\|)/gi, '$1Overthrow of Slobodan Milošević$2');

	//protect alternate meanings of 'মে' and 'মার্চ' (note: not case insensitive)
	ohc_regex(/([^\w])(@day,?\s{0,3}মে)([^\w][^\d])/g, protect_function);
	ohc_regex(/([^\w])(মার্চ\s@day)(\s(?:mile|kilomet|met))/g, protect_function);

	//protect all links containing a date and some text
	ohc_regex(/(\[\[)(\s*\w[^\]\|\n]+?@day[^\]\|\n]+?@fullmonth[^\]\|\n]*)(\]\]|\|)/gi, protect_function);
	ohc_regex(/(\[\[)([^\]\|\n]*?@day[^\]\|\n]+?@fullmonth(?:,? @year|) \D[^\]\|\n]+\w\s*)(\]\]|\|)/gi, protect_function);
	ohc_regex(/(\[\[)(\s*\w[^\]\|\n]+?@fullmonth[^\]\|\n]+?@day[^\]\|\n]*)(\|)/gi, protect_function);
	ohc_regex(/(\[\[)([^\]\|\n]*?@fullmonth[^\]\|\n]+?@day(?:, @year|) \D[^\]\|\n]+\w\s*)(\]\]|\|)/gi, protect_function);

	//protects certain dates
	regex(/(\[\[)(4AD)([\s\S])/gi, protect_function);
	regex(/([\s\S])(মার্চ (?:8|14) Alliance)([\s\S])/gi, protect_function);
	regex(/([\s\S])(23rd মার্চ 1931: Shaheed)([\s\S])/gi, protect_function);
	regex(/([\s\S])(Long মার্চ [1-7])([\s\S])/gi, protect_function);
	regex(/([\s\S])(Bombay মার্চ 12)([\s\S])/gi, protect_function);
	regex(/([\s\S])(movement 2 জুন)([\s\S])/gi, protect_function);
	regex(/([\s\S])(6th\sof অক্টোবর City)([\s\S])/gi, protect_function);
	regex(/([\s\S])(Party Workers' Liberation Front 30th of মে)([\s\S])/gi, protect_function);
	regex(/([\s\S])(4th\sof আগষ্ট regime)([\s\S])/gi, protect_function);
	regex(/([\s\S])(19th\sof এপ্রিল movement)([\s\S])/gi, protect_function);
	regex(/([\s\S])(জুন 4th incident)([\s\S])/gi, protect_function);
	regex(/([\s\S])(The Battle Of Marston Moor \(জুলাই 2nd,? 1644\))([\s\S])/gi, protect_function);
	regex(/([\s\S])(Night of জানুয়ারি 16th)([\s\S])/gi, protect_function);
	regex(/([\s\S])(Observance of 5th নভেম্বর Act)([\s\S])/gi, protect_function);
	regex(/(\[\[)(13 মে incident)(\|)/gi, protect_function);
	regex(/(\'\'\')(22nd\sof মে)(\'\'\')/gi, protect_function);
	regex(/(\[\[)(22nd\sof মে \(film\))([|\]\'])/gi, protect_function);
	regex(/(\[\[)(জুলাই 12, 2007, Baghdad airstrike)(\|)/gi, protect_function);
	
	regex(/(\[\[)(নভেম্বর 1828)(\]\])/gi, protect_function);
	regex(/(.)(4th\sof জুলাই)(.)/gi, protect_function);
	regex(/(\[\[)((?:2300|2000)\s?AD)(\]\])/gi, protect_function);
	regex(/(\[\[)(29 ফেব্রুয়ারি)(\]\])/gi, protect_function);
	regex(/(\[\[)(ফেব্রুয়ারি 29)(\]\])/gi, protect_function);

	// works names
	//regex(/(.)(protect string)(.)/gi, protect_function);
	regex(/(.)(11\/22\/63)(.)/gi, protect_function);
	regex(/(.)(1\.1\.1994)(.)/gi, protect_function);
	regex(/([\s\S])(2\.13\.61)([\s\S])/gi, protect_function);
	//regex(/(.)(4th of জুলাই, Asbury)(.)/gi, protect_function); //protected above globally
	regex(/(.)(26 অক্টোবর 1993)(.)/gi, protect_function);
	regex(/(\[\[|\'\')(জুন 1, 1974)(.)/gi, protect_function);
	regex(/(\[\[|\'\')(জুলাই 15, 1972)(.)/gi, protect_function);
	regex(/(\[\[|\'\')(আগষ্ট 1914)(.)/gi, protect_function);
	ohc_regex(/(\[\[|\'\')(@fullmonth @dd@th? \((?:@yyyy |)film\)(?:\|@fullmonth @dd@th?|))([\s\S])/gi, protect_function);
	ohc_regex(/(\[\[|\'\')(@dd@th? @fullmonth \((?:@yyyy |)film\)(?:\|@dd@th? @fullmonth|))([\s\S])/gi, protect_function);
	//regex(/(Les Bains Douches 18)( ডিসেম্বর 1979)(.)/gi, protect_function);
	regex(/(আগষ্ট)( 7, 4:15)(.)/gi, protect_function);
	regex(/(In Concert, Zürich, অক্টোবর)( 28, 1979)(.)/gi, protect_function);
	regex(/(CBGB OMFUG Masters: Live জুন)( 29, 2001)(.)/gi, protect_function);
	ohc_regex(/(Live at [\w ]*,? [1-3]\d)( @fullmonth)(.)/gi, protect_function);
	ohc_regex(/(Live at [\w ]*,? @fullmonth)( @dd)(.)/gi, protect_function);
	ohc_regex(/(Bootmoon Series: [\w ]*[-–] @fullmonth)( @day, @YYYY)(.)/gi, protect_function);

	regex(/(\W)((?:\d{3}|3[2-9]|[4-9]\d)\/\d ডিসেম্বর(?:l\.?|))(\W)/gi, protect_function);
	regex(/(\W)((?:\d{2,3})\/\d ডিসেম্বর(?:l\.?|))( \(\d\d? overs)/gi, protect_function);
}


/** ------------------------------------------------------------------------ **/
/// DATE PROTECTION FOR SLASH modules

var linkmap = [];

function ohc_protect_dates_slash() 
{
	// protects dates within links, quotes, etc
	// the sensitive part is stored and replaced with a unique identifier,
	// which is later replaced with the stored part.

	var protect_function = function (s, begin, replace, end) {
		linkmap.push(replace);
		return begin + "⍌" + (linkmap.length - 1) + "⍍" + end;
	};

	regex(/(<ref\s?(?:>|name=[^>]+))([^<]+)(<\/ref>)/gi, protect_function);
	regex(/(<timeline>)([\s\S]*?)(<\/timeline>)/gi, protect_function);
	regex(/(<math>)([\s\S]*?)(<\/math>)/gi, protect_function);
	regex(/((?:{(?:Wikimedia |)Commons ?|C ?))(Cat(?:egory|))\|[^{}*](})/gi, protect_function);
	regex(/((?:Category|Image|File):)([^|\]]*)([|\]])/gi, protect_function);
	regex(/(\{(?:See ?also|Main))(\|[^}]*)(\})/gi, protect_function);
	regex(/(\{\{(?:double ?|external ?|wide ?)image\s?\|)([^}]+)(\})/gi, protect_function);
	regex(/(\{\{(?:harvnb|wikisource)\|)([^}]+)(\})/gi, protect_function);
	regex(/(\[(?:https?:|ftp:))([^\]]*)(\])/gi, protect_function);
	regex(/(>[ ]*(?:https?:|ftp:))([^< >\]]*)([ ]*<)/gi, protect_function);
	//regex(/(https?:|ftp:)([^\s\]]*)([\s\]])/gi, protect_function);
	regex(/(<blockquote>)([\s\S]*?)(<\/blockquote>)/gi, protect_function);
	regex(/(\{[^\{]{0,6}(?:quot[^|]{1,7}\s?|sic)\|)([^}]+)(\})/gi, protect_function);
	regex(/((?:image\d?|image_skyline|image[ _]location\d?|image[ _]name|image[ _]file|img|pic)\s*=)([^|}]*)([|}])/gi, protect_function);
	regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
	regex(/([\|\{]\s*(?:file(?:name\d?|)|image\d?|image location\d?|img|pic|Cover|title|quote|chapter|journal|url|archiveurl|work|doi|club|at|volume|reporter)\s*=)([^|\}⍍]*)([|}])/gi, protect_function);
	regex(/([\|\{]\s*(?:season)\s*=)(\s*\[\[[^\]]*\]\]\s*)([|}])/gi, protect_function);
	regex(/(\{\{navsource\|)([^}]+)(\})/gi, protect_function);
	regex(/(\{\{singlechart\|)([^}]+)(\})/gi, protect_function);
	regex(/(\{\{defaultsort:)([^}]+)(\})/gi, protect_function);
	regex(/([\s\(>]")([^"\n]*)(")/gi, protect_function);
	regex(/([\s\(>]“)([^”\n]*)(”)/gi, protect_function);
	regex(/(.)(\(\{\{by\|[12]\d{3}\}\}[-–]\{\{by\|)([12]\d{3}[ ]*\}\}\))/gi, protect_function);
	regex(/(.)(\(\{\{by\|[12]\d{3}\}\}(?:[-–]present|))(\))/gi, protect_function);

}

function ohc_unprotect_dates() 
{
	//unprotect all dates
	regex(/[♫]/g, '');
	regex(/⍌([0-9]+)⍍/g, function (x, n) {
		var res = linkmap[n];
		res = res.replace(/⍌([0-9]+)⍍/g, function (x, n) {
			var res = linkmap[n];
			res = res.replace(/⍌([0-9]+)⍍/g, function (x, n) {
				var res = linkmap[n];
				res = res.replace(/⍌([0-9]+)⍍/g, function (x, n) {
					return linkmap[n];
				});
				return res;
			});
			return res;
		});
		return res;
	});
}

function ohc_MOSNUM_edit_summary() 
{
	//Add a tag to the summary box
	setoptions(minor = 'true');
	setreason('date formats per [[MOS:DATEFORMAT]] by [[WP:MOSNUMscript|script]]', 'append');
	doaction('diff');
}

function ohc_bigendien_edit_summary() 
{
	//Add a tag to the summary box
	setoptions(minor = 'true');
	setreason('ymd ref dates', 'append');
	doaction('diff');
}

function ohc_expand_edit_summary() 
{
	//Add a tag to the summary box
	setoptions(minor = 'true');
	setreason('expand month names', 'append');
	doaction('diff');
}

function ohc_slash_edit_summary() 
{
	//Add a tag to the summary box
	setoptions(minor = 'true');
	setreason('resolved slash dates', 'append');
	doaction('diff');
}

function ohc_abbrev_edit_summary() 
{
	//Add a tag to the summary box
	setoptions(minor = 'true');
	setreason('abbrev month names', 'append');
	doaction('diff');
}

/** ------------------------------------------------------------------------ **/
/// CUSTOMIZATION POINTS
function ohc_customize_all_to_dmy() {
}

function ohc_customize_all_to_mdy() {
}

function ohc_customize_body_to_dmy() {
}

function ohc_customize_body_to_mdy() {
}

function ohc_customize_ISO_to_dmy() {
}

function ohc_customize_ISO_to_mdy() {
}

/** ------------------------------------------------------------------------ **/
function ohc_body_dates_to_dmy() 
{
	ohc_use_dates_template('dmy');

	ohc_fix_common_errors();
	ohc_fix_dts_template('dmy');
	ohc_fix_gr_template('dmy');
	ohc_dates_to_dmy();
	ohc_remove_leading_zeroes();
	ohc_fix_dmy_redundancies();
}

function ohc_body_dates_to_mdy() 
{
	ohc_use_dates_template('mdy');
	ohc_fix_common_errors();
	ohc_fix_dts_template('mdy');
	ohc_fix_gr_template('mdy');
	ohc_dates_to_mdy();
	ohc_remove_leading_zeroes();
	ohc_fix_mdy_redundancies();
}

/** ------------------------------------------------------------------------ **/
function ohc_all_to_dmy_driver(e) 
{
	e.preventDefault();
	ohc_delink_dates();
	ohc_protect_dates();
	ohc_fix_unambiguous_dates();
	ohc_body_dates_to_dmy();
	ohc_delink_ISO_to_dmy();
	ohc_delink_year_in_X();
	ohc_customize_all_to_dmy();
	ohc_ISO_to_dmy_in_citations();
	ohc_unprotect_dates();

	ohc_MOSNUM_edit_summary();
}

function ohc_all_to_mdy_driver(e) 
{
	e.preventDefault();
	ohc_delink_dates();
	ohc_protect_dates();
	ohc_fix_unambiguous_dates();
	ohc_body_dates_to_mdy();
	ohc_delink_ISO_to_mdy();
	ohc_delink_year_in_X();
	ohc_customize_all_to_mdy();
	ohc_ISO_to_mdy_in_citations();
	ohc_unprotect_dates();

	ohc_MOSNUM_edit_summary();
}

function ohc_dmy_publication_dates_driver(e) 
{
	e.preventDefault();
//	ohc_delink_dates();
	ohc_protect_dates();
	ohc_body_dates_to_dmy();
	ohc_customize_body_to_dmy();
	ohc_dmy_publication_dates();
	ohc_unprotect_dates();

	ohc_MOSNUM_edit_summary();
}

function ohc_mdy_publication_dates_driver(e) 
{
	e.preventDefault();
//	ohc_delink_dates();
	ohc_protect_dates();
	ohc_body_dates_to_mdy();
	ohc_customize_body_to_mdy();
	ohc_mdy_publication_dates();
	ohc_unprotect_dates();

	ohc_MOSNUM_edit_summary();

}

function ohc_body_to_dmy_driver(e) 
{
	e.preventDefault();
//	ohc_delink_dates();
	ohc_protect_dates_ref();
	ohc_body_dates_to_dmy();
	ohc_customize_body_to_dmy();
	ohc_unprotect_dates();

	ohc_MOSNUM_edit_summary();
}

function ohc_body_to_mdy_driver(e) 
{
	e.preventDefault();
//	ohc_delink_dates();
	ohc_protect_dates_ref();
	ohc_body_dates_to_mdy();
	ohc_customize_body_to_mdy();
	ohc_unprotect_dates();

	ohc_MOSNUM_edit_summary();
}

function ohc_ISO_to_dmy_driver(e) 
{
	e.preventDefault();
	ohc_protect_dates();
	ohc_delink_ISO_to_dmy();
	ohc_customize_ISO_to_dmy();
	ohc_unprotect_dates();

//	ohc_MOSNUM_edit_summary();
}

function ohc_ISO_to_mdy_driver(e) {
	e.preventDefault();
	ohc_protect_dates();
	ohc_delink_ISO_to_mdy();
	ohc_customize_ISO_to_mdy();
	ohc_unprotect_dates();

//	ohc_MOSNUM_edit_summary();
}

function ohc_delink_year_in_X_driver(e) 
{
	e.preventDefault();
	ohc_delink_year_in_X();
}

function ohc_expand_ref_dates_driver(e) {
	e.preventDefault();
	ohc_expand_ref_dates();
	ohc_protect_dates();
	ohc_unprotect_dates();
	ohc_expand_edit_summary();
}

function ohc_expand_all_dates_driver(e) 
{
	e.preventDefault();
	ohc_expand_ref_dates();
	ohc_protect_dates();
	ohc_expand_all_dates();
	ohc_unprotect_dates();
	ohc_expand_edit_summary();
}

function ohc_abbrev_ref_dates_driver(e) 
{
	e.preventDefault();
	ohc_protect_dates();
	ohc_abbrev_ref_dates();
	ohc_unprotect_dates();
	ohc_slash_edit_summary();
}

function ohc_UK_slash_dates_driver(e) 
{
	e.preventDefault();
	ohc_expand_ref_dates();
	ohc_protect_dates_slash();
		ohc_UK_slash_dates_to_dmy();
	ohc_unprotect_dates();
	ohc_slash_edit_summary();
}

function ohc_US_slash_dates_driver(e) 
{
	e.preventDefault();
	ohc_expand_ref_dates();
	ohc_protect_dates_slash();
		ohc_US_slash_dates_to_mdy();
	ohc_unprotect_dates();
	ohc_expand_edit_summary();
}

// </pre>

//সংশ্লিষ্ট পাতা ত্যাগ না করেই অন্য পাতা থেকে পুনর্নির্দেশ করা যাবে।
//<nowiki>
( function () {
	var redir = $(mw.util.addPortletLink('p-tb','#','পুনর্নির্দেশক','পুনর্নির্দেশ তৈরিকারী','পুনর্নির্দেশ তৈরিকারী','','#pt-mytalk'));
	$( redir ).click( function() {
			var redirec = prompt("যে পাতা থেকে এই পাতায় পুনর্নির্দেশ করতে চান তার নাম লিখুন:", "");
		  if (redirec === null || redirec === "") {
				alert( 'আপনি কোনও নাম প্রবেশ করান নি। দয়া করে আবার চেষ্টা করুন।' );	  
		  } else  {
			   var params = {
					action: 'edit',
					title: redirec ,
					createonly: 1,
					prependtext: '#পুনর্নির্দেশ [[' + mw.config.get("wgPageName") + ']]',
					appendtext: " \n" + '{{একটি পুনর্নির্দেশ}}',
					summary: '[[' + mw.config.get("wgPageName") + ']] পাতায় পুনর্নির্দেশ করা হল' ,
					format: 'json'
				};
				api = new mw.Api();
			api.postWithToken( 'csrf', params ).done( function ( data ) {
				alert( 'সফলভাবে ' + redirec + ' পাতা থেকে একটি পুনর্নির্দেশ তৈরি করা হয়েছে!' );
			});
		  }
			}
	);
}() );
//</nowiki>

//<nowiki>
( function () {
	var talkp = $(mw.util.addPortletLink('p-tb','#','স্বাগত জানান','স্বাগত জানান','স্বাগত জানান','','#pt-mytalk'));
	$( talkp ).click( function() {
			var talk = prompt("কোন ধরনের স্বাগত বার্তা যুক্ত করতে চান এমন টেমপ্লেটটি লিখুন {{Subst:}} সাথে, অন্যথায় পূর্বনির্ধারিত {{Subst:স্বাগতম}} যুক্ত হবে:", "");
		  if (talk === null || talk === "") {
		    var params1 = {
					action: 'edit',
					title: 'User talk:' + mw.config.get("wgRelevantUserName"),
					prependtext: '{{Subst:স্বাগতম}}'
					,
					summary: 'ভারতপিডিয়ায় স্বাগতম!',
					format: 'json'
				};
				api = new mw.Api();
			
			api.postWithToken( 'csrf', params1 ).done( function ( data ) {
				alert( 'সফলভাবে স্বাগত জানানো হয়েছে!' );
			} );
		  
		  } else {
			   var params = {
					action: 'edit',
					title: 'User talk:' + mw.config.get("wgRelevantUserName"),
					prependtext: talk
					,
					summary: 'ভারতপিডিয়ায় স্বাগত!',
					format: 'json'
				};
				api = new mw.Api();
			
			api.postWithToken( 'csrf', params ).done( function ( data ) {
				alert( 'সফলভাবে স্বাগত জানানো হয়েছে!' );
			} );
		  }
			}
	);
}() );
//</nowiki>
//<nowiki>
console.time('mobileUndo');
$.when(mw.loader.using(['mediawiki.util', 'mediawiki.api', 'oojs-ui-windows', 'oojs-ui-core', 'oojs-ui.styles.icons-editing-core'])).then(function() {
    return new mw.Api().getMessages(['editundo', 'Undo-nochange']);
}).then(function(globalmessages) {
    var mobileUndo, i18n_lang = mw.config.get('wgUserLanguage');
    var i18n = {
        "en": {
            "mu-success": "Successful",
            "mu-fail": "Failed",
            "mu-loading": "Loading...",
            "editsummary-ad": "",
            "mu-undo-successful": "Revert successful.... Reloading in a sec",
            "mu-empty-reponse-from-server": "An empty response was received from the server",
            "mu-edit-summary-prompt": "Add a reason to your edit summary !",
            "mu-edit-summary-prompt-placeholder": "Reason...",
            "mu-thank-success": "Thanked",
            "mu-thank-confirm": "Send public thanks ?",
            "mu-thank-loading": "Thanking...",
            "mu-thank-successful": "You thanked $1.",
            "mu-thank-failed": "Failed to thank $1.",
            "mu-http-error":"HTTP error: "
        },
        "bn": {
            "mu-success": "সফল",
            "mu-fail": "ব্যর্থ হয়েছে",
            "mu-loading": "লোড করা হচ্ছে...",
            "editsummary-ad": "",
            "mu-undo-successful": "পূর্বাবস্থায় ফেরত যাওয়া সফল হয়েছে.... পুনঃলোড করা হচ্ছে",
            "mu-empty-reponse-from-server": "সার্ভার থেকে একটি খালি প্রতিক্রিয়া পাওয়া গেছে।",
            "mu-edit-summary-prompt": "সম্পাদনা সারাংশে কারণ উল্লেখ করুন!",
            "mu-edit-summary-prompt-placeholder": "কারণ...",
            "mu-thank-success": "ধন্যবাদ দিয়েছেন",
            "mu-thank-confirm": "প্রকাশ্য ধন্যবাদ জানাবেন?",
            "mu-thank-loading": "ধন্যবাদ জানানো হচ্ছে...",
            "mu-thank-successful": "আপনি $1 কে ধন্যবাদ জানিয়েছেন।",
            "mu-thank-failed": "$1 কে ধন্যবাদ জানানো ব্যর্থ হয়েছে।",
            "mu-http-error":"HTTP ত্রুটি: "
        }
    };
	if(undefined === i18n[i18n_lang]){
		i18n_lang = 'en';
	}
    if (mw.config.get('wgCanonicalSpecialPageName') === 'MobileDiff') {
        mw.util.addCSS('#mw-mf-userinfo .mobileUndo-ui .mw-ui-icon.mw-ui-icon-before:before{display:none;}\n#mobileUndo > a > span.oo-ui-iconElement-icon.oo-ui-icon-editUndo.oo-ui-image-invert{display:inline-block; position:initial;}\n#mobileUndo > a{padding:0.57142857em 0.9375em;}'+
        '#mw-mf-userinfo > div > div.mobileUndo-ui > a > div{line-height:normal;}');
        if (mw.config.get('wgVisualEditor').pageLanguageDir === 'ltr') {
            $('#mw-mf-userinfo .post-content').append($('<div>').attr('class', 'mobileUndo-ui').css({
                'display': 'inline-block',
                'float': 'right'
            }));
        } else {
            $('#mw-mf-userinfo .post-content').append($('<div>').attr('class', 'mobileUndo-ui').css({
                'display': 'inline-block',
                'float': 'left'
            }));
        }
        $('.mobileUndo-ui').append($('.mw-mf-action-button').remove().css({
            'clear': 'none'
        }));
        if (!$('.warningbox').length && mw.config.get('wgRelevantPageIsProbablyEditable')) {
            mobileUndo = new OO.ui.ButtonWidget({
                label: (globalmessages.editundo).charAt(0).toUpperCase() + (globalmessages.editundo).slice(1),
                icon: 'editUndo',
                title: 'mobileUndo',
                flags: ['destructive', 'primary'],
                id: 'mobileUndo'
            });
            $('.mobileUndo-ui').append(mobileUndo.$element);
            if (mw.config.get('wgVisualEditor').pageLanguageDir === 'ltr') {
                $('#mobileUndo').css('margin-right', '0.3em');
            } else {
                $('#mobileUndo').css('margin-left', '0.3em');
            }
        }
        window.wgRelevantUser = function() {
            var user;
            if ($('.mw-mf-user-link').text() !== '') {
                user = $('.mw-mf-user-link').text();
            } else {
                user = $('#mw-mf-userinfo .post-content div:nth-child(2)').text();
            }
            return user;
        };
        window.wgRevId = ($('#mw-mf-diffarea > div.mw-mf-diff-info > h3 > a').attr('href')).split('&oldid=')[1];
        var revId = wgRevId;
        console.log(revId);
        var username = wgRelevantUser();
        $('#mw-mf-userinfo .post-content .mobileUndo-ui .mw-mf-action-button').click(function(e) {
            e.preventDefault();
            OO.ui.confirm(i18n[i18n_lang]['mu-thank-confirm']).done(function(confirmed) {
                if (confirmed) {
                    $('.mw-mf-action-button').css('pointer-events', 'none').text(i18n[i18n_lang]['mu-thank-loading']);
                    var api = new mw.Api();
                    api.postWithToken('csrf', {
                        action: "thank",
                        rev: revId,
                    }).done(function(result) {
                        mw.notify((i18n[i18n_lang]['mu-thank-successful']).replace(/\$1/g, username));
                        $('.mw-mf-action-button').text(i18n[i18n_lang]['mu-thank-success']);
                    }).fail(function() {
                        mw.notify((i18n[i18n_lang]['mu-thank-failed']).replace(/\$1/g, username));
                        $('.mw-mf-action-button').text(i18n[i18n_lang]['mu-failed']);
                    });
                }
            });
        });
        console.timeEnd('mobileUndo');
        mobileUndo.on('click', function() {
            OO.ui.prompt(i18n[i18n_lang]['mu-edit-summary-prompt'], {
                textInput: {
                    placeholder: i18n[i18n_lang]['mu-edit-summary-prompt-placeholder'] 
                }
            }).done(function(customEditSummary) {
                $.when(mw.loader.using('mediawiki.api')).then(function() {
                    return new mw.Api().getMessages(['undo-summary'], {
                        amlang: mw.config.get('wgServerName').split('.wik')[0]
                    });
                }).then(function(message) {
                    var editSummaryMessage = message['undo-summary'];
                    var editSummary = editSummaryMessage.replace(/\$1/g, revId);
                    editSummary = editSummary.replace(/\$2/g, username);
                    if (customEditSummary !== null) {
                        mobileUndo.setDisabled(true);
                        editSummary = editSummary + ' ' + customEditSummary + (i18n[i18n_lang]['editsummary-ad']);
                        //call the API
                        var api = new mw.Api({
                            ajax: {
                                headers: {
                                    'Api-User-Agent': 'mobileUndo/2.0.2(https://en.wikipedia.org/wiki/User:FR30799386/undo.js)'
                                }
                            }
                        });
                        //Feedback UI
                        mobileUndo.setLabel(i18n[i18n_lang]['mu-loading']);
                        api.postWithToken('csrf', {
                            action: "edit",
                            title: mw.config.get('wgRelevantPageName'),
                            summary: editSummary,
                            undo: revId,
                        }).done(function(result) {
                            if (result.edit.code === 'abusefilter-warning' || result.edit.code === 'abusefilter-disallowed') {
                                mobileUndo.setLabel(i18n[i18n_lang]['mu-fail']);
                                OO.ui.alert($('<p>').html(result.edit.warning), {
                                    title: result.edit.info
                                }).done(function() {});
                                return;
                            } else if (typeof result.edit.nochange !== 'undefined') {
                                mobileUndo.setLabel(i18n[i18n_lang]['mu-fail']);
                                OO.ui.alert($('<p>').html(globalmessages['Undo-nochange'])).done(function() {});
                                return;
                            }
                            console.log(result);
                            mobileUndo.setLabel(i18n[i18n_lang]['mu-success']);
                            mw.notify(i18n[i18n_lang]['mu-undo-successful']);
                            setTimeout(function() {
                                location.href = mw.util.getUrl('Special:MobileDiff/' + result.edit.newrevid);
                            }, 1500);
                        }).fail(function(code, jqxhr) {
                            mobileUndo.setLabel(i18n[i18n_lang]['mu-fail']);
                            var details;
                            if (code === 'http' && jqxhr.textStatus === 'error') {
                                details = i18n[i18n_lang]['mu-http-error'] + jqxhr.xhr.status;
                            } else if (code === 'http') {
                                details = i18n[i18n_lang]['mu-http-error'] + jqxhr.textStatus;
                            } else if (code === 'ok-but-empty') {
                                details = i18n[i18n_lang]['mu-empty response-from-server'];
                            } else {
                                details = jqxhr.error.info;
                            }
                            OO.ui.alert($('<p>').html(details)).done(function() {});
                        });
                    }
                });
            });
        });
    }
});
//End of code
//</nowiki>
window.wgRelevantUser = function() {
    var user;
    	if ($('.mw-mf-user-link').text() !== '') {
        	user = $('.mw-mf-user-link').text();
    	} else {
        	user = $('#mw-mf-userinfo .post-content div:nth-child(2)').text();
    	}
    return user;
    };
var href = ($('#mw-mf-diffarea > div.mw-mf-diff-info > h3 > a').attr('href')) || '';
window.wgRevId = href.split('&oldid=')[1];
if( $('#mw-mf-diffarea > ul > li.revision-history-next').length ) {
	$('#mw-mf-diffarea > div.mw-mf-diff-info > h3').append(
		$('<a>').attr('id','mobileRestore').attr('href','javascript:void(0)').append(
			$('<b>').text('(পুনরুদ্ধার)')
		)
	);
}
$('#mobileRestore').click(function(e){
	e.preventDefault();
	$('#mobileRestore b').text('(লোড হচ্ছে....)');
	$('#mobileRestore').css('pointer-events','none');
	var customEditSummary = prompt('পুনরুদ্ধারের কারণ (ঐচ্ছিক)');
	if(customEditSummary === null) {
		$('#mobileRestore b').text('(পুনরুদ্ধার)');
		$('#mobileRestore').css('pointer-events','auto');
		return;
	}
	var username =wgRelevantUser();
	var editSummary = '[[Special:Contributions/'+username+'|'+username+']] ([[User talk:'+username+'|আলাপ]])-এর করা ' +wgRevId+ 'নং সংস্করণ পুনরুদ্ধার করা হয়েছে';
	editSummary = editSummary + customEditSummary + ' (পুনরুদ্ধারায়ন)';
	$.when(mw.loader.load('mediawiki.api')).then(function(){
		var api = new mw.Api();
		api.get({
			'action':'query',
			'prop':'revisions',
			'titles':mw.config.get('wgRelevantPageName'),
			'rvprop':'ids'
		}).done(function(result){
			if(result.query.pages) {
				var StartRevId = result.query.pages[mw.config.get('wgRelevantArticleId')].revisions[0].revid;
				console.log(StartRevId);
				api.postWithToken('csrf', {
                    action: "edit",
                    title: mw.config.get('wgRelevantPageName'),
                    summary: editSummary,
                    undo:StartRevId,
					undoafter:wgRevId,
                }).done(function(result) {
                    if (typeof result.edit.nochange !== 'undefined') {
                    	$('#mobileRestore b').text('(Failed)');
						alert( 'No change occured');
                        return;
                    }
					console.log(result);
					$('#mobileRestore b').text('(সফলভাবে হয়েছে)')
                    mw.notify('সংস্করণ পুনরুদ্ধার সফল হয়েছে.... পুনঃলোড করা হচ্ছে');
					setTimeout(function() {
                      location.href = mw.util.getUrl('Special:MobileDiff/' + result.edit.newrevid);
                    }, 1500);
                }).fail(function(code, jqxhr) {
                	$('#mobileRestore b').text('(পুনরুদ্ধার কার্য বাতিল করা হয়েছে)');
                    var details;
                    if (code === 'http' && jqxhr.textStatus === 'error') {
                        details = 'HTTP error: ' + jqxhr.xhr.status;
                    } else if (code === 'http') {
                        details = 'HTTP error: ' + jqxhr.textStatus;
                    } else if (code === 'ok-but-empty') {
                        details = 'An empty response was given the server';
                    } else {
                        details = jqxhr.error.info;
                    }
                    alert( details );
                });
			} else {
				alert('Failed to retrieve page details');
			}
		});
	});
});

//history
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/মোবাইল পার্থক্য ইতিহাস.js&action=raw&ctype=text/javascript');

//my common.js
$.when(mw.loader.using(['mediawiki.util'], $.ready)).done( function() {
	mw.util.addPortletLink("p-tb", mw.config.get('wgArticlePath').replace('$1', "ব্যবহারকারী:রবি/common.js"), "common.js", "tb-awbscript", "Personal common.js");
});

if (mw.config.get('wgCanonicalNamespace')+':'+mw.config.get('wgTitle') === 'ব্যবহারকারী:রবি/common.js' && mw.config.get('wgAction') == 'view');

//শীর্ষক
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/উপর নীচ.js&action=raw&ctype=text/javascript');

//Purge
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/পুনঃসতেজ.js&action=raw&ctype=text/javascript');

/** Quick Edit **/
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/দ্রুত সম্পাদনা.js&action=raw&ctype=text/javascript');

//page creation
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/পাতা সৃষ্টিকারক.js&action=raw&ctype=text/javascript');

//redirect fix
$(function() { 	$('#mw-content-text .mw-redirect').after(function() { 		return this.href.indexOf('action=edit') !== -1 || this.href.indexOf('action=') !== -1  || this.href.indexOf('diff=') !== -1 ? '' 			: '<a href="' + 			this.href + 			(this.href.includes('?') ? '&' : '?') + 			'action=edit" title="' + 			(this.title || this.href) + 			' (edit redirect)"><sup>(→)</sup></a>'; 	}); });

//cleanup
mw.loader.load('//bn.bharatpedia.org/index.php?title=ব্যবহারকারী:রবি/পরিষ্কারকরণ.js&action=raw&ctype=text/javascript');