This is an old revision of this page, as edited by AFigureOfBlue (talk | contribs) at 22:24, 27 April 2009 (Remove unneeded). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Revision as of 22:24, 27 April 2009 by AFigureOfBlue (talk | contribs) (Remove unneeded)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)//
if( typeof( codefixerMinor ) == 'undefined' ) { //CONFIGURATION codefixerMinor = true; } function codefixer() { //MAIN FUNCTION describes list of fixes var txt = document.editform.wpTextbox1; var page_name = wgPageName.replace('_',' '); txt.value = txt.value.replace(new RegExp('ISBN-10:|ISBN-13:|ISBN-10|ISBN-13|ISBN:', 'gi'), 'ISBN'); } function codefixerstartinedit() { //Initiates CodeFixer if you are already in edit mode codefixer(); // Add a tag to the summary box var txt = document.editform.wpSummary; var summary = "Code cleaned up using ]"; if (txt.value.indexOf(summary) == -1) { if (txt.value.match(/?\s*$/)) { txt.value += " | "; } txt.value += summary; } document.editform.wpMinoredit.checked = codefixerMinor; document.editform.wpDiff.click() } if(queryString('codefixerstartfromview')) addOnloadHook(function() { codefixerstartfromview(); }) //Part of next function function codefixerstartfromview() { //Initiates CodeFixer if you are viewing the article without currently editing it var txt = document.getElementById('wpTextbox1'); if(!txt) return; codefixer(); document.getElementById('wpSummary').value += 'Code cleaned up using ]'; document.editform.wpMinoredit.checked = codefixerMinor; document.editform.wpDiff.click() } function queryString(p) { //Allows URI to be properly decoded so that codefixerstartfromview() works properly var re = RegExp('' + p + '=(*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches); } catch (e) { } } return null; } addOnloadHook(function () { //Adds "fix code" and "fix code (+)" tabs to page. if(wgCanonicalNamespace == "" || wgCanonicalNamespace == "Image" || wgCanonicalNamespace == "File" || wgCanonicalNamespace == "User" || wgCanonicalNamespace == "Template" || wgCanonicalNamespace == "Project" || wgCanonicalNamespace == "Portal"){ if(document.forms.editform) { addPortletLink('p-cactions', 'javascript:codefixerstartinedit()', 'fix code', 'ca-codefixeredit', 'Cleans up common errors in code and syntax', '', document.getElementById('ca-move')); } //End editform if if(wgAction == "view"){ var url = wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&action=edit'; addPortletLink('p-cactions',url + '&codefixerstartfromview=true', 'fix code','ca-codefixerview', 'Cleans up common errors in code and syntax', '', document.getElementById('ca-move')); } //End pageview if }//End namespace if }); //