width: 16em;
display: inline-block;
margin: .5em 1em;
+ white-space: nowrap;
}
.bookmark > a.modify {
.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;
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}"
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}"
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(){
<label>Name:</label>
<input type="text" name="name" value="${name}")" placeholder="Name" />
<label>URL:</label>
- <input type="text" name="url" value="${url}")" placeholder="URL" />
+ <input type="text" name="url" value="$(HTML "${url}")")" placeholder="URL" />
<button type="submit" name="control" value="confirm">OK</button>
<button type="submit" name="control" value="cancel">Cancel</button>
</form>
tail -n+2 "${BDB}/${fid}.bm" \
| while read bid name url; do
- cat <<-EOF
+ if [ "${url%\{@\}*}" = "${url}" ]; then
+ cat <<-EOF
<div class="bookmark">
<a class="modify" href="${SCRIPT_NAME}?bmodify=${bid}">Modify</a>
- <a class="link" href="${url}")"><img src="${BDB}/favicons/${bid}.ico"/>${name}</a>
+ <a class="link" target="_blank" href="$(HTML "${url}")")"><img src="${BDB}/favicons/${bid}.ico"/>${name}</a>
<a class="bmove" href="${SCRIPT_NAME}?action=bmup&fid=${fid}&bid=${bid}">move left</a>
<a class="bmove" href="${SCRIPT_NAME}?action=bmdn&fid=${fid}&bid=${bid}">move right</a>
</div>
EOF
+ else
+ cat <<-EOF
+ <form class="bookmark" target="_blank" method="POST" action="${SCRIPT_NAME}?action=query">
+ <a class="modify" href="${SCRIPT_NAME}?bmodify=${bid}">Modify</a>
+ <input type="hidden" name="fid" value="$fid" />
+ <input type="hidden" name="bid" value="$bid" />
+ <img src="${BDB}/favicons/${bid}.ico"/><input name="query" placeholder="$name"/>
+ <a class="bmove" href="${SCRIPT_NAME}?action=bmup&fid=${fid}&bid=${bid}">move left</a>
+ <a class="bmove" href="${SCRIPT_NAME}?action=bmdn&fid=${fid}&bid=${bid}">move right</a>
+ </form>
+ EOF
+ fi
done
}
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
<section class="folder" id="${fid}">
<h1>${fname}</h1>
<a class="modify" href="${SCRIPT_NAME}?fmodify=${fid}">Modify</a>
</form>
</section>
EOF
+ fi
done
}