From: Matthew Kousoulas Date: Mon, 21 Jun 2021 12:52:46 +0000 (-0400) Subject: Initial Commit X-Git-Url: http://gitweb.madkous.net/?a=commitdiff_plain;h=dd32fe1e62c68738d4cfcddd5ab5c3b671712ce5;p=photo-site.git Initial Commit --- dd32fe1e62c68738d4cfcddd5ab5c3b671712ce5 diff --git a/CSVtoJSON.awk b/CSVtoJSON.awk new file mode 100644 index 0000000..d6dd0ed --- /dev/null +++ b/CSVtoJSON.awk @@ -0,0 +1,32 @@ +BEGIN{ + FS=":" + ORS="" + getline #parse header + for(i=1;i<=NF;i++) + { + fields[i]=($i) + } + print "{\"photos\":[" +} +{ + print "{" + for(i=1;i<=NF;i++) + { + vals[i][$i]=($i) + printf "\"%s\":\"%s\"%s",fields[i],($i),(i == NF ? "" : ",") + } + printf "}," +} +END{ + print "]," + for(i=1;i<=NF;i++) + { + printf "\"%s\":[",fields[i] + for(v in vals[i]) + { + printf "\"%s\",",v + } + printf "]," + } + print "}\n" +} diff --git a/CSVtoJSON.sh b/CSVtoJSON.sh new file mode 100755 index 0000000..99d7a4e --- /dev/null +++ b/CSVtoJSON.sh @@ -0,0 +1,2 @@ +#!/bin/sh +awk -f CSVtoJSON.awk pictures.csv | sed -E 's/,(]|})/\1/g' > pictures.json diff --git a/driver.js b/driver.js new file mode 100644 index 0000000..67432aa --- /dev/null +++ b/driver.js @@ -0,0 +1,143 @@ +// (() => { +"use strict"; +const methods = [ "loc", "date", "sub" ]; +let up_dom, photo_dom; +// pointers to