vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   vB Spell :: Spell Checker in WYSIWYG and Standard Modes (https://vborg.vbsupport.ru/showthread.php?t=92202)

Mr Chad 10-13-2005 02:43 AM

This is amaizing! Only problem was adding the dictionary to the database. I host with 1and1 and their DB konks out if i send to much at a time. so i had to add it until it gave me the error then find out how far it added and take all the stuff it added from the Dict.TXT and re add it. Worked perfectly.

dsmcd01 10-13-2005 01:50 PM

Quote:

Originally Posted by tamarian
Try this: open vbspell.php, find:

PHP Code:

preg_match_all "/" $ignore_sets "\[[^\]]+\]|[[:alpha:]']+|<[^>]+>|&[^;\ ]+;/im"$mystr$alphasPREG_OFFSET_CAPTURE|PREG_PATTERN_ORDER); 

Replace with:
PHP Code:

preg_match_all "/" $ignore_sets "\[[^\]]+\]|[[:alpha:]]+|<[^>]+>|&[^;\ ]+;/im"$mystr$alphasPREG_OFFSET_CAPTURE|PREG_PATTERN_ORDER); 


No, sorry. No difference. Spell checking:
word 'word' "word"
still finds 'word' misspelled.

Thx,
D.

AaronBBrown 10-14-2005 12:54 PM

I've followed the instructions, put A and B in SHOWTHREAD and followed the special instructions and put
Code:

<input type="button" class="button" value="Spell Check" onClick="spellCheck('qeform', '$editorid', '2');" />
in postbit_quickedit, but my quickedit spellcheck button does nothing. Suggestions?

tamarian 10-14-2005 01:26 PM

Quote:

Originally Posted by AaronBBrown
I've followed the instructions, put A and B in SHOWTHREAD and followed the special instructions and put
Code:

<input type="button" class="button" value="Spell Check" onClick="spellCheck('qeform', '$editorid', '2');" />
in postbit_quickedit, but my quickedit spellcheck button does nothing. Suggestions?

There is a problem with Quick edit that has yet to be resolved. For now, just click advanced to use the spell checker.

AaronBBrown 11-01-2005 05:18 PM

This mod strips out all backslashes from a post.

If I type "C:\Mypath\Foo"

vBSpell immediately strips it to "C:MypathFoo" when it comes up.

Lea Verou 11-01-2005 05:29 PM

Quote:

Originally Posted by AaronBBrown
This mod strips out all backslashes from a post.

If I type "C:\Mypath\Foo"

vBSpell immediately strips it to "C:MypathFoo" when it comes up.

Yep that's a common thing in php to ensure that even if magic quotes is enabled the text will look correct... If that didn't exist in the code you'd probably see additional backslashes in the text (although you wouldn't loose the ones you posted).
I don't know if that can be fixed, but if it can I'd really like to see the solution!

6impy 11-03-2005 08:23 AM

I upgraded to vB3.5.1 and now when I try to use the spell checker, the popup window is completely blank.

sim tech 11-04-2005 04:03 PM

Quote:

Originally Posted by 6impy
I upgraded to vB3.5.1 and now when I try to use the spell checker, the popup window is completely blank.

Here too...


I ended up running the install script and selecting uninstall.

Then I re-installed it & it's now working. The install/uninstall script made it very painless!

tamarian 11-04-2005 06:38 PM

Re: 3.5.1: The reason it stops working is that the vbspell template gets deleted after the upgrade, probably due to product id, as it was made before products. I'll check on that.

In the mean time, to get it back, all you need to do is re-create the vbspell template, either by running the install script (only the template step), or create a new vbspell template by pasting this:

HTML Code:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>vB Spell $vboptions[bbtitle]</title>
$style[css]
<script>
var iFrameBody;
var spell_formname="$FormName";
var spell_fieldname="$FieldName";
</script>
<script src="vbspell.js"></script>
<script>
$js;
</script>
</head>

<body>

