mirror of https://xfnw.ttm.sh/git/huntnw.git
search bar
This commit is contained in:
parent
f251c397f4
commit
848618f778
|
@ -0,0 +1 @@
|
||||||
|
</div>
|
6
genout
6
genout
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
PA=`cat -`
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "["`head -n 1 $PA`"]("`head -n 2 $PA | tail -n 1`")"
|
|
18
header.html
18
header.html
|
@ -0,0 +1,18 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
|
||||||
|
<title>tser - lickthecheese's cgi based search engine</title>
|
||||||
|
|
||||||
|
<h1>tser</h1>
|
||||||
|
lickthecheese's cgi based search engine
|
||||||
|
<div class='wrapper'>
|
||||||
|
<div class='box search-container'>
|
||||||
|
<form action="./">
|
||||||
|
<input type="text" placeholder="Search.." name="q">
|
||||||
|
<button type="submit"><i class="fa fa-search"></i></button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,11 @@ Q=$(echo "$QUERY_STRING" | sed -n 's/^.*q=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" |
|
||||||
if [[ $Q ]]
|
if [[ $Q ]]
|
||||||
then
|
then
|
||||||
|
|
||||||
./tser $Q | cmark
|
./tser $Q
|
||||||
|
|
||||||
|
|
||||||
[[ $(./tser $Q) ]] || echo "No results :("
|
[[ $(./tser $Q) ]] || echo "<div class='box'>No results :(</div>"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cat footer.html
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: black;
|
||||||
|
font-family: monospace;
|
||||||
|
color: #aea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview, .box {
|
||||||
|
border: 1px solid #aea;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
width: 700px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #aea;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
code, kbd, pre {
|
||||||
|
background: #333;
|
||||||
|
color: #aea;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid #aea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-container input[type=text] {
|
||||||
|
padding: 6px;
|
||||||
|
margin-top: 3px;
|
||||||
|
font-size: 17px;
|
||||||
|
border: 3px solid #aea;
|
||||||
|
color: #aea;
|
||||||
|
background: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-container button {
|
||||||
|
float: left;
|
||||||
|
padding: 8px 10px;
|
||||||
|
margin-top: 3px;
|
||||||
|
margin-right: 16px;
|
||||||
|
background: #333;
|
||||||
|
font-size: 17px;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
color:#aea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-container button:hover {
|
||||||
|
background: #111;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@media screen and (max-width:700px) {
|
||||||
|
.wrapper {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
7
tser
7
tser
|
@ -1,10 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
QUERY=`echo $1 | tr ' ' '|'`
|
QUERY=`echo $1 | tr ' ' '|' | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g'`
|
||||||
|
|
||||||
|
|
||||||
for fn in `grep -rlE $QUERY content`;do
|
for fn in `grep -rlEi $QUERY content`;do
|
||||||
echo $fn | ./genout
|
PA=$fn
|
||||||
|
echo "<div class='box'><a href='"`head -n 2 $PA | tail -n 1`"'>"`head -n 1 $PA`"</a><p>"`grep -i $QUERY $PA | sed 's/&/\&/g; s/</\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g' | head -n 5`"</p></div>"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue