]> Git in Space - website/commitdiff
Add webring thingy to each page
authorMira Ayre <mi@boxin.space>
Sat, 5 Mar 2022 21:04:03 +0000 (21:04 +0000)
committerMira Ayre <mi@boxin.space>
Sat, 5 Mar 2022 21:07:32 +0000 (21:07 +0000)
Makefile
global.css
lib.sh
webring.js [new file with mode: 0644]

index ec53b4732cfd74bec1a3451032fcfa3c3ff40b69..88b907aa6463c5ea2989a5b3217f5b205c3047e3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -20,3 +20,6 @@ push:
 
 clean:
        rm $(FILESOUT) $(POSTSOUT) robots.txt
+
+test: site
+       python -m http.server
index a254ce33c137df05e44ab4d838423491431e8154..8803e5b84c3d542329145229e70d22dcdd203826 100644 (file)
@@ -155,6 +155,15 @@ footer {
        font-size  : min( 1em , 2.1vw ) ;
 }
 
+footer span {
+       display : inline-block ;
+       font-size : min( 1.5em , 3.1vw ) ;
+       padding-bottom : 1em ;
+}
+
+#webring-previous { float : left  ; }
+#webring-next     { float : right ; }
+
 a {
        color                      : var(--lpur)       ;
        transition                 : text-shadow 0.03s ;
diff --git a/lib.sh b/lib.sh
index 06ac933e455240f63fe355d66cd1b22de6045ce6..62851df28672fe35e40f4d4d3d3b5d033057dbe9 100644 (file)
--- a/lib.sh
+++ b/lib.sh
@@ -7,6 +7,7 @@ cat <<EOF >/dev/stdout
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link type="image/png" rel="shortcut icon" href="/img/favicon.png">
        <link type="text/css" rel="stylesheet" href="/global.css">
+       <script type="text/javascript" src="/webring.js" id="mira"></script>
 EOF
 }
 
@@ -26,6 +27,8 @@ function Title() {
 function Footer() {
 cat <<EOF >/dev/stdout
 <footer>
+       <span>This site is part of the Lavender Software webring<br>
+       <a id="webring-previous"></a><a id="webring-next"></a></span><br>
        Site content <a href="/LICENCE">CC-BY-NC-SA-4.0</a> Mira Ayre
        2021-$(date +%Y)
        (<a href="/gitweb.cgi?p=website;a=summary">view source</a>)<br>
diff --git a/webring.js b/webring.js
new file mode 100644 (file)
index 0000000..9e8b1ab
--- /dev/null
@@ -0,0 +1,23 @@
+var data = fetch( "https://lavender.software/webring/data.json" )
+       .then( function ( r ) { return r.json() ; } )
+       .then( function ( data ) {
+               console.log(data) ;
+
+               var index = -1 ;
+               for ( var i = 0 ; i < data.length ; i ++ )
+                       if ( data[i].id == "mira" )
+                               index = i ;
+
+               console.log(index) ;
+
+               if ( index >= 0 ) {
+                       var previ        = ( index - 1 + data.length ) % data.length ;
+                       var nexti        = ( index + 1 + data.length ) % data.length ;
+                       var prev         = document.getElementById( "webring-previous" ) ;
+                       var next         = document.getElementById( "webring-next"     ) ;
+                       prev.href        = data[previ].url  ;
+                       prev.textContent = "« " + data[previ].name ;
+                       next.href        = data[nexti].url       ;
+                       next.textContent = data[nexti].name + " »" ;
+               }
+       } ) ;