<form name="fm1" onSubmit="return false;">

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
        <tr>
                <td class="tcat" colspan="2">
                        <strong>vB Spell</strong>
                </td>
        </tr>

        <tr>
                <td class="alt1" colspan="2">
                        <iframe name="spellbox" id="spellbox" width="100%" height="270" scrolling="auto" src="vbspell_iframe.php"></iframe>
                </td>
        </tr>

        <tr class="alt1">
                <td valign="top" width="310">
                        <fieldset class="fieldset" style="margin:0px">
                                <legend>Change to:</legend>
                                <div style="padding:$stylevar[formspacer]px">
                                        <div>
                                                <input type="text" name="changeto" class="biginput">
                                        </div>
                                </div>
                        </fieldset>       
                </td>

                <td width="310">
                        <fieldset class="fieldset" style="margin:0px">
                                <legend>Suggestions:</legend>
                                <div style="padding:$stylevar[formspacer]px">
                                        <div>
                                                <select style="width:100%" name="suggestions" size="4" onClick="this.form.changeto.value = this.options[ this.selectedIndex ].text">
                                                </select>
                                        </div>
                                </div>
                        </fieldset>
                </td>
        </tr>

        <tr>
                <td colspan="2" class="alt2" noWrap="noWrap">
                        <input type="button" class="button" name="change" value="Change" onClick="replaceWord()">
                        <input type="button" class="button" name="changeall" value="Change All" onClick="replaceAll()">
                        <input type="button" class="button" name="ignore" value="Ignore" onClick="nextWord(false)">
                        <input type="button" class="button" name="ignoreall" value="Ignore All" onClick="nextWord(true)">
                        <input type="button" class="button" name="learn" value="Learn" onClick="learnWord()">
                        <input type="button" class="button" name="thesarus" value="Thesaurus" onClick="thesarusWord()">
                        <input type="button" class="button" name="lookup" value="Lookup" onClick="lookupWord()">       
                        <input type="button" class="button" name="quit" value="Quit" onClick="exitWord()">       
                        <input type="button" class="button" name="done" value="Done" onClick="doneWord()">
                </td>
        </tr> 
</table>
</form>
</body>
</html>


thewitt 11-06-2005 12:48 AM

Have you looked at the integration comments for template editing from message #48? These are very slick and so far seem to work great.

It replaces the IE only enabled ABC-checkmark with this editor. It seems to work really well and only required three template edits.

Comments?

-t

tamarian 11-06-2005 01:30 AM

Quote:

Originally Posted by thewitt
Have you looked at the integration comments for template editing from message #48? These are very slick and so far seem to work great.

It replaces the IE only enabled ABC-checkmark with this editor. It seems to work really well and only required three template edits.

Comments?

-t

I like it. I've made a link to it in the instructions as an alternative method. Some minor drawbacks are: 1) vbspell.js will be loaded on everypage, and 2) it removed the ieSpell button, which some users may still prefer.

puertoblack2003 11-06-2005 04:52 PM

love this hack this reminds me of outlook good program..ok ..maybe you can help me i read through the thread looking for the error messages i get through ie and in firefox don't get any thing to work..everything is installed but when running a test on it i get an error message in ie and in firefox nothing happen can you help me to see where i messed up at.

thanks in advance :ermm:

tamarian 11-06-2005 07:16 PM

Quote:

Originally Posted by nievesidenshop
i get an error message in ie and in firefox nothing happen can you help me to see where i messed up at.

This might be due to errors in your template edits.

puertoblack2003 11-07-2005 01:58 AM

Quote:

Originally Posted by tamarian
This might be due to errors in your template edits.

yep found the problem in template had to double check and forgot to add a script....click installed :o

wArDoG 11-07-2005 11:01 AM

Quote:

Originally Posted by cclaerhout
Your hack is really great and it works with french language. Thanks you very much.

I've just modified the installation process. I find it easier.

Code installation
Put
Code:

<script src="vbspell.js"></script>
at the end of your headinclude template.

Put
Code:

<form name="spell_form" id="spell_form" method="POST" target="spellWindow" action="vbspell.php">
        <input type="hidden" name="spell_formname" value="">
        <input type="hidden" name="spell_fieldname" value="">
        <input type="hidden" name="spellstring" value="">
</form>

at the end of your header template.



Link to the dictionnary

editor_toolbar_on:

Find
Code:

                        <if condition="is_browser('ie') AND !is_browser('mac')">
                                <td><div class="imagebutton" id="{$editorid}_cmd_spelling"><img src="$stylevar[imgdir_editor]/spelling.gif" width="21" height="20" alt="$vbphrase[check_spelling]" /></div></td>
                        </if>

Replace with
Code:

                                <td onclick="spellCheck('vbform', '$editorid', '2');"><div class="imagebutton"><img src="$stylevar[imgdir_editor]/spelling.gif" width="21" height="20" alt="$vbphrase[check_spelling]" /></div></td>



postbit_quickedit AND showthread_quickreply :

