//This script does not function without additional "helper" modules!
//Please see [[Wikipedia:AutoEd]] for details on use.
//Initiates AutoEd
function autoEdExecute7() {
if(!document.getElementById('wpTextbox1')) return;
// copy wikEd ([[User:Cacycle/wikEd.js]]) frame to wpTextbox1 textarea
// for compatibility with WikiEd
if (typeof wikEdUseWikEd !== 'undefined') {
if (wikEdUseWikEd === true) {
WikEdUpdateTextarea();
}
}
//alert/return if autoEdFunctions is not defined
if( typeof autoEdFunctions7 === 'undefined' ) {
alert('AutoEd/core.js: autoEdFunctions is undefined');
return;
}
autoEdFunctions7();
autoEdEditSummary7();
// copy wpTextbox1 textarea back to wikEd frame
// for compatibility with WikiEd
if (typeof wikEdUseWikEd !== 'undefined') {
if (wikEdUseWikEd === true) {
WikEdUpdateFrame();
}
}
}
//Adds Tag to edit summary textbox
function autoEdEditSummary7() {
var txt7 = document.forms.editform.wpSummary;
var tag7;
if( typeof autoEdTag7 === 'undefined' ) {
tag7 = 'Cleaned up using [[WP:AutoEd|AutoEd]]';
} else {
tag7 = autoEdTag7;
}
// Is the tag blank?
if( tag7.match(/[^\s]/) ) {
// Has it already been tagged?
if( txt7.value.indexOf(tag7) == -1 ) {
// Append a pipe if necessary
if( txt7.value.match(/[^\*\/\s][^\/\s]?\s*$/) ) {
txt7.value += ' | ';
}
// Append our tag
txt7.value += tag7;
}
}
// Check 'This is a minor edit'
if( typeof autoEdMinor7 === 'undefined' || autoEdMinor7 ) {
document.forms.editform.wpMinoredit.checked = true;
}
// Uncheck 'Watch this page'
if( typeof autoEdWatch7 === 'undefined' || autoEdWatch7 ) {
document.forms.editform.wpWatchthis.checked = false;
}
// Click 'Show changes'
if( typeof autoEdClick7 === 'undefined' || autoEdClick7 ) {
document.forms.editform.wpDiff.click();
}
}
// Add "auto ed" tab and associate with actions
// Make sure the document is ready and our dependencies are loaded
$.when(
$.ready,
mw.loader.using(['mediawiki.util'])
).done(function () {
var $link7;
//Execute AutoEd after call from "view mode"
if( mw.util.getParamValue('AutoEd7') ) {
autoEdExecute7();
}
// Set default values for any unset variables
if( typeof autoEdLinkHover7 === 'undefined' ) {
autoEdLinkHover7 = "Run AutoEd";
}
if( typeof autoEdLinkName7 === 'undefined' ) {
autoEdLinkName7 = "auto ed";
}
if( typeof autoEdLinkLocation7 === 'undefined' ) {
autoEdLinkLocation7 = "p-cactions";
}
// Add the "auto ed" tab
if( document.getElementById('ca-edit') ) {
var url = mw.util.getUrl(mw.config.get('wgPageName'), { action: 'edit', AutoEd7: 'true' });
$link7 = $(mw.util.addPortletLink(
autoEdLinkLocation7,
url,
autoEdLinkName7,
'ca-AutoEd',
autoEdLinkHover7,
'',
document.getElementById('ca-move')
));
if( typeof document.forms.editform !== 'undefined' ) {
$link7.on('click', function (e) {
e.preventDefault();
autoEdExecute7();
});
}
}
});