Revision as of 22:24, 27 April 2009 view sourceAFigureOfBlue (talk | contribs)Edit filter managers, Administrators53,878 edits Remove unneeded← Previous edit | Revision as of 22:28, 27 April 2009 view source AFigureOfBlue (talk | contribs)Edit filter managers, Administrators53,878 edits CodeFixer → EasyEdNext edit → | ||
Line 1: | Line 1: | ||
// <pre> | // <pre> | ||
if( typeof( |
if( typeof( easyEdMinor ) == 'undefined' ) { //CONFIGURATION | ||
|
easyEdMinor = true; | ||
} | } | ||
Line 12: | Line 12: | ||
} | } | ||
function |
function easyedinedit() { //Initiates EasyEd if you are already in edit mode | ||
codefixer(); | codefixer(); | ||
Line 25: | Line 25: | ||
} | } | ||
document.editform.wpMinoredit.checked = |
document.editform.wpMinoredit.checked = easyEdMinor; | ||
document.editform.wpDiff.click() | document.editform.wpDiff.click() | ||
} | } | ||
if(queryString(' |
if(queryString('easyedfromview')) addOnloadHook(function() { easyedfromview(); }) //Part of next function | ||
function |
function easyedfromview() { //Initiates EasyEd if you are viewing the article without currently editing it | ||
var txt = document.getElementById('wpTextbox1'); | var txt = document.getElementById('wpTextbox1'); | ||
if(!txt) return; | if(!txt) return; | ||
codefixer(); | codefixer(); | ||
document.getElementById('wpSummary').value += 'Code cleaned up using ]'; | document.getElementById('wpSummary').value += 'Code cleaned up using ]'; | ||
document.editform.wpMinoredit.checked = |
document.editform.wpMinoredit.checked = easyEdMinor; | ||
document.editform.wpDiff.click() | document.editform.wpDiff.click() | ||
} | } | ||
function queryString(p) { //Allows URI to be properly decoded so that |
function queryString(p) { //Allows URI to be properly decoded so that easyedfromview() works properly | ||
var re = RegExp('' + p + '=(*)'); | var re = RegExp('' + p + '=(*)'); | ||
var matches; | var matches; | ||
Line 51: | Line 51: | ||
} | } | ||
addOnloadHook(function () { //Adds " |
addOnloadHook(function () { //Adds "easy ed" tabs to page. | ||
if(wgCanonicalNamespace == "" || wgCanonicalNamespace == "Image" || wgCanonicalNamespace == "File" || wgCanonicalNamespace == "User" || wgCanonicalNamespace == "Template" || wgCanonicalNamespace == "Project" || wgCanonicalNamespace == "Portal"){ | if(wgCanonicalNamespace == "" || wgCanonicalNamespace == "Image" || wgCanonicalNamespace == "File" || wgCanonicalNamespace == "User" || wgCanonicalNamespace == "Template" || wgCanonicalNamespace == "Project" || wgCanonicalNamespace == "Portal"){ | ||
if(document.forms.editform) { | if(document.forms.editform) { | ||
addPortletLink('p-cactions', 'javascript: |
addPortletLink('p-cactions', 'javascript:easyedinedit()', 'easy ed', 'ca-easyed', 'Run EasyEd', '', document.getElementById('ca-move')); | ||
} //End editform if | } //End editform if | ||
if(wgAction == "view"){ | if(wgAction == "view"){ | ||
var url = wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&action=edit'; | var url = wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&action=edit'; | ||
addPortletLink('p-cactions',url + '& |
addPortletLink('p-cactions',url + '&easyedfromview=true', 'easy ed','ca-easyed', 'Run EasyEd', '', document.getElementById('ca-move')); | ||
} //End pageview if | } //End pageview if | ||
}//End namespace if | }//End namespace if |
Revision as of 22:28, 27 April 2009
//
if( typeof( easyEdMinor ) == 'undefined' ) { //CONFIGURATION easyEdMinor = 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 easyedinedit() { //Initiates EasyEd 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 = easyEdMinor; document.editform.wpDiff.click() } if(queryString('easyedfromview')) addOnloadHook(function() { easyedfromview(); }) //Part of next function function easyedfromview() { //Initiates EasyEd 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 = easyEdMinor; document.editform.wpDiff.click() } function queryString(p) { //Allows URI to be properly decoded so that easyedfromview() 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 "easy ed" 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:easyedinedit()', 'easy ed', 'ca-easyed', 'Run EasyEd', '', document.getElementById('ca-move')); } //End editform if if(wgAction == "view"){ var url = wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&action=edit'; addPortletLink('p-cactions',url + '&easyedfromview=true', 'easy ed','ca-easyed', 'Run EasyEd', '', document.getElementById('ca-move')); } //End pageview if }//End namespace if }); //