Find
Code:

        <if condition="is_browser('ie')">
                        <td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
                        <td><div class="imagebutton" id="{$editorid}_cmd_spelling"><img src="$stylevar[imgdir_editor]/spelling.gif" width="21" height="20" alt="$vbphrase[check_spelling]" /></div></td>
                </if>

Replace with


Code:

               
                <td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
                <td onclick="spellCheck('vbform', '$editorid', '2');"><div class="imagebutton"><img src="$stylevar[imgdir_editor]/spelling.gif" width="21" height="20" alt="$vbphrase[check_spelling]" /></div></td>


What does it do ?
It replaces vB spell check with this one. I'm so happy it works with french language :)

Precision : i've got vB Gold Version

Hi Thanks for the help with this.

What template(s) do I need to edit to get the spell checker ilinked to PM's?

Steve

seg 11-08-2005 09:57 PM

Thanks for the Spell Checker mod. Everything works great except for the Quick edit. I was confused by the notes, is this fixed yet, or is it still not supposed to work?
Quote:

Fix: Quick edit no longer works, must switch to advanced mode.
Also, just a suggestion for future versions. It would be nice to have a centralized dictionary where the Admin can allow certain words used by all members of the board.

seg 11-08-2005 10:01 PM

In the instructions above in the "Other templates:" section there are instructions for the template "pm_newpm"

Quote:

Originally Posted by wArDoG
Hi Thanks for the help with this.

What template(s) do I need to edit to get the spell checker ilinked to PM's?

Steve


Code Monkey 11-09-2005 05:06 AM

All of a sudden, I notice that this is not working as it did before. Now when I click spellcheck I get the popup and it's just displays the following.

Code:

options['vbspell_allow_all'] OR is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['vbspell_use_groups']))) $vbulletin->userinfo['can_use_vbspell'] = TRUE; if (!$vbulletin->userinfo['can_use_vbspell'] OR $vbulletin->userinfo['usergroupid'] == 0) print_no_permission(); $PersonalWords = array(); if (!empty($_COOKIE['vbspell_words'])) $PersonalWords = explode(',', urldecode(strtolower($_COOKIE['vbspell_words']))); require_once('./includes/searchwords.php'); // get search engine stop words, to save on queries. function MisSpelled($word) { global $db, $badwords, $PersonalWords; $word = trim($word, "'"); $partial = explode('\'', strtolower($word)); if (count($partial) > 1) $CheckPartial = TRUE; else $CheckPartial = FALSE; if (in_array($partial[0], $PersonalWords)) return FALSE; // User have "learned" this word elseif ($CheckPartial AND in_array(strtolower($word), $PersonalWords)) return FALSE; // User have "learned" this word elseif ($word === strtoupper($word)) return FALSE; // All uppercase, treat as abbriviation, might want to make this an admincp option.. elseif (in_array($partial[0], $badwords)) return FALSE; // Very common word elseif ($CheckPartial AND in_array($partial[0] . $partial[1], $badwords)) return FALSE; // Very common word elseif ($db->query_first("SELECT word FROM " . TABLE_PREFIX . "vbspell WHERE word = '" . addslashes($partial[0]) . "'")) return FALSE; // Found In dictionary else return TRUE; // probably mis-spelled } function Suggest($for) { global $db, $vbulletin; $for = trim($for, "'"); $WordList = array(); $SuggestedList = array(); $Suggestions = $db->query_read("SELECT word FROM " . TABLE_PREFIX . "vbspell WHERE sound = '" . addslashes(metaphone($for)) . "'"); while ($Suggestion = $db->fetch_array($Suggestions)) $WordList[$Suggestion['word']] = levenshtein($for, $Suggestion['word']); asort($WordList); reset($WordList); foreach ($WordList as $word => $distance) if ($distance <= $vbulletin->options['vbspell_levenshtein_distance']) $SuggestedList[] = $word; if ($for === ucfirst($for)) { foreach ($SuggestedList as $key => $word) $SuggestedList[$key] = ucfirst($word); } elseif ($for === strtoupper($for)) { // not possible yet, but might be allowed in admincp. foreach ($SuggestedList as $key => $word) $SuggestedList[$key] = strtoupper($word); } return $SuggestedList; } $mystr = str_replace('\\', '\\\\', $_REQUEST['spellstring']); $mystr = stripslashes($mystr); $FormName = $_POST['spell_formname']; $FieldName = $_POST['spell_fieldname']; // can't have newlines or carriage returns in javascript string $mystr = str_replace("\r", "", $mystr); $mystr = str_replace("\n", "_|_", $mystr); $mystr = trim($mystr); $ignore_sets = '\[QUOT.+\].*\[\/QUOTE\]|'; $ignore_sets .= '\[CODE\].*\[\/CODE\]|'; $ignore_sets .= '\[PHP\].*\[\/PHP\]|'; $ignore_sets .= '\[img\].*\[\/img\]|'; $ignore_sets .= '\[url.*\].*\[\/url\]|'; $ignore_sets .= '.*<\/a>|'; preg_match_all ( "/" . $ignore_sets . "\[[^\]]+\]|[[:alpha:]']+|<[^>]+>|&[^;\ ]+;/im", $mystr, $alphas, PREG_OFFSET_CAPTURE|PREG_PATTERN_ORDER); $mystr = str_replace('\\', '\\\\', $mystr); // this has to be done _after_ the matching. it messes up the // indexing otherwise. I have not figured out exactly why this // happens but I know this fixes it. $mystr = str_replace("\"", "\\\"", $mystr); $js .= 'var mispstr = "'.$mystr.'";'."\n"; $js .= 'var misps = Array('; $curindex = 0; for($i = 0; $i < sizeof($alphas[0]); $i++) { // if the word is an html tag or entity then skip it if (preg_match("/<[^>]+>|&[^;\ ]+;/", $alphas[0][$i][0])) continue; // ignore quotes if (preg_match("/\[QUOTE\].\[\/QUOTE\]/ism", $alphas[0][$i][0])) continue; // ignore BBCODE/VBCODE tags if (preg_match("/\[[^\]]+/", $alphas[0][$i][0])) continue; if (MisSpelled($alphas[0][$i][0])) { $js .= "new misp('" . str_replace("'", "\\'",$alphas[0][$i][0]) . "',". $alphas[0][$i][1] . "," . (strlen($alphas[0][$i][0]) + ($alphas[0][$i][1] - 1) ) . ",["; $suggestions = Suggest($alphas[0][$i][0]); foreach ($suggestions as $suggestion) { $sugs[] = "'".str_replace("'", "\\'", $suggestion)."'"; } if (sizeof($sugs)) { $js .= join(",", $sugs); } unset($sugs); $js .= "]),\n"; $sugs_found = 1; } } if ($sugs_found) $js = substr($js, 0, -2); $js .= ");"; eval('print_output("' . fetch_template('vbspell') . '");'); ?>

