Jump to content

User:WOSlinker/center.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// <nowiki>

function center_queryString(p) {
    var re = RegExp('[&?]' + p + '=([^&]*)');
    var matches;
    if (matches = re.exec(document.location)) {
        try { 
            return decodeURI(matches[1]);
        } catch (e) { }
    }
    return null;
}

//Add a 'center edit' tab
if(mw.config.get('wgArticleId') != 0 ) { 
    $( function centerEditButton() {
        mw.util.addPortletLink('p-cactions', 
                       mw.util.getUrl(null,{action:'edit',center:true}),
                       'center',
                       'p-center',
                       'center edit');
    }
)}

if(mw.config.get('wgAction') == 'edit' && center_queryString('center') == 'true') {
    $(function center() {
        var myContent = document.getElementById('wpTextbox1').value;

        //myContent = myContent.replace(/\n\{\{\*mp\}\} /gi,'\n* ');
        //myContent = myContent.replace(/\n\{\{\*mp\}\}/gi,'\n* ');

        myContent = myContent.replace(/(\| *\<center\>[^\<\|]*?\<br *\/*\>\<small\>[^\<]*?) *\n\|/gi,'$1</small></center>\n\|');

        myContent = myContent.replace(/(\| *\<center\>[^\<\|]*?) *\n\|/gi,'$1</center>\n\|');
        myContent = myContent.replace(/(\| *\<center\>[^\<\|]*?) *\n\|/gi,'$1</center>\n\|');

        myContent = myContent.replace(/(\| *\<center\>[^\<\|]*?)( *)\|\|/gi,'$1</center>$2\|\|');
        myContent = myContent.replace(/(\| *\<center\>[^\<\|]*?)( *)\|\|/gi,'$1</center>$2\|\|');

        myContent = myContent.replace(/(\| *\<center\> *\<ref[^\<]*?\<\/ref\>) *\n\|/gi,'$1</center>\n\|');
        myContent = myContent.replace(/(\| *\<center\> *\<ref[^\<]*?\>) *\n\|/gi,'$1</center>\n\|');

        myContent = myContent.replace(/(\| *\<center\> *\[\[[^\<\]]*?\]\]) *\n\|/gi,'$1</center>\n\|');
        myContent = myContent.replace(/(\| *\<center\> *\[\[[^\<\]]*?\]\]) *\n\|/gi,'$1</center>\n\|');
        myContent = myContent.replace(/(\| *\<center\> *\[\[[^\<\]]*?\]\])( *)\|\|/gi,'$1</center>$2\|\|');
        myContent = myContent.replace(/(\| *\<center\> *\[\[[^\<\]]*?\]\])( *)\|\|/gi,'$1</center>$2\|\|');

        myContent = myContent.replace(/(\| *\<center\> *\{\{[\w\d ]*\|[\w\d ]*\}\})( *)\|\|/gi,'$1</center>$2\|\|');
        myContent = myContent.replace(/(\| *\<center\> *\{\{[\w\d ]*\|[\w\d ]*\|[\w\d\– ]*\}\})( *)\|\|/gi,'$1</center>$2\|\|');
        myContent = myContent.replace(/(\| *\<center\> *\{\{[\w\d ]*\|[\w\d ]*\|[\w\d\– ]*\|[\w\d\– ]*\}\})( *)\|\|/gi,'$1</center>$2\|\|');
        myContent = myContent.replace(/(\| *\<center\> *\{\{[\w\d ]*\|[\w\d ]*\|[\w\d\– ]*\}\}) *\n\|/gi,'$1</center>\n\|');

        myContent = myContent.replace(/(\| *\<center\> *\d*? *)\<center\> *\n\|/gi,'$1</center>\n\|');
        myContent = myContent.replace(/(\| *\<center\> *\d*? *)\<center\> *\n\|/gi,'$1</center>\n\|');
        myContent = myContent.replace(/(\| *\<center\> *\d*? *)\<center\>( *)\|\|/gi,'$1</center>$2\|\|');
        myContent = myContent.replace(/(\| *\<center\> *\d*? *)\<center\>( *)\|\|/gi,'$1</center>$2\|\|');

        myContent = myContent.replace(/(\| *\<center\> *[^\<]*?\<sup\>[^\<]*?\<\/sup\>) *\n\|/gi,'$1</center>\n\|');
        myContent = myContent.replace(/(\| *\<center\> *[^\<]*?\<sup\>[^\<]*?\<\/sup\>) *\n\|/gi,'$1</center>\n\|');

        myContent = myContent.replace(/(\| *\<center\>\{\{height\|m\=[\d\. ]*\}\}) *\n/gi,'$1</center>\n');

        //myContent = myContent.replace(/\<center\> *\n/gi,'</center>\n');


        var centermatches1 = myContent.match(/\<center\>/gi); 
        var centermatches2 = myContent.match(/\<\/center\>/gi); 

        if(document.getElementById('wpTextbox1').value != myContent) {
           document.getElementById('wpTextbox1').value=myContent;
           if (centermatches1.length == centermatches2.length) {
              document.getElementById('wpSummary').value='fix center tags';
              document.getElementById('wpSaveWidget').style.visibility = 'visible';
           } else {
              document.getElementById('wpSummary').value='fix center tags (MISMATCH: ' + centermatches1.length + ' - ' + centermatches2.length + ')';
              document.getElementById('wpSaveWidget').style.visibility = 'hidden';
           }
           document.getElementById('wpMinoredit').checked = true;

           document.getElementById('wpTextbox1').addEventListener('change', function() {
              var myContent = document.getElementById('wpTextbox1').value;
              var centermatches1 = myContent.match(/\<center\>/gi); 
              var centermatches2 = myContent.match(/\<\/center\>/gi); 
                 if (centermatches1.length == centermatches2.length) {
                    document.getElementById('wpSummary').value='fix center tags';
                    document.getElementById('wpSaveWidget').style.visibility = 'visible';
                 } else {
                    document.getElementById('wpSummary').value='fix center tags (MISMATCH: ' + centermatches1.length + ' - ' + centermatches2.length + ')';
                    document.getElementById('wpSaveWidget').style.visibility = 'hidden';
                 }
            } , false );

        }


        if(document.getElementById('wpTextbox1').value == myContent) {
            myContent = myContent.replace(/\<small\>\<center\>Uncredited\<center\>\<small\>/gi,'<center><small>Uncredited</small></center>');
            myContent = myContent.replace(/\<small\>\<center\>/gi,'<center><small>');
            myContent = myContent.replace(/\<\/center\>\<\/small\>/gi,'</small></center>');

            if(document.getElementById('wpTextbox1').value != myContent) {
                document.getElementById('wpTextbox1').value=myContent;
                document.getElementById('wpSummary').value='fix small/center tag order';
                document.getElementById('wpMinoredit').checked = true;
            }
        }


    }
)}


function thumb_queryString(p) {
    var re = RegExp('[&?]' + p + '=([^&]*)');
    var matches;
    if (matches = re.exec(document.location)) {
        try { 
            return decodeURI(matches[1]);
        } catch (e) { }
    }
    return null;
}

//Add a 'thumb edit' tab
if(mw.config.get('wgArticleId') != 0 ) { 
    $( function thumbEditButton() {
        mw.util.addPortletLink('p-cactions', 
                       mw.util.getUrl(null,{action:'edit',thumb:true}),
                       'thumb',
                       'p-thumb',
                       'thumb edit');
    }
)}

if(mw.config.get('wgAction') == 'edit' && thumb_queryString('thumb') == 'true') {
    $(function thumb() {
        var myContent = document.getElementById('wpTextbox1').value;

/*
        myContent = myContent.replace(/\* \[http\:\/\/www\.espncricinfo\.com\/[\/\w]*?\/player\/(\d*)\.html .*?\] at \[\[Cricinfo\]* *\n/gi,'* {{Cricinfo|id=$1}}\n');
        myContent = myContent.replace(/\* \[http\:\/\/content\-\w*\.cricinfo\.com\/[\/\w]*?\/player\/(\d*)\.html .*?\] at \[\[Cricinfo\]* *\n/gi,'* {{Cricinfo|id=$1}}\n');
        myContent = myContent.replace(/\* \[http\:\/\/www\.cricinfo\.com\/[\/\w]*?\/player\/(\d*)\.html .*?\] at \[\[Cricinfo\]* *\n/gi,'* {{Cricinfo|id=$1}}\n');

        myContent = myContent.replace(/\*\[http\:\/\/www\.espncricinfo\.com\/[\/\w]*?\/player\/(\d*)\.html .*?\] at \[\[Cricinfo\]* *\n/gi,'*{{Cricinfo|id=$1}}\n');
        myContent = myContent.replace(/\*\[http\:\/\/content\-\w*\.cricinfo\.com\/[\/\w]*?\/player\/(\d*)\.html .*?\] at \[\[Cricinfo\]* *\n/gi,'*{{Cricinfo|id=$1}}\n');
        myContent = myContent.replace(/\*\[http\:\/\/www\.cricinfo\.com\/[\/\w]*?\/player\/(\d*)\.html .*?\] at \[\[Cricinfo\]* *\n/gi,'*{{Cricinfo|id=$1}}\n');

        if(document.getElementById('wpTextbox1').value != myContent) {
           document.getElementById('wpTextbox1').value=myContent;
           document.getElementById('wpSummary').value='use Cricinfo template';
           document.getElementById('wpMinoredit').checked = true;
        }

        myContent = myContent.replace(/(\|align\=\"center\" width\=\"\d*\"\|\<span style\=\"color\:\#FFFFFF\"\>[\'\w ñú\.]*\<\/span\>)\|\|align="center" width/g,'$1\n|align="center" width');
        myContent = myContent.replace(/(\|align\=\"center\" width\=\"\d*\"\|\<span style\=\"color\:\#FFFFFF\"\>[\'\w ñú\.]*\<\/span\>)\|\|align="center" width/g,'$1\n|align="center" width');

        myContent = myContent.replace(/(\|width\=\"\d*\"\|\<span style\=\"color\:\#[Ff]*\"\>[\'\w ñúž\.\-]*\<\/span\>)\|\|width/g,'$1\n|width');
        myContent = myContent.replace(/(\|width\=\"\d*\"\|\<span style\=\"color\:\#[Ff]*\"\>[\'\w ñúž\.\-]*\<\/span\>)\|\|width/g,'$1\n|width');
        myContent = myContent.replace(/(\|width\=\"\d*\"\|\<span style\=\"color\:white\"\>[\'\w ñúž\.\-]*\<\/span\>)\|\|width/g,'$1\n|width');
        myContent = myContent.replace(/(\|width\=\"\d*\"\|\<span style\=\"color\:white\"\>[\'\w ñúž\.\-]*\<\/span\>)\|\|width/g,'$1\n|width');

        myContent = myContent.replace(/(\| *width\=\"\d*\" *\|\<span style\=\"color\:\#[Ff]*\;\"\>[\'\w ñúž\.\-]*\<\/span\>)\|\| *style/g,'$1\n| style');
        myContent = myContent.replace(/(\| *style\=\"width\:\d*px\;\" *\|\<span style\=\"color\:\#[Ff]*\;\"\>[\'\w ñúž\.\-]*\<\/span\>)\|\| *style/g,'$1\n| style');
        myContent = myContent.replace(/(\| *style\=\"width\:\d*px\;\" *\|\<span style\=\"color\:\#[Ff]*\;\"\>[\'\w ñúž\.\-]*\<\/span\>)\|\| *style/g,'$1\n| style');

        myContent = myContent.replace(/\|align\=\"center\" (width\=\"\d*\")\|\<span style\=\"color\:\#[Ff]*\"\>\'\'\'([\w ñúž\.]*)\'\'\'\<\/span\> *\n/g,'!$1 style="background-color:#787878;color:#FFFFFF;"|$2\n');
        myContent = myContent.replace(/\|(width\=\"\d*\")\|\<span style\=\"color\:\#[Ff]*\"\>\'\'\'([\w ñúž\.\-]*)\'\'\'\<\/span\> *\n/g,'!$1 style="background-color:#787878;color:#FFFFFF;"|$2\n');
        myContent = myContent.replace(/\|(width\=\"\d*\")\|\<span style\=\"color\:\#[Ff]*\"\>([\w ñúž\.\-]*)\<\/span\> *\n/g,'!$1 style="background-color:#787878;color:#FFFFFF;"|$2\n');
        myContent = myContent.replace(/\|(width\=\"\d*\")\|\<span style\=\"color\:white\"\>([\w ñúž\.]*)\<\/span\> *\n/g,'!$1 style="background-color:#787878;color:#FFFFFF;"|$2\n');

        myContent = myContent.replace(/\| (style\=\"width\:\d*px\;)\" \|\<span style\=\"color\:\#[Ff]*\;\"\>([\w ñúž\.\-]*)\<\/span\> *\n/g,'! $1background-color:#787878;color:#FFFFFF;" |$2\n');

        myContent = myContent.replace(/\|\- bgcolor\=\"\#787878\" colspan\=10 align\=\"center\" *\n(\!width\=\"\d*\" style\=\"background\-color\:\#787878)/g,'$1');
        myContent = myContent.replace(/\{\| class\=\"wikitable\" style\=\"margin\: 1em 1em 1em 0\; background\: \#FFFFFF\; border\: 1px \#aaa solid\; border\-collapse\: collapse\; /g,'{| class="wikitable" style="');
        myContent = myContent.replace(/\|\-bgcolor\=\"\#787878\" colspan\=10 align\=\"center\"\n\| colspan/g,'|-bgcolor="#787878" align="center"\n| colspan');
*/

//        myContent = myContent.replace(/\n( *)\|( *)(caption1 *\= *\<center\>)/g,'\n$1|$2caption_align = center\n$1|$2$3');
//        myContent = myContent.replace(/( *\| *caption\d *\= *)\<center\>(.*?)\<\/center\> *\n/g,'$1$2\n');

//        myContent = myContent.replace(/\<center\>/g,'');
//        myContent = myContent.replace(/\<\/center\>/g,'');
//        myContent = myContent.replace(/\<font color\=\"gray\"\>(\&[gl]t\;)\<\/font\>/g,'<span style="color:gray">$1</span>');

//        myContent = myContent.replace(/(class *\= *\")collapsible collapsed\"/g,'$1mw-collapsible mw-collapsed"');
//        myContent = myContent.replace(/(class *\= *\"wikitable) collapsible collapsed\"/g,'$1 mw-collapsible mw-collapsed"');
//        myContent = myContent.replace(/(class *\= *\"wikitable) collapsible\"/g,'$1 mw-collapsible"');

///        myContent = myContent.replace(/\<span\>([^\<]*)\<\/span\>/g,'$1');


//        myContent = myContent.replace(/(\n\=\=* *External )[Ll]ink( *\=*)/g,'$1links$2');
//        myContent = myContent.replace(/\<font color\=\"000000\"\>([^\<]*)\<\/font *\>/gi,'<span style="color:#000000;">$1</span>');
//        myContent = myContent.replace(/\<font color\=\"(\#[0-9a-z]*)\"\>([^\<]*)\<\/font *\>/gi,'<span style="color:$1;">$2</span>');
//        myContent = myContent.replace(/\<font color\=\"([a-z]*)\"\>([^\<]*)\<\/font\>/gi,'<span style="color:$1;">$2</span>');
//        myContent = myContent.replace(/\<font color *\= *\"([a-z]*)\" *\>([^\<]*)\<\/font\>/gi,'<span style="color:$1;">$2</span>');
//        myContent = myContent.replace(/\<font face *\= *\"([a-z]*)" *color *\= *\"([a-z]*)\" *\>([^\<]*)\<\/font\>/gi,'<span style="font-family:$1;color:$2;">$3</span>');
//        myContent = myContent.replace(/\<font color *\= *\"Jade\" *face\=\"([a-z]*)" *\>([^\<]*)\<\/font\>/gi,'<span style="color:Lime;font-family:$1;">$2</span>');

//        myContent = myContent.replace(/\n\'\'\'Immediate([^\n\']*?)\]\n/g,'\n\'\'\'Immediate$1]\'\'\'\n');
//        myContent = myContent.replace(/\n\'\'\'Immediate([^\n\'\:]*)\n/g,'\n\'\'\'Immediate$1\'\'\'\n');
//        myContent = myContent.replace(/\n\'\'\'Immediate([^\n\']*)\n/g,'\n\'\'\'Immediate$1 \'\'\'\n');

//        myContent = myContent.replace(/\[tel\:[^ \]]*  *([^\]]*)]/g,'$1');
//        myContent = myContent.replace(/(\<big\>)\n(\'\'\'The \[\[Wikipedia\:WikiCup\|WikiCup\]\] Newsletter\'\'\'\<\/big\>)/g,'$1$2');
//        myContent = myContent.replace(/(\<big\>)\n(\'\'\'The \[\[User\:Garden\/WikiCup\|WikiCup\]\] Newsletter\'\'\'\<\/big\>)/g,'$1$2');
//        myContent = myContent.replace(/(\[\[User_talk\:IMatthew\|\<span style\=\"font-family\:Century Gothic\;color\:\#007BA7\"\>\<sup\>talk\<\/sup\>)(\]\])/g,'$1</span>$2');
//        myContent = myContent.replace(/(and \[\[User\:Thehelpfulone\|\<font color\=\"red\"\>\'\'\'The\'\'\'\<\/font\>\]\]\[\[User_talk\:Thehelpfulone\|\<font color\=\"black\"\> \'\'\'Helpful\'\'\'\<\/font\>\]\]\[\[Special\:Contributions\/Thehelpfulone\|\<font color\=\"red\"\> \'\'\'One\'\'\'\<\/font\>\]\]) *\<\/span\>\<\/font\>/g,'$1');

        //myContent = myContent.replace(/( \d* \(UTC\)\<\/small\>)(\<\/center\>)(\<\/span\>)/g,'$1$3$2');
        //myContent = myContent.replace(/( \d* \(UTC\)\<\/small\>)(\<\/center\>)/g,'$1</span>$2');

//        myContent = myContent.replace(/(\| \'\'\'\[\[Wikipedia\:WikiProject Yorkshire\/Newsletter\/\w* 20\d\d\|Single-Page View\]\])(\<\/small\>)(\'\'\')/g,'$1$3$2');

//        myContent = myContent.replace(/(\<span style\=\"text-align\:right\;\"\>\<br \/\>\<small\>This message was delivered by \[\[User\:HostBot\|HostBot\]\] \(\[\[User talk\:HostBot\|talk\]\]\) \d*\:\d*\, \d* \w* \d* \(UTC\)\<\/small\>)(\<\/small\>)(\<\/span\>)/g,'$1$3$2');

        //myContent = myContent.replace(/\<small\>\{\{browsebar\}\}\<\/small\>/,'{{smalldiv|1={{Portals browsebar}}}}');
        //myContent = myContent.replace(/\<small\>(\{\{browsebarcountry\|[\w ]*\|[\w ]*\}\})\<\/small\>/i,'{{smalldiv|1=$1}}');

//           myContent = myContent.replace(/\<center\>([\d\w \'\-–\:\.\/]*)\<\/center\>/g,'{{center|$1}}');
/*
           myContent = myContent.replace(/\<center\>(\<ref\>[^\<]*\<\/ref\>)\<\/center\>/g,'{{center|$1}}');
           myContent = myContent.replace(/\<center\>(\<ref name\=\"[^\"]*\"\>[^\<]*\<\/ref\>)\<\/center\>/g,'{{center|$1}}');
           myContent = myContent.replace(/\<center\>(\<ref name\=\"[^\"]*\" *\/\>)\<\/center\>/g,'{{center|$1}}');
*/
/*
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\=\<]*)\<\/div\>/gi,'{{center|$1}}');
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\<]*)\<\/div\>/gi,'{{center|1=$1}}');
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\=\<]*\<ref[^\<]*\<\/ref\>)\<\/div\>/gi,'{{center|1=$1}}');
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\=\<]*\<ref[^\>\<]*\>)\<\/div\>/gi,'{{center|1=$1}}');
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\=\<]*\<sup\>[^\=\<]*\<\/sup\>)\<\/div\>/gi,'{{center|$1}}');
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\=\<]*\<small\>[^\=\<]*\<\/small\>)\<\/div\>/gi,'{{center|$1}}');
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\=\<]*\<br ?\/?\>\<small\>[^\=\<]*\<\/small\>)\<\/div\>/gi,'{{center|$1}}');
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\=\<]*\<br ?\/?\>\<small\>[^\=\<]*\<\/small\>[^\=\<]*)\<\/div\>/gi,'{{center|$1}}');
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\=\<]*\<br ?\/?\>[^\=\<]*)\<\/div\>/gi,'{{center|$1}}');
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\=\<]*\<br ?\/?\>[^\=\<]*\<sup\>[^\=\<]*\<\/sup\>)\<\/div\>/gi,'{{center|$1}}');
        myContent = myContent.replace(/\<div *style\=\"text-align\: *center\;\"\>([^\=\<]*\<br ?\/?\>[^\=\<]*\<br ?\/?\>\<sup\>[^\=\<]*\<\/sup\>)\<\/div\>/gi,'{{center|$1}}');
*/
//        myContent = myContent.replace(/\n\|- *style\=\"text-align\: *center\;\" */gi,'\n|-\n');
//        myContent = myContent.replace(/\| *align *\= *left *\|/gi,'| style="text-align:left;" |');

/*
        myContent = myContent.replace(/\<s\>(\=\=[\= \d]*)\n/gi,'$1\n<s>\n');
        myContent = myContent.replace(/(\=\= *)\<s\>([\= \d]*)\n/gi,'$1$2\n<s>\n');

        myContent = myContent.replace(/\n(\# *)\<s\>([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');

        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');
        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');
        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');
        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');
        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');
        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');
        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');
        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');
        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');
        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');
        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\n/gi,'\n$1<s>$2</s>\n<s>\n');

        myContent = myContent.replace(/\n\<s\>\n(\# *)([^\<\n]*)\<\/s\>\n/gi,'\n$1<s>$2</s>\n');

        myContent = myContent.replace(/\n\<s\>\n\<\/s\>\n/gi,'\n');
*/

/*
        myContent = myContent.replace(/\[\[User\:Cliff smith\|\'\'\'\<span style\=\"font-family\:georgia\;\"\>Cliff\'\'\'\]\] \[\[User talk\:Cliff smith\|Smith\<\/span>\]\]/g,'<span style="font-family:georgia;">[[User:Cliff smith|\'\'\'Cliff\'\'\']] [[User talk:Cliff smith|Smith]]</span>');
        myContent = myContent.replace(/\[\[User\:KartikeyaS343\|\<span style\=\"font-family\: cursive\"\>KartikeyaS\]\] \(\[\[User talk\:KartikeyaS343\#top\|talk\<\/span\>\]\]\)/gi,'<span style="font-family: cursive">[[User:KartikeyaS343|KartikeyaS]] ([[User talk:KartikeyaS343#top|talk]])</span>');
        myContent = myContent.replace(/(\|\<small\>\<span style\=\"color\:\#6495ED\;text-shadow\:grey 0\.2em 0\.2em 0\.4em\"\>\'\'\'Jinnai\'\'\'\<\/span\>\<\/small\>)\<\/sub\>(\]\])/gi,'$1$2');
        myContent = myContent.replace(/(\[\[User\:SRX\|\<span style\=\"color\:black\;\"\>S\<\/span\>)\<\/font\>(\]\])/gi,'$1$2');
        myContent = myContent.replace(/(\[\[User\:SRX\/Guestbook\|\<span style\=\"color\:black\;\"\>X\<\/span\>)\<\/font\>(\]\])/gi,'$1$2');

        myContent = myContent.replace(/(\'\'\'\<span style\=\"color\:[a-z]*\;?\"\>[A-Za-z0-9 \.\!]*)(\'\'\')(\<\/span\>)/gi,'$1$3$2');
        myContent = myContent.replace(/(\'\'\'\<span style\=\"color\:\#[a-f0-9]*\;?\"\>[A-Za-z0-9 \.\!]*)(\'\'\')(\<\/span\>)/gi,'$1$3$2');

        myContent = myContent.replace(/(\'\'\<span style\=\"color\:[a-z]*\;?\"\>[A-Za-z0-9 \.\!]*)(\'\')(\<\/span\>)/gi,'$1$3$2');
        myContent = myContent.replace(/(\'\'\<span style\=\"color\:\#[a-f0-9]*\;?\"\>[A-Za-z0-9 \.\!]*)(\'\')(\<\/span\>)/gi,'$1$3$2');
*/

//        myContent = myContent.replace(/(\}\})\n(\<\/div\>\n\|\})/,'$1\n{{Image label end}}\n$2');
//        myContent = myContent.replace(/(\}\})(\<\/div\>\n\|\})/,'$1\n{{Image label end}}\n$2');

        myContent = myContent.replace(/\n\|- align\=\"*center\"* style\=\"background\:([A-Za-z]*)\;\" *\n/g,'\n|- style="text-align:center;background:$1;"\n');
        myContent = myContent.replace(/\n\|- align\=\"*center\"* style\=\"background\:(\#[A-Za-z0-9]*)\;\" *\n/g,'\n|- style="text-align:center;background:$1;"\n');
        myContent = myContent.replace(/\n\|- align\=\"*center\"* bgcolor\=\"*(\#[A-Za-z0-9]*)\"* *\n/g,'\n|- style="text-align:center;background:$1;"\n');
        myContent = myContent.replace(/\n\|- align\=\"*center\"* *\n/g,'\n|- style="text-align:center;"\n');
        myContent = myContent.replace(/\|align\=\"*left\"*\|/g,'|style="text-align:left;"|');
        myContent = myContent.replace(/\|align\=\"*center\"*\|/g,'|style="text-align:center;"|');

        if(document.getElementById('wpTextbox1').value != myContent) {
           document.getElementById('wpTextbox1').value=myContent;
}
           document.getElementById('wpSummary').value='use style for align';
           document.getElementById('wpMinoredit').checked = true;
//        }


   }
)}

// </nowiki>