[pmwiki-users] Small headache with a spell check attempt.

Seth Cherney sethcherney at yahoo.com
Sat Dec 16 09:31:32 CST 2006


Java is the backend, JS is the front end (ie actually embedded on the page)..

There is an element id on the text area in question in pmwiki (thus I still have hope), but the jspspellcheck js is written for the concatenated names (ie element.formname.textareaname.  
unfortunately there is no form name, but only text are name in pmwiki.

thanks, and thanks  to anyone else who can take a look.

Seth
Crisses <crisses at kinhost.org> wrote: 
On Dec 15, 2006, at 6:58 PM, Seth Cherney wrote:

> I have been trying to integrate a java spell check into pmwiki, as  
> I cannot access pspell/aspell on my hosted server.

Geek note: Java is not JavaScript.  :)  Java is by Sun Corporation,  
and is a very very hefty undertaking.  JavaScript is by Netscape Corp  
I believe, and is meant for browser scripting.  The two came out  
around the same time, and the names are very very confusing.

This is JavaScript.  I started reading and went "Java!  I can't help  
with Java!!" :)  Good thing I kept reading.

> My thought was only to mod PM's spellcheck.php to call the other js  
> (it works on js in the browser as well.  The spell checker I am  
> trying to integrate is VERY easy to integrate (but I am no coder).   
> It is sourceforge.net/projects/jspspellcheck, based on jazzy - and  
> using word lists fo dicts (ie can make any language!).
>
> I was dropping the whole thing into the pub directory, then trying  
> to rewrite the spellcheck.php in the cookbook to point to it.   
> There are a few syntax problems converting the js to php compatible  
> js, and it tries to find the form name, but ther is no form name in  
> pmwiki edit, just for the text area.

Ok -- actually this is probably a make-or-break issue.  When using  
JavaScript to "script the DOM" (document object model or something)  
it really needs to have a "name" on the "object" (in this case the  
browser's text area) to point to.

The getElementById needs a CSS Id on the item you're accessing...   
such as   id tags are meant to be unique  <br>identifiers on the page -- used only once.  JavaScript takes  <br>advantage of that fact, and uses it to target an item on the page.<br><br>> bellow is the file I have been trying to work on.  the two lines  <br>> with !!! are the ones I believe causing probs.  someone with a  <br>> little time could perhaps download jspspellcheck and give me  some  <br>> help??  I think it is very easy for someone with background (I am a  <br>> theologian).<br><br>Sorry I don't have time to do that :/<br><br>>     This will add a "spell check" button to the GUI button bar, and<br>>     link in the necessary spell checking scripts.<br>> #<script src='$PubDirUrl/speller/spellChecker.js'></script><br>> #<script type='text/javascript' ><br>> #function openSpellChecker() {<br>> #    var textarea1 = document.getElementById('text');<br>> #    var speller = new spellChecker( textarea1 );<br>> #    speller.popUpUrl =
 '$PubDirUrl/speller/spellchecker.html';<br>> ##    speller.openChecker();<br>> #}<br>> #</script><br>> */<br>><br>> # If we're not editing, then just exit.<br>> if ($action != 'edit') return;<br>> # Configure in the Speller Pages javascript code.<br>> $HTMLHeaderFmt[] = "<br>> <script src='$PubDirUrl/jspspellcheck/jspspellcheck/spellcheck- <br>> caller.js'></script><br>> <script type='text/javascript' ><br>> function spellCheck(){<br>>     var elements = new Array(0);<br>>     !!!    elements = document.getElementById('text');<br><br>Unless the id on the box is specifically "text" this will fail.<br><br>You can try getElementsByTagName and "textarea"?<br><br>elements = document.getElementsByTagName("textarea")<br>if(elements.length) {<br>     !!!    startSpellCheck('$PubDirUrl/jspspellcheck/', elements );<br>}<br>}<br></script><br><br>This is me guessing.  I am a programmer, but I'm NOT a JavaScript  <br>programmer.<br><br>it's either this, or find a way to add the
 id="text" to the HTML for  <br>the textarea.<br><br>Crisses<br></blockquote><br>
 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20061216/eeef2ce0/attachment.html 


More information about the pmwiki-users mailing list