User:Connel MacKenzie/spellcheck.js

/* To turn on this spellcheck button, edit your Special:Mypage/monobook.js and add the following line (make sure it doesn't line break):

document.write('<\/script>');

When you save it, make sure you CTRL-SH-R or WIN-CTRL-SH-R or Mac-Sh-R or whatever. Or restart your browser. If your browser has a javascript console, open it up and look for errors if you aren't getting the "check" icon on the toolbar on edit pages.

If you don't use the monobook skin, then you shouldn't edit on Wikimedia. Too many things are simply missing, otherwise.

function checkIt { //yes, I know this part is monobook-specific. Read warnings above. if (document.editform) { var txtarea = document.editform.wpTextbox1; } else { // some alternate form? take the first one we can find var areas = document.getElementsByTagName('textarea'); var txtarea = areas[0]; }       PromptWin = window.open("about:blank", "CheckSpelling", "width=680,location=yes,menubar=yes,toolbar=yes,resizable,scrollbars"); PromptWin.document.open; PromptWin.document.write(" Spelling "); PromptWin.document.write(''); PromptWin.document.write(' Preparing to check for incorrecly spelled words... \n'); PromptWin.document.write(''); PromptWin.document.write(''); var textAreaLength = txtarea.value.length; var textAreaStart = 0; if (textAreaLength > 4096) textAreaStart = textAreaLength - 4096; PromptWin.document.write(txtarea.value.substring(textAreaStart, textAreaLength)); PromptWin.document.write(' '); PromptWin.document.write(''); PromptWin.document.write('  '); PromptWin.document.close; //PromptWin.document.spellcheckform.submit.click; }

function addSpellCheckButton { diffButton = document.getElementById('wpDiff'); if (diffButton) { var spellButton = document.createElement('input'); spellButton.type='submit'; spellButton.tabindex=7.5 ; spellButton.value="Check spelling"; spellButton.accesskey="g"; //get spell check? spellButton.title="Check the spelling (EXPERIMENTAL) of this entry using 'spell' command on toolserver"; spellButton.onclick = function { checkIt; return false; }      diffButton.parentNode.insertBefore( spellButton, diffButton.nextSibling); } tooly = document.getElementById('toolbar'); if ( (!tooly) ) return; return; var buttonSP = document.createElement("img"); buttonSP.width = 23; buttonSP.height = 22; buttonSP.src = 'http://upload.wikimedia.org/wikipedia/commons/9/9d/Button_fait.png'; buttonSP.border = 0; buttonSP.alt = 'Spellcheck'; buttonSP.title = 'Spellcheck'; buttonSP.style.cursor = "pointer"; buttonSP.onclick = function { checkIt; return false; } tooly.appendChild(buttonSP); }

addOnloadHook( addSpellCheckButton );