s4

changeset 502:46a8da2740d9

Add CheckBox WikiStyle notation "- [ ]"
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 12 Jan 2019 14:26:46 +0900
parents f877fc7e2835
children 5119c19d15b5
files examples/common/default/default.css s4-funcs.sh
diffstat 2 files changed, 39 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/examples/common/default/default.css	Fri Nov 16 07:50:16 2018 +0900
     1.2 +++ b/examples/common/default/default.css	Sat Jan 12 14:26:46 2019 +0900
     1.3 @@ -202,6 +202,33 @@
     1.4      display: inline;}
     1.5  div.foldtabs p {margin: 0;}
     1.6  
     1.7 +/* ToDo List CheckBox inspired by https://cultureacademia.jp/webcreate/303/ */
     1.8 +input.s4-checkbox {display: none;}	/* Do not show real checkbox */
     1.9 +input.s4-checkbox + label {
    1.10 +    position: relative; padding-left: 0.8em; margin-right: 1em;
    1.11 +}
    1.12 +input.s4-checkbox + label:before,
    1.13 +input.s4-checkbox + label:after {
    1.14 +    content: ""; display: block;	/* Mimic Checkbox by absolute box */
    1.15 +    position: absolute; top: 0; left: 0; margin: 0;
    1.16 +}
    1.17 +input.s4-checkbox + label:before {		/* checkbox frame */
    1.18 +    width: 0.8em; height: 0.8em; border: 1px solid #aaa; border-radius: 20%;
    1.19 +}
    1.20 +input.s4-checkbox:checked + label:before {	/* checked frame bg */
    1.21 +    background: pink;
    1.22 +}
    1.23 +input.s4-checkbox:checked + label {		/* checked text */
    1.24 +    /* text-shadow: red 1px 1px;	*/
    1.25 +}
    1.26 +input.s4-checkbox:checked + label:after {	/* checked mark */
    1.27 +    width: 0.6em; height: 0.4em; top: 0.05em; left: 0.1em;
    1.28 +    border-bottom: 3px solid navy;
    1.29 +    border-left: 3px solid navy;
    1.30 +    transform: rotate(-40deg);
    1.31 +}
    1.32 +/* ---------------------------------------------------- */
    1.33 +
    1.34  div.dumptable {max-height: 15em; overflow: auto;}
    1.35  div.dumptable tr:hover {background-color: #fee;}
    1.36  table.dumpblogs td,
     2.1 --- a/s4-funcs.sh	Fri Nov 16 07:50:16 2018 +0900
     2.2 +++ b/s4-funcs.sh	Sat Jan 12 14:26:46 2019 +0900
     2.3 @@ -476,6 +476,9 @@
     2.4    #   **Word**		- <strong>Word</strong>
     2.5    #   __Word__		- <strong>Word</strong>
     2.6    #   SPC+SPC+$		- <br>
     2.7 +  cb='<input type="checkbox" class="s4-checkbox" disabled'
     2.8 +  checkboxON="${cb} checked>"
     2.9 +  checkboxOFF="${cb}>"
    2.10    _hrefptn="[-A-Za-z0-9,.:;/~_%#&+?=@!]*"
    2.11    _hrefptn="[A-Za-z0-9/~%+?=@!.][^][()<> ]*"	# URL should start with ASCII
    2.12    sed -e "s|\[\[\#\([0-9][0-9]*\)\]\]|<a href=\"?aid\1\">#\1</a>|g" \
    2.13 @@ -497,7 +500,10 @@
    2.14        -e 's, __\([^_ |][^_]*[^ ]\)__ ,<strong>\1</strong>,g' \
    2.15        -e 's, \*\([^* |][^*|]*[^ |]\)\* ,<em>\1</em>,g' \
    2.16        -e 's, _\([^_ ][^_]*[^ ]\)_ ,<em>\1</em>,g' \
    2.17 -      -e 's,  $,<br>,'
    2.18 +      -e 's,  $,<br>,' \
    2.19 +      -e "s,- \[  *\]\([^|-]*\),${checkboxOFF}<label>\\1</label>,g" \
    2.20 +      -e "s,- \[[^ ]\]\([^|-]*\),${checkboxON}<label>\\1</label>,g" \
    2.21 +      
    2.22  }
    2.23  minitbl() {
    2.24    sed -n '
    2.25 @@ -1150,15 +1156,15 @@
    2.26    if [ -z "$dbuser" ]; then
    2.27      return 1
    2.28    elif [ x"$pswd" = x"wasureta" ]; then
    2.29 -    wasureta $user
    2.30 +    wasureta "$user"
    2.31      return 1		# wasureta error
    2.32    fi
    2.33   # dbpswd="`sq $db \"select pswd from passwd where name='$user'\"`"
    2.34    # putheader; echo; echo user=$user, db=$dbpswd, enc=$encpswd
    2.35    if pwcheck "$pswd"; then
    2.36      newsession=`genrandom 50`
    2.37 -    dbsetbyid user $user skey "$newsession"
    2.38 -    dbsetbyid user $user login "`date '+%F %T'`"
    2.39 +    dbsetbyid user "$user" skey "$newsession"
    2.40 +    dbsetbyid user "$user" login "`date '+%F %T'`"
    2.41      gencookie "user=$user" "skey=$newsession"
    2.42      return 0
    2.43    fi
    2.44 @@ -1367,8 +1373,8 @@
    2.45  }
    2.46  invite() {
    2.47    email=`getpar email`
    2.48 -  case $email in
    2.49 -    *@*@*)  repo="無効なアドレスです" ;;
    2.50 +  case "$email" in
    2.51 +    *@*@*|*\ *)  repo="無効なアドレスです" ;;
    2.52      *@*)
    2.53        local=${email%@*} domain=${email#*@}
    2.54        if ! repo=`emaildomaincheck $email`; then