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 08: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(//g,'');
        //myContent = myContent.replace(//g,'');
        //myContent = myContent.replace(//g,'');
        //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;
              }
          }

    }
)}