PDA

View Full Version : [YUI] Live Search



KingSky
10-02-14, 10:21 AM
Features:


search only, if typed >= 3 symbols;
header to window with button close;
message about no result;
limit number of threads;
highlight words in result
trim title of thread, if it large (optional)
edit position of pop-up window
work with vBadvanced
limit the number of displayed results
group permission
search by your own forums
sort results of search
mod makes only one query to db
full compatibility with styles and browsers
search by individual words
integrate option into standard search
search only the specified length of each word
users search
interval requests
wrote 2 js class
Rewritten many things since version 1.6



Known Issues
Double click in search field - still not fixed.

Installation:
Upload all files from folder upload to forum folder.
Import product.

Upgrade
Uninstall the old version, delete files (if you has use it) and install new version.

If you already have opened search field, do following.
Search field look like this:


<form action="search.php?do=process" method="post">

<input type="hidden" name="do" value="process" />
<input type="hidden" name="quicksearch" value="1" />
<input type="hidden" name="childforums" value="1" />
<input type="hidden" name="exactname" value="1" />
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="text" class="bginput" name="query" size="25" tabindex="1001" />
<input type="submit" class="button" value="$vbphrase[go]" tabindex="1004" />

</form>

So, after the opening tag <form ХХХ> add bottom:


<div id="lsa_window">

Before the closing tag </form> add:


</div>

We have prepared the search form to pop-up window. Now we need to bind to the field of javascript.

For this in tag <input type="text" /> add id="lsa_input"

As a result, you should get some of this code:


<form action="search.php?do=process" method="post">
<div id="lsa_window">
<input type="hidden" name="do" value="process" />
<input type="hidden" name="quicksearch" value="1" />
<input type="hidden" name="childforums" value="1" />
<input type="hidden" name="exactname" value="1" />
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<input type="text" id="lsa_input" class="bginput" name="query" size="25" tabindex="1001" />
<input type="submit" class="button" value="$vbphrase[go]" tabindex="1004" />
</div>
</form>

P.S. If you already have id in your search field and its change may be possible to reset the anchor CSS, do the following.
Open the template lsa_script and edit the line

var lsa = new AJAX_LiveSearch_Prepare("lsa", "lsa_input", "lsa_window");

where the arguments of the class:
lsa - variable name initialize class js
lsa_input - search field id
lsa_window - pop-up window id

Thus, changing the arguments of the class AJAX_LiveSearch_Prepare, you can not edit the search field.