summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthiasgrimm <matthiasgrimm@users.sourceforge.net>2005-06-13 20:27:25 +0200
committermatthiasgrimm <matthiasgrimm@users.sourceforge.net>2005-06-13 20:27:25 +0200
commit58bef9895361367926408711774311e4310e007a (patch)
tree02132ce6f012a8bd1dff79b6fbbe8f3a196d0a88
parent409f26c8f6fa4e96f27030b5d38ffaf6acc83419 (diff)
downloadrpg-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
-rw-r--r--inc/html.php4
-rw-r--r--lib/images/toolbar/spellcheck.pngbin0 -> 996 bytes
-rw-r--r--lib/images/toolbar/spellnoerr.pngbin0 -> 1003 bytes
-rw-r--r--lib/images/toolbar/spellstop.pngbin0 -> 899 bytes
-rw-r--r--lib/images/toolbar/spellwait.gifbin0 -> 5005 bytes
-rw-r--r--lib/scripts/spellcheck.js35
6 files changed, 28 insertions, 11 deletions
diff --git a/inc/html.php b/inc/html.php
index 9ec6049ef..8c9af9c19 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -877,12 +877,10 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed?
}
?>
</script>
+ <span id="spell_action"></span>
<?}?>
</td>
<td>
-<!-- <span class="action" id="action"><a class="check_spelling" onClick="setObjToCheck('wikitext'); spellCheck();">Check Spelling</a></span>
- <span class="status" id="status"></span> -->
- <div id="spell_action"></div>
<div id="spell_suggest"></div>
</td>
</tr>
diff --git a/lib/images/toolbar/spellcheck.png b/lib/images/toolbar/spellcheck.png
new file mode 100644
index 000000000..b620dbeb1
--- /dev/null
+++ b/lib/images/toolbar/spellcheck.png
Binary files differ
diff --git a/lib/images/toolbar/spellnoerr.png b/lib/images/toolbar/spellnoerr.png
new file mode 100644
index 000000000..5ef60e66e
--- /dev/null
+++ b/lib/images/toolbar/spellnoerr.png
Binary files differ
diff --git a/lib/images/toolbar/spellstop.png b/lib/images/toolbar/spellstop.png
new file mode 100644
index 000000000..21fd4edab
--- /dev/null
+++ b/lib/images/toolbar/spellstop.png
Binary files differ
diff --git a/lib/images/toolbar/spellwait.gif b/lib/images/toolbar/spellwait.gif
new file mode 100644
index 000000000..574ed111c
--- /dev/null
+++ b/lib/images/toolbar/spellwait.gif
Binary files differ
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;
}
}