index: add links to previous day
authorJulien Moutinho <julm@sourcephile.fr>
Sat, 18 Mar 2023 11:20:45 +0000 (12:20 +0100)
committerJulien Moutinho <julm@sourcephile.fr>
Sat, 18 Mar 2023 11:20:45 +0000 (12:20 +0100)
index.css
index.sh

index bdf79f0bd0db70c8a3ac7395a53690fa775ce32b..6b72a84749f63252585021c27926ce96cdc935e3 100644 (file)
--- a/index.css
+++ b/index.css
@@ -8,13 +8,13 @@ body {
 
 nav.path {
   position: fixed;
-  top: 0;
-  left:0;
-  width:100%;
+  bottom: 0;
+  left: 0;
+  width: 100%;
   z-index: 1;
   background-color: white;
-  border-bottom: 1px solid black;
-  padding-bottom:0.5ex;
+  border-top: 1px solid black;
+  padding-bottom: 0.5ex;
   padding-left: 1em;
   padding-right: 1em;
   font-size: 1.2rem;
@@ -22,7 +22,6 @@ nav.path {
 
 .camera {
   clear:right;
-  padding-top:2rem;
 }
 .camera > ul {
   display: grid;
@@ -82,6 +81,32 @@ nav.path {
   width: 100%;
   height: 100%;
 }
+
+
+.camera > ul > li.day {
+  grid-column: 1 / -1;
+  border-bottom: 1px solid #000;
+  font-variant: small-caps;
+  margin-top: 3ex;
+}
+.camera > ul > li.day:first-child {
+  margin-top: 0;
+}
+.camera > ul > li.day > div {
+  display: flex;
+  flex-direction: row;
+  justify-content: space-between;
+}
+.camera > ul > li.day a {
+  color: inherit;
+  text-decoration: inherit;
+}
+.camera > ul > li.day a:hover {
+  color: inherit;
+  text-decoration: inherit;
+}
+
+
 .camera > ul > li:target img,
 .camera > ul > li:target video {
   border: 1px solid blue;
index 56d84ae95d318f246f2cd5b46197bf4c57395c8e..2875e3fefddc51f2b2b198f2ae57dd06456c5eaa 100755 (executable)
--- a/index.sh
+++ b/index.sh
@@ -37,6 +37,8 @@ for dir in "$@"; do
   # cp, not ln, because in push.sh --copy-links cannot be used for by-uuid/
   cp -f --remove-destination -t fav ../../index.css
   test -d src/"$month" || { popd; continue; }
+  unset creationDoMOld
+  unset creationDateOld
   {
   genDate=$(date +%s)
   cat <<EOF
@@ -81,6 +83,19 @@ EOF
     name=${base#*/}
     id=${name%%.*}
     creationDate=$(printf %s "${src##*/???_}" | sed -e 's/\(....\)\(..\)\(..\)_\(..\)\(..\)\(..\).*/\1-\2-\3 \4:\5:\6/')
+    creationDoM=$(date +'%A %_d %B' -d "$creationDate")
+    if test "$creationDoM" != "${creationDoMOld-}"; then
+      dom=$(date +'%d' -d "$creationDate")
+      echo "<li id='$dom' class='day'><div>"
+      echo "<a class='day-current' href='#$dom'>$creationDoM</a>"
+      echo "<div>"
+      test ! "${creationDateOld:+set}" ||
+        echo "<a class='day-previous' href='#$(date +'%d' -d "$creationDateOld")'>^</a>"
+      echo "</div>"
+      echo "</div></li>"
+      creationDoMOld=$creationDoM
+      creationDateOld=$creationDate
+    fi
     test -e fav/"$base".uuid ||
     uuidgen --random >fav/"$base".uuid
     uuid=$(cat fav/"$base".uuid)
@@ -260,7 +275,7 @@ EOF
     test "${hasSrc:+set}" || {
       echo >&2 "$dir: removing $year/fav/$fav"
       rm -f fav/"$fav"
-      rm -fv fav/"$month"/by-uuid/*/"$name".{300x.avif,600x.avif,1200x.avif,avif,360p.av1.webm,uuid}
+      rm -f fav/"$month"/by-uuid/*/"$name".{1200x.avif,avif,360p.av1.webm,uuid}
     }
   done
   rmdir -p 2>/dev/null fav/"$month"/by-uuid/*/ || true