]> git.plutz.net Git - serve0/blob - widgets.sh
css loading, externalize page code to file
[serve0] / widgets.sh
1 #!/bin/sh
2
3 w_search(){
4   printf '
5   [form #search method=GET action=?
6     [select name=o size=1 
7       [option disabled=disabled Order By]
8       [option value=Name Name]
9       [option value=Date Date]
10       [option value=Length Length]
11     ]
12     [input name=s placeholder=Search value="%s"]
13   ]
14   ' \
15   "$(HTML "$search")"
16 }
17
18 w_prefs(){
19   printf '
20   [form #prefs method="POST" action="?a=setprefs"
21     [hidden "ref" "%s"]
22     [label for=prefs_ps Pagesize]
23     [input #prefs_ps type=number name=pagesize value="%s"][br]
24     [checkbox "fakemp4" "yes" %s #prefs_fmp4] [label for=prefs_fmp4 Fake .MP4 file ending][br]
25     [submit "store" "store" Set Cookie]
26   ]
27   ' \
28   "$(HTML "$REQUEST_URI")" \
29   "$(COOKIE pagesize |grep -m1 -xE '[0-9]+' || printf 50)" \
30   "$(COOKIE fakemp4 |grep -m1 -qx yes && printf checked)"
31 }