Revision as of 15:03, 28 April 2009 view sourceAFigureOfBlue (talk | contribs)Edit filter managers, Administrators53,878 edits Source tags← Previous edit | Revision as of 15:06, 28 April 2009 view source AFigureOfBlue (talk | contribs)Edit filter managers, Administrators53,878 edits NamesNext edit → | ||
Line 6: | Line 6: | ||
//<pre> | //<pre> | ||
if( typeof( |
if( typeof( autoEdMinor ) == 'undefined' ) { //CONFIGURATION | ||
|
autoEdMinor = true; | ||
} | } | ||
function |
function autoEdFunctions() { //MAIN FUNCTION describes list of fixes. Here to allow for testing during development; this won't be included on this particular page in the final version | ||
var txt = document.editform.wpTextbox1; | var txt = document.editform.wpTextbox1; | ||
Line 16: | Line 16: | ||
} | } | ||
function |
function AutoEdFromEdit() { //Initiates AutoEd if you are already in edit mode | ||
|
autoEdFunctions(); | ||
// Add a tag to the summary box | // Add a tag to the summary box | ||
var txt = document.editform.wpSummary; | var txt = document.editform.wpSummary; | ||
var summary = "Cleaned up using ]"; | var summary = "Cleaned up using ]"; | ||
if (txt.value.indexOf(summary) == -1) { | if (txt.value.indexOf(summary) == -1) { | ||
if (txt.value.match(/?\s*$/)) { | if (txt.value.match(/?\s*$/)) { | ||
Line 28: | Line 28: | ||
txt.value += summary; | txt.value += summary; | ||
} | } | ||
document.editform.wpMinoredit.checked = |
document.editform.wpMinoredit.checked = autoEdMinor; | ||
document.editform.wpDiff.click() | document.editform.wpDiff.click() | ||
} | } | ||
if(queryString(' |
if(queryString('AutoEdFromView')) addOnloadHook(function() { AutoEdFromView(); }) //Part of next function | ||
function |
function AutoEdFromView() { //Initiates AutoEd 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; | ||
|
autoEdFunctions(); | ||
document.getElementById('wpSummary').value += 'Cleaned up using ]'; | document.getElementById('wpSummary').value += 'Cleaned up using ]'; | ||
document.editform.wpMinoredit.checked = |
document.editform.wpMinoredit.checked = autoEdMinor; | ||
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 AutoEdFromView() works properly | ||
var re = RegExp('' + p + '=(*)'); | var re = RegExp('' + p + '=(*)'); | ||
var matches; | var matches; | ||
Line 54: | Line 54: | ||
} | } | ||
addOnloadHook(function () { //Adds " |
addOnloadHook(function () { //Adds "auto 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:AutoEdFromEdit()', 'easy ed', 'ca-AutoEd', 'Run AutoEd', '', 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 + '&AutoEdFromView=true', 'easy ed','ca-AutoEd', 'Run AutoEd', '', document.getElementById('ca-move')); | ||
} //End pageview if | } //End pageview if | ||
}//End namespace if | }//End namespace if |
Revision as of 15:06, 28 April 2009
//
//WARNING! This script is underconstruction and pretty much useless at this time! //DO NOT USE IT. You may want to look at ] and ] for related functions. //Thanks. //<pre> if( typeof( autoEdMinor ) == 'undefined' ) { //CONFIGURATION autoEdMinor = true; } function autoEdFunctions() { //MAIN FUNCTION describes list of fixes. Here to allow for testing during development; this won't be included on this particular page in the final version var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp('ISBN-10:|ISBN-13:|ISBN-10|ISBN-13|ISBN:', 'gi'), 'ISBN'); } function AutoEdFromEdit() { //Initiates AutoEd if you are already in edit mode autoEdFunctions(); // Add a tag to the summary box var txt = document.editform.wpSummary; var summary = "Cleaned up using ]"; if (txt.value.indexOf(summary) == -1) { if (txt.value.match(/?\s*$/)) { txt.value += " | "; } txt.value += summary; } document.editform.wpMinoredit.checked = autoEdMinor; document.editform.wpDiff.click() } if(queryString('AutoEdFromView')) addOnloadHook(function() { AutoEdFromView(); }) //Part of next function function AutoEdFromView() { //Initiates AutoEd if you are viewing the article without currently editing it var txt = document.getElementById('wpTextbox1'); if(!txt) return; autoEdFunctions(); document.getElementById('wpSummary').value += 'Cleaned up using ]'; document.editform.wpMinoredit.checked = autoEdMinor; document.editform.wpDiff.click() } function queryString(p) { //Allows URI to be properly decoded so that AutoEdFromView() 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 "auto 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:AutoEdFromEdit()', 'easy ed', 'ca-AutoEd', 'Run AutoEd', '', document.getElementById('ca-move')); } //End editform if if(wgAction == "view"){ var url = wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&action=edit'; addPortletLink('p-cactions',url + '&AutoEdFromView=true', 'easy ed','ca-AutoEd', 'Run AutoEd', '', document.getElementById('ca-move')); } //End pageview if }//End namespace if }); //</pre> //