]> git.plutz.net Git - clickslide/commitdiff
use checkbox hack for cleaner item uncovering
authorPaul Hänsch <paul@plutz.net>
Wed, 20 Feb 2019 12:24:29 +0000 (13:24 +0100)
committerPaul Hänsch <paul@plutz.net>
Wed, 20 Feb 2019 12:24:29 +0000 (13:24 +0100)
clickslide.css [moved from autoslide.css with 75% similarity]
clickslide.sh [moved from autoslide.sh with 61% similarity]
example.short

similarity index 75%
rename from autoslide.css
rename to clickslide.css
index 34ba18073ec9b506605a022b01e90d30d1b13fc8..e5452086ffeb458a87983499391b2443e7601e3f 100644 (file)
@@ -4,6 +4,7 @@
 }
 
 body {
 }
 
 body {
+  font-family: sans-serif;
   padding: 2em 1em 6em 1em;
   background-color: #555;
   text-align: center;
   padding: 2em 1em 6em 1em;
   background-color: #555;
   text-align: center;
@@ -85,7 +86,6 @@ a.nextslide {
   display: inline-block;
   position: relative;
   vertical-align: top;
   display: inline-block;
   position: relative;
   vertical-align: top;
-  #margin-left: 2em;
   font-size: 6pt;
   width: 20em; line-height: 15em;
   color: rgba(0, 0, 0, 0);
   font-size: 6pt;
   width: 20em; line-height: 15em;
   color: rgba(0, 0, 0, 0);
@@ -96,9 +96,9 @@ div.slide:nth-of-type(1) { margin-right: .5em; }
 /* ==== Slide Appearance ==== */
 
 div.slide {
 /* ==== Slide Appearance ==== */
 
 div.slide {
-  padding: 0 1em;
-  background-color: #FFF;
+  background: #FFF no-repeat center;
   text-align: center;
   text-align: center;
+  line-height: 1.5em;
 }
 
 div.slide:after {
 }
 
 div.slide:after {
@@ -115,19 +115,32 @@ div.slide:after {
 }
 
 div.slide > * {
 }
 
 div.slide > * {
-  vertical-align: middle;
+  margin-top: 1em;
   text-align: left;
   text-align: left;
+  max-width: 100%;
+  z-index: 3;
 }
 
 }
 
-div.slide h1 {
-  left: 0; right: 0;
+div.slide h1, div.slide h2 {
   display: block;
   display: block;
+  background-color: #EEE;
   text-align: center;
   font-size: 1.5em;
   text-align: center;
   font-size: 1.5em;
-  background-color: #EEE;
+  margin-top: 0;
+  margin-bottom: 1em;
+  width: 100%;
+}
+
+div.slide h1 {
+  position: absolute;
+  top: 50%; left: 0; right: 0;
+  transform: translate(0, -50%);
+  padding: .5em 2em;
+  z-index: 0;
+}
+
+div.slide h2 {
   padding: .25em 1em;
   padding: .25em 1em;
-  margin-left: -1em;
-  margin-right: -1em;
 }
 
 div.slide ul,
 }
 
 div.slide ul,
@@ -142,7 +155,7 @@ div.slide:target {
   position: fixed;
   z-index: 2;
   top: 0; bottom: 0; left: 0; right: 0;
   position: fixed;
   z-index: 2;
   top: 0; bottom: 0; left: 0; right: 0;
-  width: auto; height: auto;
+  width: auto; height: 100%;
   margin: 0;
   border: none;
   font-size: 24pt;
   margin: 0;
   border: none;
   font-size: 24pt;
@@ -169,16 +182,18 @@ div.slide:target + a + a {
 :target + a + a:before { right: 0; }
 :target + a + a:before { content: '\22d9'; }
 
 :target + a + a:before { right: 0; }
 :target + a + a:before { content: '\22d9'; }
 
-:target .uncover { color: #DDD; }
-:target .uncover:hover { color: #000; }
-:target .uncover *:first-child { height: 0; }
-:target .uncover *:first-child:before,
-:target .uncover *:hover:before,
-:target .uncover *:active + *:before {
-  content: ' ';
+.uncover[type="checkbox"] + * { opacity: .2; }
+.uncover[type="checkbox"]:checked + * { opacity: 1; }
+
+.uncover[type="checkbox"] {
   position: fixed;
   position: fixed;
-  top: 0; bottom: 0;
-  left: 0; right: 0;
+  top: 0; bottom: 0; left: 0; right: 0;
+  width: 100%; height: 100%;
+  opacity: 0;
 }
 }
-:target .uncover *:hover ~ * { color: #DDD; }
-:target .uncover *:active:before { display: none; }
+
+.uncover[type="checkbox"] + * + .uncover[type="checkbox"] { display: none; }
+.uncover[type="checkbox"]:checked + * + .uncover[type="checkbox"] { display: inline; }
+.uncover[type="checkbox"]:checked + * + .uncover[type="checkbox"]:checked,
+.uncover[type="checkbox"]:checked { display: none; }
+
similarity index 61%
rename from autoslide.sh
rename to clickslide.sh
index ead295b3dcf14a524345c2923369962cc041674a..ddc94c37ef79e44753e54fc71b670f1aef45d0f2 100755 (executable)
@@ -1,8 +1,10 @@
 #!/bin/sh
 
 prev='' next='' idoff=0
 #!/bin/sh
 
 prev='' next='' idoff=0
+depth=0 ucdepth=-1
 
 
-"${0%/*}"/cgilite/html-sh.sed | {
+{ "${0%/*}"/cgilite/html-sh.sed || cat; } \
+| {
   line="$(line)"
   while :; do 
     tag="${tag}${line%%>*}"
   line="$(line)"
   while :; do 
     tag="${tag}${line%%>*}"
@@ -22,6 +24,13 @@ prev='' next='' idoff=0
     fi
   
     case $tag in
     fi
   
     case $tag in
+      *\<head\>*|\*\<head\ *\>)
+        printf '%s<meta name="viewport" content="width=device-width">
+                <style type="text/css"><!--\n' "${tag%${tag#*<head*>}}"
+        cat "${0%/*}/clickslide.css"
+        printf '\n--></style>%s' "${tag#*<head*>}"
+        tag='' depth=$((depth + 1))
+        ;;
       *\<slide\ *id=\"?*\"*\>*)
         prev="$next"
         next="${tag#*<slide }" next="${next#*id=\"}" next="${next%\"*}"
       *\<slide\ *id=\"?*\"*\>*)
         prev="$next"
         next="${tag#*<slide }" next="${next#*id=\"}" next="${next%\"*}"
@@ -29,7 +38,7 @@ prev='' next='' idoff=0
         idoff="$((idoff + 1))"
         printf '%s<a class="nextslide" href="#%s">next</a><div class="slide" count="%i" id="%s" %s' \
           "${tag%<slide *}" "$next" "$idoff" "$next" "${tag#*<slide }"
         idoff="$((idoff + 1))"
         printf '%s<a class="nextslide" href="#%s">next</a><div class="slide" count="%i" id="%s" %s' \
           "${tag%<slide *}" "$next" "$idoff" "$next" "${tag#*<slide }"
-        tag=''
+        tag='' depth=$((depth + 1))
         ;;
       *\<slide\ *\>*|*\<slide\>*)
         prev="$next"
         ;;
       *\<slide\ *\>*|*\<slide\>*)
         prev="$next"
@@ -37,27 +46,39 @@ prev='' next='' idoff=0
         idoff="$((idoff + 1))"
         printf '%s<a class="nextslide" href="#%s">next</a><div class="slide" count="%i" id="%s" %s' \
           "${tag%<slide*}" "$next" "$idoff" "$next" "${tag#*<slide}"
         idoff="$((idoff + 1))"
         printf '%s<a class="nextslide" href="#%s">next</a><div class="slide" count="%i" id="%s" %s' \
           "${tag%<slide*}" "$next" "$idoff" "$next" "${tag#*<slide}"
-        tag=''
+        tag='' depth=$((depth + 1))
         ;;
       *\</slide\>*)
         printf '%s</div><a class="prevslide" href="#%s">previous</a>%s' \
           "${tag%</slide>*}" "$prev" "${tag#*</slide>}"
         ;;
       *\</slide\>*)
         printf '%s</div><a class="prevslide" href="#%s">previous</a>%s' \
           "${tag%</slide>*}" "$prev" "${tag#*</slide>}"
-        tag=''
+        tag='' depth=$((depth - 1))
         ;;
       *\<*class=\"uncover\"*\>*)
         ;;
       *\<*class=\"uncover\"*\>*)
-        printf '%s<span></span>' "$tag"
-        tag=''
+        #printf '%s<li></li>' "$tag"
+        printf '%s' "$tag"
+        tag='' depth=$((depth + 1))
+        ucdepth=$depth
         ;;
       *\<body*\>*)
         printf '%s<a href="#" class="toplevel">overview</a>' "$tag"
         ;;
       *\<body*\>*)
         printf '%s<a href="#" class="toplevel">overview</a>' "$tag"
-        tag=''
+        tag='' depth=$((depth + 1))
         ;;
       *\</body*\>*)
         printf '<span class="count">%i</span>%s' "$idoff" "$tag"
         ;;
       *\</body*\>*)
         printf '<span class="count">%i</span>%s' "$idoff" "$tag"
-        tag=''
+        tag='' depth=$((depth - 1))
         ;;
         ;;
-      *\<*\>*)
+      *\</*\>*)
         printf %s "$tag"
         printf %s "$tag"
+        tag='' depth=$((depth - 1))
+        [ $depth -lt $ucdepth ] && ucdepth=-1
+        ;;
+      *\<*\>*)
+        if [ $ucdepth = $depth ]; then
+          printf '%s<input type="checkbox" class="uncover"/><%s' "${tag%<*}" "${tag#*<}"
+        else
+          printf %s "$tag"
+        fi
+        [ "${tag}" = "${tag%/>}" ] && depth=$((depth + 1))
         tag=''
         ;;
       *) :
         tag=''
         ;;
       *) :
index b19c6e32006c524ebce54a61f3e80f114a542490..0d903687d74528b3f41ce5b01f35868f5d7ef156 100644 (file)
@@ -1,8 +1,6 @@
 [!DOCTYPE HTML]
 [html [head
 [!DOCTYPE HTML]
 [html [head
-  [meta name="viewport" content="width=device-width"]
   [title Demo]
   [title Demo]
-  [link rel="stylesheet" type="text/css" href="autoslide.css"]
 ][body
   [footer Paul Hänsch | Linux-Grundkurs | VHS&nbsp;Chemnitz]
   [slide
 ][body
   [footer Paul Hänsch | Linux-Grundkurs | VHS&nbsp;Chemnitz]
   [slide
     giraffe sabertooth kitten vegetarian
   ]
   [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]]
     giraffe sabertooth kitten vegetarian
   ]
   [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]]
-  [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]]
-  [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]]
-  [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]]
-  [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]]
-  [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]]
-  [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]] [slide [h1 Slide]]
 ]]
 ]]