User:WOSlinkerBot/linttask10.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(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\>)(  \<\!\-\-Template\:Rb\-\-\>\<\/div\>)/g,'$1\'\'$2');

          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page\.)(\<\!\-\- Template\:Rfd bottom \-\-\>\<\/div\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the discussion\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page\.)(\<\/div\>\<\/noinclude\>\<\!\-\- Template\:Rfd bottom \-\-\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the discussion\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page\.)(\<\/noinclude\>\<\/div\>\<\!\-\- Template\:Rfd bottom \-\-\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the discussion\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page\.)(\n\{\{\#ifeq\:\{\{FULLPAGENAME\}\}\|Wikipedia\:Redirects for discussion\|\{\{collapse bottom\}\}\|\}\}\<\/div\>\<\!\-\- Template\:Rfd bottom \-\-\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page\.)(\n\{\{\#ifeq\:\{\{FULLPAGENAME\}\}\|Wikipedia\:Redirects for discussion\|\{\{collapse bottom\}\}\|\}\}\<\/div\>\<\!\-\- Template\:Rfd bottom \-\-\>)/g,'$1\'\'$2');

          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the proposal\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made in a new section on this talk page\. No further edits should be made to this section\.)(\<\/div\>\<\!\-\- Template\:pollbottom \-\-\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made in a new section on this talk page\. No further edits should be made to this section\.)(\<\/div\>\<\!\-\- Template\:pollbottom \-\-\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the \{\{\{type\|proposal\}\}\}\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made in a new section on this talk page\. No further edits should be made to this section\.)(\<\/div\>\<\!\-\- Template\:pollbottom \-\-\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<font color\=\"red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/font\> Subsequent comments should be made in a new section on this talk page\. No further edits should be made to this section\.)(\<\/div\>\<\!\-\- Template:pollbottom \-\-\>)/g,'$1\'\'$2');

          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page \(such as the article\'s talk page or in a \[\[Wikipedia\:Deletion review\|deletion review\]\]\)\. No further edits should be made to this page\.)( \<\!\-\-Template\:Afd bottom\-\-\>\<\/div\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page \(such as the article\'s \[\[Help\:Using talk pages\|talk page\]\] or in a \[\[Wikipedia\:Deletion review\|deletion review\]\]\)\. No further edits should be made to this page\.)( \<\!\-\-Template\:Afd bottom\-\-\>\<\/div\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\. *\<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> No further edits should be made to this page\.)( \<\!\-\-Template\:Afd bottom\-\-\>\<\/div\>)/g,'$1\'\'$2');

          myContent = myContent.replace(/(\:\'\'The above consensus is preserved as an archive of the debate\. \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\>  Subsequent comments should be made on the appropriate discussion page \(such as the media\'s talk page\)\.  No further edits should be made to this section\.)( \<\!\-\-Template\:Ffd bottom\-\-\>\<\/div\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\. \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\>  Subsequent comments should be made on the appropriate discussion page \(such as the media\'s \[\[Help\:Using talk pages\|talk page\]\] or in a \[\[Wikipedia\:Deletion review\|deletion review\]\]\)\.  No further edits should be made to this section\.)( \<\!\-\-Template\:Ffd bottom\-\-\>\<\/div\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\. \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\>  Subsequent comments should be made on the appropriate discussion page \(such as the media\'s talk page or in a \[\[Wikipedia\:Deletion review\|deletion review\]\]\)\.  No further edits should be made to this section\.)( \<\!\-\-Template\:Ffd bottom\-\-\>\<\/div\>)/g,'$1\'\'$2');

          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\. \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\>  Subsequent comments should be made on the appropriate discussion page \(such as the media\'s talk page or in a \[\[Wikipedia\:Deletion review\|deletion review\]\]\)\.  No further edits should be made to this section\.)( \<\!\-\-Template\:Ifd bottom\-\-\>\<\/div\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page \(such as the article\'s talk page or in a \[\[Wikipedia\:Deletion review\|deletion review\]\]\)\. No further edits should be made to this page\.)( \<\!\-\-Template\:Ifd bottom\-\-\>\<\/div\>)/g,'$1\'\'$2');

          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of a \[\[WP\:RM\|requested move\]\]\. *\<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made in a new section on this talk page or in a \[\[WP\:move review\|move review\]\]\. No further edits should be made to this section\.)(\<\/div\>\<\!\-\- Template\:RM bottom \-\-\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of a \[\[WP\:RM\|requested move\]\]\. *\<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made in a new section on this talk page\. No further edits should be made to this section\.)(\<\/div\>\<\!\-\- Template\:RM bottom \-\-\>)/g,'$1\'\'$2');
          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of a \[\[Wikipedia\:Requested moves\|requested move\]\]\. *\<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made in a new section on this talk page or in a \[\[Wikipedia\:Move review\|move review\]\]\. No further edits should be made to this section\.)(\<\/div\>\<\!\-\- Template\:RM bottom \-\-\>)/g,'$1\'\'$2');

          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<span style\=\"color\:red\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page \(such as the template\'s talk page or in a \[\[Wikipedia\:Deletion review\|deletion review\]\]\)\. No further edits should be made to this section\.)(\<\/div\>)/g,'$1\'\'$2');

          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<span style\=\"color\:Brown\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page \(such as the images\'s talk page or in a \[\[Wikipedia\:Deletion review\|deletion review\]\]\)\. No further edits should be made to this page\.)( \<\!\-\-Template\:Puf bottom\-\-\>\<\/div\>)/g,'$1\'\'$2');

          myContent = myContent.replace(/(\:\'\'The above discussion is preserved as an archive of the debate\.  \<span style\=\"color\:Brown\"\>\'\'\'Please do not modify it\.\'\'\'\<\/span\> Subsequent comments should be made on the appropriate discussion page \(such as the images\'s talk page or in a \[\[Wikipedia\:Deletion review\|deletion review\]\]\)\. No further edits should be made to this page\.)( \<\!--Template\:Pui bottom--\>\<\/div\>)/g,'$1\'\'$2');


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

              if(document.getElementById('wpTextbox1').value != myContent) {
                  document.getElementById('wpTextbox1').value=myContent;
                  document.getElementById('wpSummary').value='add missing italics in discussion close to reduce [[Special:LintErrors|lint errors]]';
                  document.getElementById('wpMinoredit').checked = true;
              }
          }

    }
)}