]> git.plutz.net Git - serve0/blob - view.sh
fix bug in exclusive tag support
[serve0] / view.sh
1 #!/bin/sh
2
3 . "$_EXEC/indexmeta.sh"
4 . "$_EXEC/widgets.sh"
5
6 read length width height tags comment short <<-EOF
7         $(meta_info "$_DATA/$ITEM")
8         EOF
9
10 printf 'Content-Type: text/html;charset=utf-8\r\n\r\n'
11
12 { printf '
13 [!DOCTYPE HTML]
14 [html [head [title View]
15   [meta name="viewport" content="width=device-width"]
16   [link rel=stylesheet href="/style.css" ]
17 ] [body #view
18   [script type="text/javascript" src="/stereoview.js"\n]
19   [div #navigation
20     [a #t_bookmarks href="#bookmarks" &#x2605;]'
21     w_search
22     printf '
23     [a #t_avsearch href="#advsearch" Advanced]
24     [a #t_prefs href="#prefs" &#x2699;]
25   ]'
26   w_bookmarks
27   w_advsearch
28   w_prefs
29   printf '
30   [video #mainvideo controls="controls" [source src="?a=download" type="video/mp4"]]
31   [a "?a=download" Download]
32   [a "javascript:stereoview(180, document.getElementById(&#34;mainvideo&#34;));" View 180° Stereoscopic]
33   [a "javascript:stereoview(360, document.getElementById(&#34;mainvideo&#34;));" View 360° Stereoscopic]
34   [h1\n %s]
35   [span .time %i:%02imin] [span .dim %ix%i] %s
36   ' "$(HTML "${ITEM##*/}" |sed -r "$w_ascii"' s;[^0-9a-zA-Z&#];&[wbr];g')" \
37     "$((length / 60))" "$((length % 60))" "$width" "$height" \
38     "$(printf '%s\n' "${tags#tags=}" |sed -r "$UNSTRING"'
39        s;^;,;; s;,+;,;g; s;,$;;; :X s;,-?([^,]+)(,|$); [span .tag\n \1]\2;; tX;'
40     )"
41   printf '
42   [div #editing
43     [form method=POST action="/?a=multitag"
44     [hidden "select" "%s"]' "$(HTML "${ITEM}")"
45       [ -d "$_DATA/${ITEM%/*}/.index/" ] && w_tagging
46     printf '
47     ]
48   ]
49 ] ]
50 '; } | "$_EXEC/cgilite/html-sh.sed"