From 848618f77892adcbb9c5c3e4020debf14d46d0e9 Mon Sep 17 00:00:00 2001 From: lickthecheese Date: Wed, 18 Mar 2020 20:02:21 -0400 Subject: [PATCH] search bar --- footer.html | 1 + genout | 6 ----- header.html | 18 +++++++++++++ index.cgi | 6 +++-- style.css | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tser | 7 ++--- 6 files changed, 101 insertions(+), 11 deletions(-) create mode 100644 footer.html delete mode 100755 genout create mode 100644 style.css diff --git a/footer.html b/footer.html new file mode 100644 index 0000000..04f5b84 --- /dev/null +++ b/footer.html @@ -0,0 +1 @@ + diff --git a/genout b/genout deleted file mode 100755 index 2f05dfa..0000000 --- a/genout +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -PA=`cat -` - -echo -echo "["`head -n 1 $PA`"]("`head -n 2 $PA | tail -n 1`")" diff --git a/header.html b/header.html index e69de29..fd1ea12 100644 --- a/header.html +++ b/header.html @@ -0,0 +1,18 @@ + + + + + +tser - lickthecheese's cgi based search engine + +

tser

+lickthecheese's cgi based search engine +
+
+
+ + +
+
+ + diff --git a/index.cgi b/index.cgi index 685889f..532d8b1 100755 --- a/index.cgi +++ b/index.cgi @@ -12,9 +12,11 @@ Q=$(echo "$QUERY_STRING" | sed -n 's/^.*q=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | if [[ $Q ]] then -./tser $Q | cmark +./tser $Q -[[ $(./tser $Q) ]] || echo "No results :(" +[[ $(./tser $Q) ]] || echo "
No results :(
" fi +cat footer.html + diff --git a/style.css b/style.css new file mode 100644 index 0000000..e6df711 --- /dev/null +++ b/style.css @@ -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%; +} +} + + + diff --git a/tser b/tser index c586274..cb50f36 100755 --- a/tser +++ b/tser @@ -1,10 +1,11 @@ #!/bin/bash -QUERY=`echo $1 | tr ' ' '|'` +QUERY=`echo $1 | tr ' ' '|' | sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g'` -for fn in `grep -rlE $QUERY content`;do -echo $fn | ./genout +for fn in `grep -rlEi $QUERY content`;do +PA=$fn +echo "
"`head -n 1 $PA`"

"`grep -i $QUERY $PA | sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g' | head -n 5`"

" done