From 9af6e647b56056230f069dbb99935ae7402210fd Mon Sep 17 00:00:00 2001 From: andi Date: Fri, 10 Jun 2005 01:36:43 +0200 Subject: Added option to manually change a misspelled word darcs-hash:20050609233643-9977f-11492f9b23b5e553ad6322bcd046ff32d64c37c1.gz --- lib/scripts/spellcheck.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'lib/scripts/spellcheck.js') diff --git a/lib/scripts/spellcheck.js b/lib/scripts/spellcheck.js index 06ba49c0d..b5fa35e60 100644 --- a/lib/scripts/spellcheck.js +++ b/lib/scripts/spellcheck.js @@ -114,6 +114,7 @@ function ajax_spell_class(){ this.txtRun = 'Checking...'; this.txtNoErr = 'No Mistakes'; this.txtNoSug = 'No Suggestions'; + this.txtChange= 'Change'; /** @@ -123,7 +124,7 @@ function ajax_spell_class(){ * * @author Andreas Gohr */ - this.init = function(txtStart,txtStop,txtRun,txtNoErr,txtNoSug){ + this.init = function(txtStart,txtStop,txtRun,txtNoErr,txtNoSug,txtChange){ // don't run twice if (this.inited) return; this.inited = true; @@ -145,6 +146,7 @@ function ajax_spell_class(){ this.txtRun = txtRun; this.txtNoErr = txtNoErr; this.txtNoSug = txtNoSug; + this.txtChange= txtChange; // register click event document.onclick = this.docClick; @@ -214,6 +216,19 @@ function ajax_spell_class(){ this.suggestObj.style.display = "none"; } + /** + * Opens a prompt to let the user change the word her self + * + * @author Andreas Gohr + */ + this.ask = function(id){ + var word = document.getElementById('spell_error'+id).innerHTML; + word = prompt(this.txtChange,word); + if(word){ + this.correct(id,encodeURIComponent(word)); + } + } + /** * Displays the suggestions for a misspelled word * @@ -243,15 +258,19 @@ function ajax_spell_class(){ // handle suggestions var text = ''; if(args.length == 1){ - text += this.txtNoSug; + text += this.txtNoSug+'
'; }else{ for(var i=1; i'; text += args[i]; - text += '
'; + text += '
'; } } + // add option for manual edit + text += ''; + text += '['+this.txtChange+']'; + text += '
'; this.suggestObj.innerHTML = text; this.suggestObj.style.display = "block"; -- cgit v1.2.3