diff options
author | matthiasgrimm <matthiasgrimm@users.sourceforge.net> | 2005-06-13 20:27:25 +0200 |
---|---|---|
committer | matthiasgrimm <matthiasgrimm@users.sourceforge.net> | 2005-06-13 20:27:25 +0200 |
commit | 58bef9895361367926408711774311e4310e007a (patch) | |
tree | 02132ce6f012a8bd1dff79b6fbbe8f3a196d0a88 /lib/scripts/spellcheck.js | |
parent | 409f26c8f6fa4e96f27030b5d38ffaf6acc83419 (diff) | |
download | rpg-58bef9895361367926408711774311e4310e007a.tar.gz rpg-58bef9895361367926408711774311e4310e007a.tar.bz2 |
spellchecker button control
This patch replaces the big textual spellchecker controls with
a nice one using toolbar like buttons
darcs-hash:20050613182725-7ef76-34661fe2322682059335dced7ad60dfb31350c30.gz
Diffstat (limited to 'lib/scripts/spellcheck.js')
-rw-r--r-- | lib/scripts/spellcheck.js | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/lib/scripts/spellcheck.js b/lib/scripts/spellcheck.js index 03ca9c364..3df9a25ff 100644 --- a/lib/scripts/spellcheck.js +++ b/lib/scripts/spellcheck.js @@ -90,6 +90,29 @@ function qquote(str){ } /** + * This function generates a spellchecker button with localized tooltips + */ +function spellButton(imageFile, speedTip, funcCall, accessKey) { + speedTip=escapeQuotes(speedTip); + funcCall=escapeQuotes(funcCall); + + button = "<a "; + if(accessKey){ + button = button+"accesskey=\""+accessKey+"\" "; + speedTip = speedTip+' [ALT+'+accessKey.toUpperCase()+']'; + } + if(funcCall){ + button = button+"href=\"javascript:"+funcCall+";\""; + } + button = button+">"; + button = button+"<img width=\"24\" height=\"24\" src=\""+ + DOKU_BASE+'lib/images/toolbar/'+imageFile+"\" border=\"0\" alt=\""+ + speedTip+"\" title=\""+speedTip+"\">"; + button = button+"</a>"; + return button; +} + +/** * AJAX Spellchecker Class * * Note to some function use a hardcoded instance named ajax_spell to make @@ -186,20 +209,16 @@ function ajax_spell_class(){ this.setState = function(state){ switch (state){ case 'stop': - ajax_spell.actionObj.innerHTML = - '<a class="spell_resume" href="javascript:ajax_spell.resume()">'+ajax_spell.txtStop+'</a>'; + ajax_spell.actionObj.innerHTML = spellButton("spellstop.png",ajax_spell.txtStop,"ajax_spell.resume()",""); break; case 'noerr': - ajax_spell.actionObj.innerHTML = - '<span class="spell_noerr">'+ajax_spell.txtNoErr+'</span>'; + ajax_spell.actionObj.innerHTML = spellButton("spellnoerr.png",ajax_spell.txtNoErr,"ajax_spell.setState(\"start\")",""); break; case 'run': - ajax_spell.actionObj.innerHTML = - '<span class="spell_wait">'+ajax_spell.txtRun+'</span>'; + ajax_spell.actionObj.innerHTML = spellButton("spellwait.gif",ajax_spell.txtRun,"",""); break; default: - ajax_spell.actionObj.innerHTML = - '<a class="spell_start" href="javascript:ajax_spell.run()">'+ajax_spell.txtStart+'</a>'; + ajax_spell.actionObj.innerHTML = spellButton("spellcheck.png",ajax_spell.txtStart,"ajax_spell.run()","c"); break; } } |