Jump to content

User:WOSlinkerBot/linttask14.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.
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 class\=\"plainlinks\"\>)\n(The First WikiConference India is being organized in Mumbai and will take place on 18-20 November 2011\.\<br\> You can see our )\[http\:\/\/meta\.wikimedia\.org\/wiki\/WikiConference_India_2011  Official website\](\, the \[http\:\/\/www\.facebook\.com\/event\.php\?eid\=183138458406482  Facebook event\] and our \[https\:\/\/spreadsheets\.google\.com\/spreadsheet\/viewform\?hl\=en_US\&formkey\=dGNxSzAxUndoOHRGamdDSTFMVGNrd3c6MA\#gid\=0 Scholarship form\]\.)(\n\nBut the activities start now with the  )\[http\:\/\/meta\.wikimedia\.org\/wiki\/WikiConference_India_2011\/Wiki_Outreach 100 day long WikiOutreach\]\.\n\<\/span\>/g,'$1$2[[m:WikiConference_India_2011|Official website]]$3</span>$4[[m:WikiConference_India_2011/Wiki_Outreach|100 day long WikiOutreach]].');
          myContent = myContent.replace(/(\:\#E3F0F4\" \>\n)(\{\| style\=\"border\:1px black solid\; padding\:2em\; border-collapse\:collapse\; width\:100\%\;\"\n)\|-\n(\[\[File\:WCI_banner\.png\|800px\|center\|link\=\:meta\:WikiConference_India_2011\]\]\<br\/\>\n)/g,'$1$3$2');

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

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

    }
)}