Code Monkey 11-09-2005 05:17 AM

Never mind. I forgot I turned off short open tags. This is why you should never use short open tags. *waves finger*

:D

Simple fix by adding php after <? in vbspell.php. ;)

tamarian 11-09-2005 06:23 PM

Quote:

Originally Posted by seg
Thanks for the Spell Checker mod. Everything works great except for the Quick edit. I was confused by the notes, is this fixed yet, or is it still not supposed to work?

No, it still doesn't work with Quick edit.


Quote:

Also, just a suggestion for future versions. It would be nice to have a centralized dictionary where the Admin can allow certain words used by all members of the board.
Note that it's best to let everyone add words, since adding words is done through cookies, and does not effect other users.

tamarian 11-09-2005 06:23 PM

Quote:

Originally Posted by JumpD
Never mind. I forgot I turned off short open tags. This is why you should never use short open tags. *waves finger*

:D

Simple fix by adding php after <? in vbspell.php. ;)


Good point :)

thewitt 11-10-2005 01:17 AM

Quote:

Originally Posted by tamarian
I like it. I've made a link to it in the instructions as an alternative method. Some minor drawbacks are: 1) vbspell.js will be loaded on everypage, and 2) it removed the ieSpell button, which some users may still prefer.

This integration method also makes vBSpell work with Quick Edit...

My users don't get the choice, but everyone has spell checking now.

-t

tamarian 11-10-2005 01:23 AM

Quote:

Originally Posted by thewitt
This integration method also makes vBSpell work with Quick

On 3.5 or 3.5.1?

thewitt 11-10-2005 01:31 AM

On both 3.5 and 3.5.1.

So far it seems to work every time I have a posting window, regardless of how it's presented.

-t

tamarian 11-10-2005 02:24 AM

Quote:

Originally Posted by thewitt
On both 3.5 and 3.5.1.

So far it seems to work every time I have a posting window, regardless of how it's presented.

I just tried it and you're right. It also works as a button now. Seems to be due to the change from vbform to qeform, now back to vbform again :)

thewitt 11-10-2005 03:14 AM

Quote:

Originally Posted by tamarian
I just tried it and you're right. It also works as a button now. Seems to be due to the change from vbform to qeform, now back to vbform again :)

