summaryrefslogtreecommitdiff
path: root/lib/scripts/spellcheck.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts/spellcheck.js')
-rw-r--r--lib/scripts/spellcheck.js35
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;
}
}