[AJAX] Live Search

MobileHacks

New Member
Version 2.0

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
Rewritten many things since version 1.6

Installation:
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:
PHP:
                <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:
PHP:
                    <div id="lsa_window">
Next, find the tag <input HHH> with a value of type="text" and add (if not match, replace) the following:
PHP:
id="lsa_input" maxlength="$vboptions[lsa_maxsym]" value="$vbphrase[live_search]" onfocus="if(this.value=='$vbphrase[live_search]'){this.value=''};<if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))"> showHint();</if>" onblur="if (this.value==''){this.value='$vbphrase[live_search]'}"<if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))"> onkeyup="showHint();</if>
Before the closing tag </form> add:
PHP:
                    </div>
                    <if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))"><script type="text/javascript"> vbmenu_register("lsa_window",1); </script></if>
As a result, you should get some of this code:
PHP:
                <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" class="bginput" name="query" tabindex="1001" id="lsa_input" maxlength="$vboptions[lsa_maxsym]" value="$vbphrase[live_search]" onfocus="if(this.value=='$vbphrase[live_search]'){this.value=''};<if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))"> showHint();</if>" onblur="if (this.value==''){this.value='$vbphrase[live_search]'}"<if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))"> onkeyup="showHint();</if> />
                    <input type="submit" class="button" value="$vbphrase[go]" tabindex="1004" />
                    </div>
                    <if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))"><script type="text/javascript"> vbmenu_register("lsa_window",1); </script></if>
                </form>

Live DEMO:
MixPlay (user: test, pass: 123456)
Live video: YouTube - Live Search
 

etrader

New Member
It may seems an irrelevant question

but could you please tell me what is the skin used in the demo site ?

Thanks
 

mad@Max

New Member
Version 2.1.2

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
Rewritten many things since version 1.6

Installation:
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:

HTML:
				<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:

HTML:
					<div id="lsa_window">

Next, find the tag <input HHH> with a value of type="text" and add (if not match, replace) the following:

Code:
id="lsa_input" name="query" tabindex="1001" maxlength="$vboptions[lsa_maxsym]" value="$vbphrase[live_search]" <if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))">onfocus="vbmenu_register('lsa_window',1); if(this.value=='$vbphrase[live_search]'){this.value=''}; showHint();" onblur="this.value='$vbphrase[live_search]';" onkeyup="showHint();" onmouseup="showHint();"<else />onfocus="if(this.value=='$vbphrase[live_search]'){this.value=''};" onblur="this.value='$vbphrase[live_search]';"</if>

Before the closing tag </form> add:

HTML:
					</div>

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

HTML:
				<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" name="query" tabindex="1001" maxlength="$vboptions[lsa_maxsym]" value="$vbphrase[live_search]" <if condition="!in_array($bbuserinfo[usergroupid], array($vboptions[lsa_group]))">onfocus="vbmenu_register('lsa_window',1); if(this.value=='$vbphrase[live_search]'){this.value=''}; showHint();" onblur="this.value='$vbphrase[live_search]';" onkeyup="showHint();" onmouseup="showHint();"<else />onfocus="if(this.value=='$vbphrase[live_search]'){this.value=''};" onblur="this.value='$vbphrase[live_search]';"</if> />
					<input type="submit" class="button" value="$vbphrase[go]" tabindex="1004" />
					</div>
				</form>

Live DEMO: MixPlay (user: test, pass: 123456)
Live video: YouTube - [AJAX] Live Search

PS Some function writed by ChangUonDyU
 

famouszor

New Member
I installed the updated version (clean installed)
I have setup to Integration into drop down search since I do not have an Open search box on my skin.
Here is a bug, hope you can help.
When I click on the drop down search, Live Search is there, when I make a search, it finds it, but when I go to click on that link, it dose nothing except closes the search window.
Im running 3.8.0 and Ambinet Lighting Skin.

also, if you could tell me how to make an open search box with the skin above.

Thanks
 

TAIFUN

New Member
also, if you could tell me how to make an open search box with the skin above


Open navbar

Find
Code:
<if condition="$show['member']">
	<td class="alt2" nowrap="nowrap">
	<div class="smallfont">
		<strong><phrase 1="$bbuserinfo[username]" 2="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[welcome_x_link_y]</phrase></strong><br />

Add above

Code:
<td class="alt1" align="center" nowrap="nowrap">
$lsaform
	</td>

After get in admincp -> AJAX Live Search
ON - $lsaform - this is a field of search, choose yes for activate it. After this you can put
 

famouszor

New Member
When I added the search box code below it did 2 things thats making it not work.

Its not opening the Live Search Window (yes I have it toggled to use $lsaforum) but it dose do a search. Next, I also still have the live search toggled in the drop down search. when I use your code, its killing the live search by not finding anything when I type key words.

This is what I have done.

I took the code from mad@max and added it to your code REPLACING the $lsaform tag, still no live search box. and drop down search doing the same thing. I removed all code, and now the drop down search is working and finding searches.

Not sure what to do next. any ideas?

Thanks for your time and help
FZ



TAIFUN said:
Open navbar

Find
Code:
<if condition="$show['member']">
	<td class="alt2" nowrap="nowrap">
	<div class="smallfont">
		<strong><phrase 1="$bbuserinfo[username]" 2="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[welcome_x_link_y]</phrase></strong><br />

Add above

Code:
<td class="alt1" align="center" nowrap="nowrap">
$lsaform
	</td>

After get in admincp -> AJAX Live Search
ON - $lsaform - this is a field of search, choose yes for activate it. After this you can put
 

mad@Max

New Member
Version 2.2.2
Add function:
* search only the specified length of each word
Finally i wrote this function by js and php at the same cut of words less than you specified in your preferences. That is, if you will, for example, enter "bat of the", then perform a search for "bat the", thus cut short the word "of". This script will "wait" until you enter the floor of the three characters.
 

lilfabbro

New Member
Use Firefox,^^ and i just have a question, it works like a charm, ive managed to remove the text under the search and position it how the team hasup at the top, but how can i change Live Search ive searched through the code and searched Live Search & Live_Search but when ever i change one it messes up, so anyone no exactlly what line i'd have to Change, im looking to make it more like the VB Team's search at the top
 
Top