Nice utility tamarian, thank you for your work on this.

Are you planning on any dictionary maintenance functions? Adding words to the dictionary would be a nice addition.

I would think that at a minimun, integrating the phpspell admin Add a Word function into the Admin would be a valuable feature.

On the high end, capturing the words that individuals add to their own private dictionaries for possible inclusion into the main dictionary would be very sweet.

Anyway, a very nice utility.

Fixing that annoying upgrade bug that whacks the template would be nice :).

-t

SilentNoise 11-12-2005 05:27 PM

I just installed it on my 3.5.1 board and things are A-OK. Awesome mod.
Thanks man.

tamborinegal 11-15-2005 03:35 AM

Thanks tamarian,

This is just what the users on our forum have been wanting. Thanks so much.

Easy to install. excellent. :)

slvr ralliart 11-20-2005 10:59 PM

aight nice hack!!

how do I add a few words in the dictionary that aren't there?

tamborinegal 11-20-2005 11:00 PM

Quote:

Originally Posted by dsmcd01

Also, if you spell check: "greeeed asdf" and choose ignore for 'greed', the 'Change to' field is still populated with 'greed' when looking at 'asdf'.

Quote:

Originally Posted by tamarian
Good points, I'll mark it as a to-do :)

tamarian,

Love this hack... but is there any update on the problem above? The problem is, if this happens at the beginning of a post, you have no way to check the rest, it just keeps suggesting the same word :(

thanks

slvr ralliart 11-20-2005 11:38 PM

so...

would you like to share how to add a word or two the the dictionary?

tamarian 11-20-2005 11:48 PM

Quote:

Originally Posted by tamborinegal
Love this hack... but is there any update on the problem above? The problem is, if this happens at the beginning of a post, you have no way to check the rest, it just keeps suggesting the same word :(

O.k., I'll bump it up on my to-do list, just been too busy :) . If there's any JavaScript programmers here, feel free to make suggestions.

slvr ralliart 11-20-2005 11:56 PM

Quote:

Originally Posted by tamarian
O.k., I'll bump it up on my to-do list, just been too busy :) . If there's any JavaScript programmers here, feel free to make suggestions.


can i add words myself? or how does this work?

tamborinegal 11-20-2005 11:58 PM

Quote:

Originally Posted by tamarian
O.k., I'll bump it up on my to-do list, just been too busy :) . If there's any JavaScript programmers here, feel free to make suggestions.

Thanks tamarin :) You do great work. Love vBdrupal too.

slvr ralliart 11-21-2005 12:04 AM

bump for my simple question

tamarian 11-21-2005 12:09 AM

Quote:

Originally Posted by slvr ralliart
bump for my simple question

By using the learn button, which adds words to the user's cookie.

slvr ralliart 11-21-2005 12:30 AM

doesn't work

tamarian 11-21-2005 01:16 AM

Quote:

Originally Posted by tamborinegal
is there any update on the problem above? The problem is, if this happens at the beginning of a post, you have no way to check the rest, it just keeps suggesting the same word :(

Test this for me. Open vbspell.js and find:
HTML Code:

        if (misps[ wordindex ].suggestions.length) {
                for (sugidx = 0; sugidx < misps[ wordindex ].suggestions.length; sugidx++) {
                        if (sugidx == 0)
                                isselected = 1;
                        else
                                isselected = 0;
                        newopt = new Option(misps[ wordindex ].suggestions[sugidx], misps[ wordindex ].suggestions[sugidx], 0, isselected);
                        sug.options[ sugidx ] = newopt;
               
                        if (isselected) {
                                frm.changeto.value = misps[ wordindex ].suggestions[sugidx];
                                frm.changeto.select();
                        }
                }
        }

Add after:
HTML Code:

        else
        {
                frm.changeto.value = '';
                frm.changeto.select();
        }


zoomforce 11-22-2005 05:30 AM

k i got a wierd problem..

install works fine for new reply.. i just installed it into quick edit, and when i click modify, the button shows up, and when i click it, the pop up opens but is totally blank (it doesnt take the post text) and it goes "spell check done" then proceeds to whipe out the text completely, so there is nothing in the edit box when it goes back.

any ideas?

RGSMDNR 11-22-2005 11:06 AM

how do i make the pop up window bigger? the right hand side is cut off slightly.


All times are GMT. The time now is 07:38 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01862 seconds
  • Memory Usage 1,906KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (3)bbcode_html_printable
  • (2)bbcode_php_printable
  • (24)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete