User:Arjayay/monobook.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | The accompanying .css page for this skin can be added at User:Arjayay/monobook.css. |
// To install, include this script in your monobook.js and clear your cache
// You should see a 'spell' tab next to the watch/unwatch tab.
//
// The script interface created by copying/modifying [[WP:AutoEd]]
//
// USE WITH CAUTION and CHECK THE EDIT CHANGES
// REPORT BUGS TO [[User talk:Symplectic Map]]
//
if( typeof( SM_minor ) == 'undefined' ) {
var SM_minor = true;
}
if( typeof( SM_click ) == 'undefined' ) {
var SM_click = true;
}
if( typeof( SM_tag ) == 'undefined' ) {
var SM_tag = "[[WP:LCM|Common misspellings]] corrected by [[User:Symplectic_Map/spell.js|script]]";
}
if( typeof( SM_hover ) == 'undefined' ) {
var SM_hover = "Spellcheck";
}
if( typeof( SM_name ) == 'undefined' ) {
var SM_name = "spell";
}
if( typeof( SM_loc ) == 'undefined' ) {
var SM_loc = "p-cactions";
}
importScript('User:Symplectic_Map/misspellings.js');
importScript('User:Symplectic_Map/capitalizations.js');
importScript('User:Symplectic_Map/script.js');
function SM_edit() {
var txt = document.editform.wpTextbox1;
txt.value = common_misspellings(txt.value);
txt.value = common_capitalizations(txt.value);
}
function SM_exec() {
if(!document.getElementById('wpTextbox1')) return;
SM_edit();
SM_summary();
}
//Tags summary textbox
function SM_summary() {
var txt = document.editform.wpSummary;
var tag = SM_tag;
// Is the tag blank?
if( tag.match(/[^\s]/) ) {
// Has it already been tagged?
if( txt.value.indexOf(tag) == -1 ) {
// Append a pipe if necessary
if( txt.value.match(/[^\*\/\s][^\/\s]?\s*$/) ) {
txt.value += " | ";
}
// Append our tag
txt.value += tag;
}
}
// Check 'This is a minor edit'
if( SM_minor ) {
document.editform.wpMinoredit.checked = SM_minor;
}
// Click 'Show changes'
if( SM_click ) {
document.editform.wpDiff.click();
}
}
//Allows URI to be properly decoded when run from View Mode
function SM_QueryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) {
}
}
return null;
}
//Execute after call from View Mode
if( SM_QueryString('SM_spell') ) {
addOnloadHook(function() {
SM_exec();
});
}
// Add tabs and associate with actions
addOnloadHook(function () {
if(wgCanonicalNamespace == "" || wgCanonicalNamespace == "Image"
|| wgCanonicalNamespace == "File" || wgCanonicalNamespace == "Template"
|| wgCanonicalNamespace == "Project" || wgCanonicalNamespace == "Portal") {
if(document.forms.editform) {
addPortletLink( SM_loc, 'javascript:SM_exec()', SM_name, 'ca-SM', SM_hover, '', document.getElementById('ca-move'));
} //End editform if
if(wgAction == "view"){
var url = wgServer + wgScript + '?title=' + encodeURIComponent(wgPageName) + '&action=edit';
addPortletLink( SM_loc, url + '&SM_spell=true', SM_name, 'ca-SM', SM_hover, '', document.getElementById('ca-move'));
} //End pageview if
} //End namespace if
});