From 206364757997f75d7fb6f26fd86714b477cc7329 Mon Sep 17 00:00:00 2001 From: paul Date: Sun, 3 Dec 2017 17:00:17 +0000 Subject: [PATCH] implemented search queries, some speedup, caching svn path=/trunk/; revision=11 --- bookmarks.css | 10 +++++----- index.cgi | 45 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/bookmarks.css b/bookmarks.css index db96bd8..f905773 100644 --- a/bookmarks.css +++ b/bookmarks.css @@ -148,6 +148,7 @@ html, body { width: 16em; display: inline-block; margin: .5em 1em; + white-space: nowrap; } .bookmark > a.modify { @@ -169,12 +170,11 @@ html, body { .bookmark:hover { left: -1em; padding-left: 1em; } .bookmark:hover > a.bmove { display: inline-block; } .bookmark > a.bmove:before { color: #888; font-size: medium; } -.bookmark > a.bmove:nth-of-type(3) { position: absolute; left: 0; } -.bookmark > a.bmove:nth-of-type(3):before { content: '\25c0'; } -.bookmark > a.bmove:nth-of-type(4):before { content: '\25b6'; } +.bookmark > a.bmove:nth-last-of-type(2) { position: absolute; left: 0; } +.bookmark > a.bmove:nth-last-of-type(2):before { content: '\25c0'; } +.bookmark > a.bmove:nth-last-of-type(1):before { content: '\25b6'; } -.bookmark > a.link { margin-left: 0;} -.bookmark > a.link > img { +.bookmark img { height: 1.25em; vertical-align: text-bottom; margin: 0 .5ex; diff --git a/index.cgi b/index.cgi index 12caed1..98e6719 100755 --- a/index.cgi +++ b/index.cgi @@ -198,7 +198,7 @@ case "$(GET action)" in file="${BDB}/${fid}.bm" bid="$(timeid)" if [ -n "$name" -a -f "${file}" ]; then - printf '%s\t%s\t%s\n' "$bid" "$(HTML "$name")" "$(HTML "$url")" >>"${file}" + printf '%s\t%s\t%s\n' "$bid" "$(HTML "$name")" "$url" >>"${file}" fi getFavicon "$url" "$bid" REDIRECT "${SCRIPT_NAME}#${fid}" @@ -209,8 +209,7 @@ case "$(GET action)" in url="$(POST url |head -n1)" file="$(grep -lm1 "^${bid}" "${BDB}"/????????????.bm |head -n1)" if [ -n "$name" -a -n "$url" -a "$(POST control)" = confirm -a -w "$file" ]; then - bm="$(printf '%s\t%s\t%s' "$bid" "$(HTML "$name")" "$(HTML "$url")" |sed -r 's;[\&\;];\\&;g;')" - sed -ri "s;^${bid}\t.*$;${bm};" "$file" + sed -rni "/^${bid}\t/!p; /^${bid}\t/i${bid}\t$(HTML "$name")\t${url}" "$file" fi getFavicon "$url" "$bid" REDIRECT "${SCRIPT_NAME}#${fid}" @@ -247,6 +246,19 @@ case "$(GET action)" in fi REDIRECT "${SCRIPT_NAME}#${fid}" ;; + query) + fid="$(POST fid |checkid)" + bid="$(POST bid |checkid)" + file="${BDB}/${fid}.bm" + query="$(URL "$(POST query)")" + + + url="$(grep -m1 "^${bid}" "$file" |cut -f3-)" + urlpfx="${url%\{@\}*}" + urlsfx="${url#*\{@\}}" + + REDIRECT "${urlpfx}${query}${urlsfx}" + ;; esac bookmarkmod(){ @@ -267,7 +279,7 @@ bookmarkmod(){ - + @@ -300,14 +312,27 @@ show_bookmarks(){ tail -n+2 "${BDB}/${fid}.bm" \ | while read bid name url; do - cat <<-EOF + if [ "${url%\{@\}*}" = "${url}" ]; then + cat <<-EOF
Modify - ${name} + ${name} move left move right
EOF + else + cat <<-EOF +
+ Modify + + + + move left + move right +
+ EOF + fi done } @@ -375,7 +400,12 @@ foldermod(){ show_folders(){ list_folders \ | while read fid fname order; do - cat <<-EOF + file="${BDB}/${fid}.bm" + cache="${BDB}/${fid}.cache" + if [ "${cache}" -nt "${file}" ]; then + cat "$cache" + else + tee "$cache" <<-EOF

${fname}

Modify @@ -388,6 +418,7 @@ show_folders(){
EOF + fi done } -- 2.39.2