Skip to content

Commit

Permalink
[20] Now results of search are displayed instantly.
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan <Dfyztimy@list.ru>
  • Loading branch information
Hantet committed Jul 6, 2010
1 parent 7a9932c commit a10dbaf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function get($id)
## checkdiff: Different in days for recheck updates.
##################################################################################################*/
"CheckVersion" => false,
"version" => 19,
"version" => 20,
"checkdiff" => 2
);

Expand Down
3 changes: 1 addition & 2 deletions lib/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public function send()
<tr id="var4" style="display:none;">
<td class="block2" valign="top">Название: </td>
<td align="right">
<input id="name" onKeyUp="if(this.value.length > 2)searchfor(this.value)" onFocus="this.style.backgroundColor=\'#CCC\'" onBlur="this.style.backgroundColor=\'#FFF\'" class="input" type="text">
<div id="searchblock"></div>
<input id="name" onKeyUp="searchfor(this.value)" onFocus="this.style.backgroundColor=\'#CCC\'" onBlur="this.style.backgroundColor=\'#FFF\'" class="input" type="text">
</td>
</tr>
<tr id="var5" style="display:none;">
Expand Down
23 changes: 5 additions & 18 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,17 @@ function searchresult(id)
return;
}
document.getElementById("db").value = link+id;
document.getElementById("searchblock").style.display = "none";
document.getElementById("searchview").style.display = "none"
}

function searchview()
function searchfor(val)
{
if(document.getElementById("searchview").style.display == "none")
if(val.length < 3)
{
document.getElementById("searchblock").style.display = "none";
document.getElementById("searchview").style.display = "block";
}
else
{
document.getElementById("searchblock").style.display = "block";
document.getElementById("searchview").style.display = "none";
return;
}
}

function searchfor(val)
{
var tmp = document.getElementById("type");
var type = tmp.options[tmp.selectedIndex].value;
var table;
Expand Down Expand Up @@ -75,15 +66,11 @@ function searchfor(val)
{
var exp = html.split('^');
if(exp[0] == 0)
{
document.getElementById("searchblock").style.display = "none";
document.getElementById("searchview").style.display = "none";
}
else
{
document.getElementById("searchblock").innerHTML = exp[1];
document.getElementById("searchview").innerHTML = exp[2];
document.getElementById("searchblock").style.display = "block";
document.getElementById("searchview").innerHTML = exp[1];
document.getElementById("searchview").style.display = "block";
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
break;
}
$result = $sql->exe($cfg->get("mangos"),$query." LIMIT ".$cfg->get("searchlimit"));
$text = '<br><table border="0" align="center" cellpadding="0" cellspacing="0" style="text-align: left;border: 1px;border-color: black;border-style:solid;padding: 3px;">';
$text = '<br><table border="0" align="center" width="95%" cellpadding="0" cellspacing="0" style="text-align: left;border: 1px;border-color: black;border-style:solid;padding: 3px;">';
$i=0;
while($row=$sql->fetch($result))
{
Expand All @@ -55,6 +55,6 @@
</tr>';
$i++;
}
echo $i.'^<a href="#" onClick="searchview()">Найдено: '.$i.'</a>^'.$text.'</table><br>';
echo $i.'^'.$text.'</table><br>';
}
?>

0 comments on commit a10dbaf

Please sign in to comment.