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

// 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(/(row|col)span *\= *(\d+)([^\d]+?)/gi, '$1span="$2"$3');    	myContent = myContent.replace(/width *\= *["']? *(\d+\%) *["']? *\|/gi, 'style="width:$1;"|');       /* Cleanup quarry results        myContent = myContent.replace(/_/gi,' ');        myContent = myContent.replace(/\{\| *class\=\"wikitable\"\n\![^\n]+\n/gi,);        myContent = myContent.replace(/\n\|-\n/gi,'\n');        myContent = myContent.replace(/\n\|\}/gi,);        myContent = myContent.replace(/\|([#*])/gi,'$1');        myContent = myContent.replace(/&#124;/gi,'|');        */ if(document.getElementById('wpTextbox1').value != myContent) {                  document.getElementById('wpTextbox1').value=myContent;                  document.getElementById('wpSummary').value='Update table markup to HTML5';                  document.getElementById('wpMinoredit').checked = false;                  document.forms.editform.wpDiff.click;              }    } )} //