improve search result display
This commit is contained in:
parent
0b10cefced
commit
afc839bee1
|
@ -58,9 +58,9 @@
|
||||||
<div>
|
<div>
|
||||||
<a href="note.php?new" class="grey" accesskey="n">new</a>
|
<a href="note.php?new" class="grey" accesskey="n">new</a>
|
||||||
<a href="index.php?download" class="grey" accesskey="d">download</a>
|
<a href="index.php?download" class="grey" accesskey="d">download</a>
|
||||||
|
<input form="home" placeholder="filter..." autofocus autocomplete="off" class="title" name="filter" value="<?php echo $filter; ?>" form="home">
|
||||||
<form action="index.php" method="GET" id="home">
|
<form action="index.php" method="GET" id="home">
|
||||||
<input hidden type="submit">
|
<input hidden type="submit">
|
||||||
<input placeholder="filter..." autofocus autocomplete="off" class="title" name="filter" value="<?php echo $filter; ?>" form="home">
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -94,7 +94,12 @@
|
||||||
if ($filter && str_contains(cleanstring($content), cleanstring($filter)))
|
if ($filter && str_contains(cleanstring($content), cleanstring($filter)))
|
||||||
{
|
{
|
||||||
$pos = strpos(cleanstring($content), cleanstring($filter));
|
$pos = strpos(cleanstring($content), cleanstring($filter));
|
||||||
echo '<span class="grey"> ' . $filter . substr($content, $pos + strlen($filter), 42) . '</span>';
|
$start = max($pos - 21, 0);
|
||||||
|
echo '<span class="grey"> ';
|
||||||
|
echo substr($content, $start, min(21, $pos));
|
||||||
|
echo '<b>' . $filter . '</b>';
|
||||||
|
echo substr($content, $pos + strlen($filter), 21);
|
||||||
|
echo '</span>';
|
||||||
}
|
}
|
||||||
echo'</div>';
|
echo'</div>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue