Revert "search field autocomplete"
This reverts commit 29d9c7ae1600abd8f0136776daef16c9a23d2b8b. zshall has already done this, better >_<
This commit is contained in:
parent
29d9c7ae16
commit
65962a591a
@ -173,28 +173,6 @@ class Index extends SimpleExtension {
|
||||
$this->theme->display_page($page, $images);
|
||||
}
|
||||
}
|
||||
|
||||
if($event->page_matches("api/internal/index/get_tags")) {
|
||||
$page->set_mode("data");
|
||||
$page->set_type("text/plain");
|
||||
|
||||
$term = ltrim($_GET["term"]);
|
||||
$space_pos = strrpos($term, " ");
|
||||
$pre = "";
|
||||
$term_only = $term;
|
||||
if($space_pos !== FALSE) {
|
||||
$pre = substr($term, 0, $space_pos+1);
|
||||
$term_only = substr($term, $space_pos+1);
|
||||
}
|
||||
|
||||
$all = $database->get_all(
|
||||
"SELECT tag FROM tags WHERE tag LIKE ? LIMIT 10",
|
||||
array($term_only."%"));
|
||||
|
||||
$res = array();
|
||||
foreach($all as $row) {$res[] = $pre.$row["tag"];}
|
||||
$page->set_data(json_encode($res));
|
||||
}
|
||||
}
|
||||
|
||||
public function onSetupBuilding($event) {
|
||||
|
@ -82,10 +82,6 @@ EOD;
|
||||
<script><!--
|
||||
$(document).ready(function() {
|
||||
$(\"#search_input\").DefaultValue(\"Search\");
|
||||
$(\"#search_input\").autocomplete({
|
||||
source: \"".make_link("api/internal/index/get_tags")."\",
|
||||
minLength: 2
|
||||
});
|
||||
});
|
||||
//--></script>
|
||||
<p><form action='$h_search_link' method='GET'>
|
||||
|
Loading…
x
Reference in New Issue
Block a user