Jump to content

User:WOSlinkerBot/linttask21.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by WOSlinkerBot (talk | contribs) at 19:56, 18 February 2022. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
function lint_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 'lint edit' tab
if(mw.config.get('wgArticleId') != 0 ) { 
    $( function lintEditButton() {
        mw.util.addPortletLink('p-cactions', 
                       mw.util.getUrl(null,{action:'edit',lintedit:true}),
                       'lint',
                       'p-lint',
                       'lint edit');
    }
)}

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

        myContent = myContent.replace(/(<div style\=\"text-align\: center\; float\: center\; clear\: center\;\"\>)\<font color\=\#000000 font size\=6 face\=\"([\w ]*)\"\>(\'\'\'EURO\[\[Image\:Wiki Eurovision Heart \(Infobox\)\.svg\|36px\]\]ISION\'\'\')(\<br\/?\>\<\/div\>)\<\/font\>/g,'$1<span style="color:#000000;font-size:xx-large;font-family:$2;">$3</span>$4');
        myContent = myContent.replace(/(<div style\=\"text-align\: center\; float\: center\; clear\: center\;\"\>)\<font color\=\#000000 font size\=6 face\=\"([\w ]*)\"\>(\'\'\'EURO\[\[Image\:Wiki Eurovision Heart \(Infobox\)\.svg\|36px\]\]ISION\'\'\')(\<\/div\>)\<\/font\>/g,'$1<span style="color:#000000;font-size:xx-large;font-family:$2;">$3</span>$4');
        myContent = myContent.replace(/(\<div style\=\"text-align\: center\;\"\>)\<font color\=\#FFFFFF font size\=2 face\=\"Eurostile\"\>(\'\'\'WikiProject Newsletter - \w* \d*\'\'\')(\<\/div\>)\<\/font\>/g,'$1<span style="color:#FFFFFF;font-size:small;font-family:Eurostile;">$2</span>$3');
        myContent = myContent.replace(/(\<div style\=\"text-align\: center\; float\: center\; clear\: center\;\"\>)\<font color\=\#000000 font size\=4 face\=\"Comic Sans MS\"\>(\'\'\'• WikiProject News •\'\'\')(\<\/div\>)/g,'$1<span style="color:#000000;font-size:large;font-family:Comic Sans MS;">$2</span>$3');
        myContent = myContent.replace(/(\<div style\=\"text-align\: center\; float\: center\; clear\: center\;\"\>)\<font color\=\#FFFFFF font size\=2 face\=\"Comic Sans MS\"\>(\'\'Issue \#20 • July 2012\'\')(\<\/div\>)\<\/font\>/g,'$1<span style="color:#FFFFFF;font-size:small;font-family:Comic Sans MS;">$2</span>$3');

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

        myContent = myContent.replace(/(\[\[User talk\:TaerkastUA\|\<span style\=\"color\:red\"\>\'\'\'Talk)(\]\])(\'\'\'\<\/span\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\[\[User\:Sirex98\|\<span style\=\"border\:3px solid \#aaf\;cursor\:crosshair\"\>\<span style\=\"background\:\#11e\;color\:\#bbf\"\>\'\'\'≡Ѕirex98≡\'\'\')(\]\])(\<\/span\>\<\/span\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\'\' \'\'\'\[\[User\:Île_flottante\|\<font color\=\"6600FF\"\>\<big\>Île flott.nte~Flo.ting isl.nd\<\/big\>\<\/font\>\]\]  \[\[User talk\:Île_flottante\|\<font color\=\"red\" size\=\"0\.5\"\>\<sup\>Talk\<\/sup\>\<\/font\>\]\])(\'\') (\'\'\')/g,'$1$3 $2');

        myContent = myContent.replace(/(\[\[User\:SpinkZeroZero\|\<b\>\<span style\=\"color\:red\"\>Mr\. Spink)(\]\])(\<\/span\>\<\/b\>)/g,'$1$3$2');
        myContent = myContent.replace(/(\<sup\>\<sup\>\[\[User_talk\:SpinkZeroZero\|\<span style\=\"color\:lightblue\"\>talk)(\]\].\[\[Special\:Contributions\/SpinkZeroZero\|\<span style\=\"color\:lightblue\"\>contribs)(\]\])(\<\/span\>)(\<\/span\>)(\<\/sup\>\<\/sup\>)/g,'$1$4$2$5$3$6');

        myContent = myContent.replace(/(\[\[User\:MJCdetroit\|)(\<font color\=\"\#0000CD\"\>)(\'\'\')(MJC\<\/font \>\<font color\=\"\#FF0000\"\>detroit)(\'\'\')(\<\/font \>)(\]\])/g,'$1$3$2$4$6$5$7');

        myContent = myContent.replace(/(\[\[User\:Danielfolsom\|\<span style\=\"color\: \#CCFF99\; background\: \#003300\"\>daniel)(\]\]\[\[User_talk\:Danielfolsom\|\<span style\=\"color\:\#FFCCCC\; background\:\#660000\"\>folsom)(\]\])(\<\/span\>)(\<\/span\>)/g,'$1$4$2$5$3');

        myContent = myContent.replace(/(\[\[User talk\:Chasewc91\|\<font color\=\"blue\"\>talk)(\]\])(\<\/font\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\[\[User talk\:Corvoe\|\<span style\=\"font-family\: Arial\;color\: \#FF00FF\"\>\(speak to me\))(\]\])(\<\/span\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\[\[User\:Goldman60\|\<span style\=\"background-color\:black\;font-variant\:small-caps\;font-weight\:bold\;padding\:1px 4px 1px 4px\;color\:yellow\;\"\>Gold Man60)(\]\])(\<\/span\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\[\[User\:PRODUCER\|\<font color\=\"black\"\>\<font style\=\"letter-spacing\: 0\.2cm\;\"\>.PRODUCER)(\]\])(\<\/font\>\<\/font\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\<sup\>\[\[Help\:Japanese\|.\]\] · \<small\>\[\[User talk\:Nihonjoe\|Talk to Nihonjoe)(\]\]\<\/sup\>)(\<\/small\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\[\[User\:CorleoneSerpicoMontana\|\<span style\=\"border\: 1px\; border-style\:solid\; color\:white\; background-color\:red\"\>\&nbsp\;CorleoneSerpicoMontana\&nbsp\;)(\]\])(\<\/span\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\<sup\>\[\[User talk\:Wesley Mouse\|\<span style\=\"color\:\#[\w\d]*\"\>T@lk\<\/span\>\]\])(\'\'\')(\<\/sup\>)(\<\/span\>)/g,'$1$3$2$4');

        myContent = myContent.replace(/(\[\[User talk\:Signalhead\|\<font color\=\"black\"\>\<sup\>\&lt\;\<small\>\&nbsp\;\'\'\'T\'\'\'\&nbsp\;\<\/small\>\&gt\;)(\]\])(\<\/sup\>\<\/font\>)/g,'$1$3$2');
        myContent = myContent.replace(/(\[\[User\:Signalhead\|)(\<span style\=\"font-variant\:small-caps\"\>)(\<font color\=\"red\"\>\'\'\'S\'\'\'ignal\<\/font\>\<font color\=\"green\"\>head\<\/font\>\]\]\&nbsp\;\[\[User talk\:Signalhead\|\<font color\=\"black\"\>\<sup\>\&lt\;\<small\>\&nbsp\;\'\'\'T\'\'\'\&nbsp\;\<\/small\>\&gt\;\<\/sup\>\<\/font\>\]\]\<\/span\>)/g,'$2$1$3');

        myContent = myContent.replace(/(\[\[User talk\:Strdst_grl\|\<span style\=\"font-family\:Monotype Corsiva\;color\:LightSkyBlue\"\>\(call me Stardust\))(\]\])(\<\/span\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\<sub\>\[\[User\:LAAFan\/Editor review \(LAAFan\) \|review\]\])(\'\')(\<\/sub\>)/g,'$1$3$2');
        myContent = myContent.replace(/(\<sub\>\[\[Wikipedia\:Editor review\/LAAFan \d\|review\]\])(\'\')(\<\/sub\>)/g,'$1$3$2');
        myContent = myContent.replace(/(\<sub\>\[\[Wikipedia\:Editor review\/LAAFan \(\d\)\|review\]\])(\'\')(\<\/sub\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\[\[User talk\:J-stan\|\<strong\>)(\<font color\=\"Black\"\>)\'\'(Jus\<\/font\>\<font color\=\"Red\"\>tin)\'\'(\<\/font\>)(\<\/strong\>\]\])/g,'$1\'\'$2$3$4\'\'$5');

        myContent = myContent.replace(/(\'\'\')(\<small\>)(\[\[User_talk\:NottNott\|let\'s talk\!\]\]\'\'\'  \[\[Special\:Contributions\/NottNott\|contrib\]\]\<\/small\>)/g,'$2$1$3');

        myContent = myContent.replace(/(\[\[User\:La Pianista\|)(\<font color\=\"\#00008B\"\>)\'\'\'(La\<\/font\>\&nbsp\;\<font color\=\"dodgerblue\"\>Pianista)\'\'\'(\<\/font\>)(\]\])/g,'$1\'\'\'$2$3$4\'\'\'$5');

        myContent = myContent.replace(/(\'\'\'\[\[User\:Gloss\|\<span style\=\"font-family\:Arial\;color\:\#000080\"\>Gloss\<\/span\>\]\]\&nbsp\;•\&nbsp\;\[\[User_talk\:Gloss\|\<span style\=\"font-family\:Arial\;color\:\#007BA7\"\>talk)(\]\]\'\'\')(\<\/span\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\[\[User\:Alxeedo\|\<font family\=\"Exotc350 Bd BT\" color\=\"red\"\>\<big\>Alxeedo\<\/big\>)(\]\])(\<\/font\>)/g,'$1$3$2');

        myContent = myContent.replace(/(\[\[User\:Blofeld of SPECTRE\| \<span style\=\"border\:1px solid blue\;padding\:1px\;\"\> \<font style\=\"color\:\#fef\;background\:black\;\"\>\'\'\'\'\'[♦\. \w]*\'\'\'\'\'\<\/font\>)(\]\])(\<\/span\>)/g,'$1$3$2');
        myContent = myContent.replace(/(\[\[User\:Dr\. Blofeld\| \<span style\=\"border\:1px solid blue\;padding\:1px\;\"\> \<font style\=\"color\:\#fef\;background\:black\;\"\>\'\'\'\'\'[\. \w]*\'\'\'\'\'\<\/font\>)(\]\])(\<\/span\>)/g,'$1$3$2');

        //myContent = myContent.replace(//g,'');
        //myContent = myContent.replace(//g,'');
        //myContent = myContent.replace(//g,'');
        //myContent = myContent.replace(//g,'');


          if(document.getElementById('wpTextbox1').value != myContent) {

              if(document.getElementById('wpTextbox1').value != myContent) {
                  document.getElementById('wpTextbox1').value=myContent;
                  document.getElementById('wpSummary').value='Fix misnested tag [[Special:LintErrors/misnested-tag|lint errors]]';
                  document.getElementById('wpMinoredit').checked = true;
              }
          }

    }
)}