Skip to content
Snippets Groups Projects
Commit 9af6e647 authored by andi's avatar andi
Browse files

Added option to manually change a misspelled word

darcs-hash:20050609233643-9977f-11492f9b23b5e553ad6322bcd046ff32d64c37c1.gz
parent d8681a9e
No related branches found
No related tags found
No related merge requests found
......@@ -914,7 +914,7 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed?
//initialize spellchecker
<?if($conf['spellchecker']){?>
ajax_spell.init('<?=$lang['spell_start']?>','<?=$lang['spell_stop']?>','<?=$lang['spell_wait']?>','<?=$lang['spell_noerr']?>','<?=$lang['spell_nosug']?>');
ajax_spell.init('<?=$lang['spell_start']?>','<?=$lang['spell_stop']?>','<?=$lang['spell_wait']?>','<?=$lang['spell_noerr']?>','<?=$lang['spell_nosug']?>','<?=$lang['spell_change']?>');
<?}?>
document.editform.wikitext.focus();
......
......@@ -130,10 +130,11 @@ $lang['acl_perm8'] = 'Hochladen';
$lang['acl_perm16'] = 'Entfernen';
$lang['acl_new'] = 'Eintrag hinzufügen';
$lang['spell_start']= 'Rechtschreibung prüfen';
$lang['spell_stop'] = 'Bearbeiten fortsetzen';
$lang['spell_wait'] = 'Bitte warten...';
$lang['spell_noerr']= 'Keine Fehler gefunden';
$lang['spell_nosug']= 'Keine Vorschläge';
$lang['spell_start'] = 'Rechtschreibung prüfen';
$lang['spell_stop'] = 'Bearbeiten fortsetzen';
$lang['spell_wait'] = 'Bitte warten...';
$lang['spell_noerr'] = 'Keine Fehler gefunden';
$lang['spell_nosug'] = 'Keine Vorschläge';
$lang['spell_change']= 'Ändern';
//Setup VIM: ex: et ts=2 enc=utf-8 :
......@@ -129,10 +129,11 @@ $lang['acl_perm8'] = 'Upload';
$lang['acl_perm16'] = 'Delete';
$lang['acl_new'] = 'Add new Entry';
$lang['spell_start']= 'Check Spelling';
$lang['spell_stop'] = 'Resume Editing';
$lang['spell_wait'] = 'Please wait...';
$lang['spell_noerr']= 'No Mistakes found';
$lang['spell_nosug']= 'No Suggestions';
$lang['spell_start'] = 'Check Spelling';
$lang['spell_stop'] = 'Resume Editing';
$lang['spell_wait'] = 'Please wait...';
$lang['spell_noerr'] = 'No Mistakes found';
$lang['spell_nosug'] = 'No Suggestions';
$lang['spell_change']= 'Change';
//Setup VIM: ex: et ts=2 enc=utf-8 :
......@@ -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 <andi@splitbrain.org>
*/
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 <andi@splitbrain.org>
*/
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+'<br />';
}else{
for(var i=1; i<args.length; i++){
text += '<a href="javascript:ajax_spell.correct('+id+',\''+
qquote(encodeURIComponent(args[i]))+'\')">';
text += args[i];
text += '</a><br>';
text += '</a><br />';
}
}
// add option for manual edit
text += '<a href="javascript:ajax_spell.ask('+id+')">';
text += '['+this.txtChange+']';
text += '</a><br />';
this.suggestObj.innerHTML = text;
this.suggestObj.style.display = "block";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment