This is an old revision of this page, as edited by AFigureOfBlue (talk | contribs) at 21:32, 1 May 2009 (Should fix an error). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Revision as of 21:32, 1 May 2009 by AFigureOfBlue (talk | contribs) (Should fix an error)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)//
//This script does not function without additional "helper" modules! //Please see ] for details on use. // Set default values for any unset variables if( typeof( autoEdMinor ) == 'undefined' ) { autoEdMinor = true; } if( typeof( autoEdClick ) == 'undefined' ) { autoEdClick = true; } if( typeof( autoEdTag ) == 'undefined' ) { autoEdTag = "Cleaned up using ]"; } if( typeof( autoEdLinkHover ) == 'undefined' ) { autoEdLinkHover = "Run AutoEd"; } if( typeof( autoEdLinkName ) == 'undefined' ) { autoEdLinkName = "auto ed"; } if( typeof( autoEdLinkLocation ) == 'undefined' ) { autoEdLinkLocation = "p-cactions"; } if( typeof( autoEdFunctions ) == 'undefined' ) { function autoEdFunctions() { alert('AutoEd/core.js: autoEdFunctions is undefined'); } autoEdTag = ""; autoEdClick = false; autoEdMinor = false; } //Initiates AutoEd function autoEdExecute() { if(!document.getElementById('wpTextbox1')) return; autoEdFunctions(); autoEdEditSummary(); } //Adds Tag to edit summary textbox function autoEdEditSummary() { var txt = document.editform.wpSummary; var tag = autoEdTag; // Is the tag blank? if( tag.match(//) ) { // Has it already been tagged? if( txt.value.indexOf(tag) == -1 ) { // Append a pipe if necessary if( txt.value.match(/?\s*$/) ) { txt.value += " | "; } // Append our tag txt.value += tag; } } // Check 'This is a minor edit' if( autoEdMinor ) { document.editform.wpMinoredit.checked = autoEdMinor; } // Click 'Show changes' if( autoEdClick ) { document.editform.wpDiff.click(); } } //Allows URI to be properly decoded for AutoEd in View Mode function autoEdQueryString(p) { var re = RegExp('' + p + '=(*)'); var matches; if (matches = re.exec(document.location)) { try { return decodeURI(matches); } catch (e) { } } return null; } //Execute AutoEd after call from View Mode if( autoEdQueryString('AutoEd') ) { addOnloadHook(function() { autoEdExecute(); }); } // Add "auto ed" tabs and associate with actions addOnloadHook(function () { if(wgCanonicalNamespace == "" || wgCanonicalNamespace == "Image" || wgCanonicalNamespace == "File" || wgCanonicalNamespace == "User" || wgCanonicalNamespace == "Template" || wgCanonicalNamespace == "Project" || wgCanonicalNamespace == "Portal") { if(document.forms.editform) { addPortletLink( autoEdLinkLocation, 'javascript:autoEdExecute()', autoEdLinkName, 'ca-AutoEd', autoEdLinkHover, '', document.getElementById('ca-move')); } //End editform if if(wgAction == "view"){ var url = wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&action=edit'; addPortletLink( autoEdLinkLocation, url + '&AutoEd=true', autoEdLinkName, 'ca-AutoEd', autoEdLinkHover, '', document.getElementById('ca-move')); } //End pageview if } //End namespace if }); //