SET_COOKIE +$((86400 * 90)) fakemp4="$(POST fakemp4 |grep -m1 -axE 'yes' || printf no)"
REDIRECT "$(POST ref)"
;;
+ bookmark)
+ bm="$_DATA/.index/bookmarks"
+ . "$_EXEC/cgilite/storage.sh"
+
+ s="$(POST search |STRING)"; f="$(POST filter |STRING)"
+ if LOCK "$bm"; then
+ grep -m1 -avF " search=$s filter=$f${CR}" "$bm" >"$bm.tmp"
+ [ ! "$(POST delete)" ] \
+ && printf '%s search=%s filter=%s\r\n' \
+ "$(POST name |STRING)" "$s" "$f" >>"$bm.tmp"
+ mv "$bm.tmp" "$bm"
+ RELEASE "$bm"
+ fi
+ REDIRECT "$(POST ref)"
+ ;;
esac
if [ "$ITEM" = "/style.css" ]; then
#prefs, #bookmarks, #multitag, #advsearch {
display: block; position: absolute;
- height: 0; max-width: 100%;
+ height: 0; width: 100%; max-width: 100%;
margin-top: -1px;
padding: 0 1em;
border: 1px none;
overflow: hidden;
background-color: #333;
+ z-index: 1;
}
#bookmarks {
left: 0; width: 30%;
min-width: 200px;
margin-left: auto;
}
-#advsearch { text-align: center; }
+#advsearch {
+ text-align: center;
+}
#advsearch:target, #multitag:target,
#prefs:target, #bookmarks:target {
- height: auto;
- overflow: visible;
+ height: auto; overflow: visible;
}
#advsearch:target { border-style: none none solid none; }
#prefs:target { border-style: none none solid solid; }
#advsearch a[href="#"] { border-bottom: 1px solid; }
#multitag a[href="#"] { top: -1em; line-height: 1em; }
+
+/* ### Preferences Drawer ### */
+
#prefs label[for=prefs_ps] {
font-weight: bold;
}
max-width: 85%;
}
+
+/* ### Bookmarks Drawer ### */
+
+#bookmarks input,
+#bookmarks button {
+ margin-bottom: 1.25em;
+}
+#bookmarks label {
+ display: block;
+ font-weight: bold;
+}
+#bookmarks a.link {
+ display: inline-block;
+ font-size: .75em;
+ text-decoration: underline;
+ margin: 0 1em 1.25em 0;
+}
+
+
+/* ### Advance Search Drawer ###*/
+
#advsearch .help {
display: block;
- margin: -1em .625em 1em .625em;
+ margin: -1em .5em 1em .5em;
padding: .5em 1em;
background-color: #444;
line-height: 1.5em;
width: 50%;
}
+
+/* ### Item Listing ### */
+
.list {
position: relative;
display: inline-block;
width: 100%;
background-color: #333;
border-top: 1px solid;
- padding: .25em;
+ padding: .25em 0;
}
#index label:first-of-type { font-weight: bold; }
#index input, #index button { margin-left: 1em;}
+
+/* ### Multi Tagging Drawer ### */
+
#multitag fieldset{
display: inline-block;
width: 25%; min-width: 250px;
. "$_EXEC/cgilite/storage.sh"
-w_refuri="$(HTML "$REQUEST_URI")"
+w_refuri="$(URL "$PATH_INFO")?$(HTML "$QUERY_STRING")"
w_tags="$(find "$_DATA/" -path '*/.index/meta' -print0 \
| xargs -r0 sed -r '
[ "$ORDER" = Length ] && w_colength=checked
w_bookmarks(){
- local name link bm
- bm="$_DATA/.index/bookmarks"
-
- printf '[form #bookmarks action=?a=bookmarks method=POST
- [a href="#" X]
+ local name='' cf='' cs='' bm="$_DATA/.index/bookmarks" proposed_name=''
+ [ ! -d "${bm%/*}" ] && return 0
+ [ ! -f "$bm" ] && touch "$bm"
+
+ [ "$SEARCH" ] && cs="$(STRING "$SEARCH")"
+ [ "$FILTER" ] && cf="$(STRING "$FILTER")"
+
+ name="$(grep -m1 -aF " search=$cs filter=$cf${CR}" "$bm" |cut -f1 |UNSTRING)"
+ [ ! "$name" ] && proposed_name="$(
+ printf '%s\t%s' "$SEARCH" "$FILTER" \
+ |sed -r '/^\t$/{ s;\t;All;; q;}
+ /.*\t$/{ s;\t$;;; q;}
+ /^\t.*/{ s;^\t;;;
+ :x; s;(^|[~^|])([^|^~:]+):;\1;; tx;
+ s;\^; and ;g; s;\|;,;g; s;~;not ;g; q;}'
+ )"
+
+ printf '[form #bookmarks action=?a=bookmark method=POST
+ [a href="#" x]
[hidden "ref" "%s"]
- ' "$w_refuri"
-
- name="$(grep -m1 -F " $(STRING "${REQUEST_URI}")" "$bm")"
- printf '[hidden "link" "%s"][input name="name" value="%s"]' \
- "$(HTML "$link")" "$(HTML "$name")"
-
- sort "$bm" |while read -r name link; do
- name="$(UNSTRING "$name")"
- link="$(UNSTRING "$link")"
- if [ "$link" != "$REQUEST_URI" ]; then
- printf '[a href="%s"\n%s]' "$(HTML "$link")" "$(HTML "$name")"
- fi
+ [hidden "search" "%s"][hidden "filter" "%s"]
+ [label Name for current page:]
+ [input name="name" value="%s" placeholder="Name" ]
+ [button type="submit" %s]' \
+ "$w_refuri" \
+ "$(HTML "$SEARCH")" "$(HTML "$FILTER")" \
+ "$(HTML "${name:-${proposed_name}}")" \
+ "${name:+Update}${proposed_name:+Add}"
+ [ "$name" ] && printf ' [submit "delete" "delete" Delete]'
+
+ sort "$bm" |while read -r name search filter; do
+ search="${search#search=}" filter="${filter#filter=}" filter="${filter%${CR}}"
+ [ "$search" = "${cs}" -a "$filter" = "${cf}" ] && continue
+
+ name="$(UNSTRING "$name")";
+ search="$(UNSTRING "${search}" |URL)";
+ filter="$(UNSTRING "${filter}" |URL)";
+ printf '[label .link %s]
+ [a .link target=blank href="?o=Name&s=%s&f=%s" by Name]
+ [a .link target=blank href="?o=Date&s=%s&f=%s" by Date]
+ [a .link target=blank href="?o=Length&s=%s&f=%s" by Length]
+ [br]' \
+ "$(HTML "$name")" \
+ "$search" "$filter" \
+ "$search" "$filter" \
+ "$search" "$filter"
done
printf ']'
}