ಸದಸ್ಯ:ಮಲ್ನಾಡಾಚ್ ಕೊಂಕ್ಣೊ/replace.js

ವಿಕಿಪೀಡಿಯದಿಂದ, ಇದು ಮುಕ್ತ ಹಾಗೂ ಸ್ವತಂತ್ರ ವಿಶ್ವಕೋಶ

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
// <nowiki>
function replace_queryString(p) {
    var re = RegExp('[&?]' + p + '=([^&]*)');
    var matches = re.exec(document.location);
    if (matches) {
        try { 
            return decodeURI(matches[1]);
        } catch (e) { }
    }
    return null;
}

//Add a 'replace' tab
if(mw.config.get('wgArticleId') != 0 ) { 
    $( function replaceEditButton() {
        mw.util.addPortletLink('p-cactions', 
                       mw.util.getUrl(null,{action:'edit',replaceedit:true}),
                       'replace',
                       'p-replace',
                       'replace');
    }
)}

if(mw.config.get('wgAction') == 'edit' && replace_queryString('replaceedit') == 'true') {
    $(function replace() {
    	var myContent = document.getElementById('wpTextbox1').value;
    	
    	myContent = myContent.replace(/\{\{ *Portalbox[^}]*?\}\}/gi, '');
        
if(document.getElementById('wpTextbox1').value != myContent) {
                  document.getElementById('wpTextbox1').value=myContent;
                  document.getElementById('wpSummary').value='Removed {{Portalbox}}, there is no Portal namespace in Kannada wikipedia';
                  document.getElementById('wpMinoredit').checked = true;
                  document.forms.editform.wpDiff.click();
              }
    }
)}
// </nowiki>