User:WOSlinkerBot/linttask19.js

This is an old revision of this page, as edited by WOSlinkerBot (talk | contribs) at 21:12, 15 January 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(/(\<span style\=\"font-family\: Verdana\"\>\[\[User\:Seadog\.M\.S\|\<font color\=\"Mediumblue\"\>\'\'\'Seadog\'\'\')(\]\]\<sup\>\[\[User talk\:Seadog\.M\.S\|Talk\]\]\<\/sup\>) *(\<\/font\>)/g,'$1$3$2');

          myContent = myContent.replace(/(\<sup\> \[\[User\:Daisy18108\/Guestbook\|\<font color\=\"red\"\>Sign my Guestbook\!\<\/font\>)(\<\/sup\>)(\]\])/g,'$1$3$2');

          myContent = myContent.replace(/(\Thank[ \w]*\. \<\!-- Template\:Huggle\/warn-\w*-\d --\>\<\!-- Template\:uw-\w*\d --\>\[\[User\:Donner60\|Donner60\]\] \(\[\[User talk\:Donner60\|talk\]\]\) \d\d\:\d\d\, \d* \w* \d\d\d\d\ \(UTC\))\n\:(\'\'If this is a \[\[Network address translation\|shared IP address\]\]\, and you did not make the edits\, consider \[\[Wikipedia\:Why create an account\?\|creating an account\]\] for yourself so you can avoid further irrelevant notices\.\'\'\<\!-- Template\:Shared IP advice --\>\<\/del\>)/g,'$1</del>\n:<del>$2');
          myContent = myContent.replace(/(\Thank[ \w]*\. \<\!-- Template\:Huggle\/warn-\w*-\d --\>\<\!-- Template\:uw-\w*\d --\>\[\[User\:Donner60\|Donner60\]\] \(\[\[User talk\:Donner60\|talk\]\]\) \d\d\:\d\d\, \d* \w* \d\d\d\d\ \(UTC\))\n\:(\'\'If this is a \[\[Network address translation\|shared IP address\]\]\, and you did not make the edits\, consider \[\[Wikipedia\:Why create an account\?\|creating an account\]\] for yourself or \[\[Special\:UserLogin\|logging in with an existing account\]\] so you can avoid further irrelevant notices\.\'\'\<\!-- Template\:Shared IP advice --\>\<\/del\>)/g,'$1</del>\n:<del>$2');

          myContent = myContent.replace(/\<sub\>\[\[Special\:Contributions\/Demi\|C\]\]\<\/sup\>/g,'<sub>[[Special:Contributions/Demi|C]]</sub>');

          myContent = myContent.replace(/\<sup\>\[\[Ricers\|lol\<\/sup\>\]\]/g,'<sup>[[Ricers|lol]]</sup>');

          myContent = myContent.replace(/\<sup\>\[\[User\:Empyrycal\|E\<\/sup\>\]\]/g,'<sup>[[User:Empyrycal|E]]</sup>');

          myContent = myContent.replace(/(\<span style\=\"font-weight\: regular\; text-align\:center\; font-size\:14px\; font-family\: \'Helvetica Neue\'\, Helvetica\, Arial\, sans-serif\; display\:block\; width\:1000px\"\>)\n(\<center\>\n)(This monthly newsletter showcases the Wikipedia Education Program\. It focuses on sharing\: your ideas\, stories\, success and challenges\. Be sure to check out the \[\[outreach\:Education\/Newsletter\/\w*_\d*\|full version\]\]\, and \[\[Outreach\:Education\/Newsletter\/Archives\|past editions\]\]\. You can also volunteer to help publish the newsletter\. \[\[Outreach\:Education\/News\/Team\|Join the team\!\]\]\<\/span\>\n\<\/center\>)/g,'$2$1$3');
          myContent = myContent.replace(/(\<center\>\n\<span style\=\"color\:white\; font-size\:24px\; font-family\:times new roman\; display\:block\;  background\:\#339966\; width\:800px\;\"\>)\n(\{\{anchor\|back\}\} *)\n(\In This Issue) *(\n\<\/center\>)/g,'$1$2$3</span>$4');
          myContent = myContent.replace(/(\|\<span style\=\"font-size\:16px\; font-family\:times new roman\"\>)\n\n(\[\[Outreach\:Education\/Newsletter\/\w* \d*\/Mobile Learning Week 2017\|Mobile Learning Week 2017\]\])\n(\<\/span\>\n)\<\/span\>\n/g,'$1$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,'');


          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/html5-misnesting|lint errors]]';
                  document.getElementById('wpMinoredit').checked = true;
              }
          }

    }
)}