Skip to content

Commit

Permalink
cleanup of website started
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreaubert committed May 14, 2024
1 parent f3196a5 commit 98cf451
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 975 deletions.
2 changes: 1 addition & 1 deletion generate_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

SITEPROD = "https://www.spinorama.org"
SITEDEV = "https://dev.spinorama.org"
CACHE_VERSION = "v2"
CACHE_VERSION = "v3"


def get_versions(filename):
Expand Down
2 changes: 1 addition & 1 deletion src/website/download.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- coding: utf-8 -*-
// A library to display spinorama charts
//
// Copyright (C) 2020-23 Pierre Aubert pierreaubert(at)yahoo(dot)fr
// Copyright (C) 2020-2024 Pierre Aubert pierreaubert(at)yahoo(dot)fr
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/website/eqs.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Anechoic EQ for loudspeakers</title>
<%include file="head.html"/>
<%include file="head_handlebars.html"/>
<script src="/js3rd/handlebars-${versions['HANDLEBARS']}${min}.js"></script>
</head>
<body>
<%include file="symbols.html"/>
Expand Down
2 changes: 1 addition & 1 deletion src/website/eqs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- coding: utf-8 -*-
// A library to display spinorama charts
//
// Copyright (C) 2020-23 Pierre Aubert pierreaubert(at)yahoo(dot)fr
// Copyright (C) 2020-2024 Pierre Aubert pierreaubert(at)yahoo(dot)fr
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 2 additions & 0 deletions src/website/graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
</head>
<body>
<%include file="nav_simple.html"/>
<!--
<%include file="graph_tip.html"/>
-->
<%! def space2url(text): return text.replace(' ', '%20') %>

<div id="visGraph" class="graph"></div>
Expand Down
2 changes: 1 addition & 1 deletion src/website/graph.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- coding: utf-8 -*-
// A library to display spinorama charts
//
// Copyright (C) 2020-23 Pierre Aubert pierreaubert(at)yahoo(dot)fr
// Copyright (C) 2020-2024 Pierre Aubert pierreaubert(at)yahoo(dot)fr
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
32 changes: 0 additions & 32 deletions src/website/head.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,8 @@
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="manifest" href="/manifest.json">
<link rel="stylesheet" href="/css/bulma-${versions['BULMA']}.min.css">
<link media="all" href="/css/spinorama.css" rel="stylesheet" crossorigin="anonymous">
<link rel="icon" type="image/png" href="/pictures/favicon-16x16.png" sizes="16x16">

<script type="module" src="/js/onload-${versions['CACHE']}${min}.js"></script>

<script type="module">
import {Workbox} from "/js3rd/workbox-window-${versions['WORKBOX']}${min}.js";

if ('serviceWorker' in navigator) {
const wb = new Workbox('/sw.js');

wb.addEventListener('activated', event => {
if (!event.isUpdate) {
console.log('Service worker activated for the first time!');
}
});

wb.addEventListener('waiting', event => {
console.log(
`A new service worker has installed, but it can't activate` +
`until all tabs running the current version have fully unloaded.`);
});

wb.addEventListener('message', event => {
if (event.data.type === 'CACHE_UPDATED') {
const {updatedURL} = event.data.payload;
console.log('A newer version of '+updatedURL+' is available!');
}
});

wb.register();
}
</script>


2 changes: 0 additions & 2 deletions src/website/head_handlebars.html
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
<!-- going away step by step -->
<script src="/js3rd/handlebars-${versions['HANDLEBARS']}${min}.js"></script>

19 changes: 10 additions & 9 deletions src/website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@
<body>
<%include file="symbols.html"/>
<%include file="nav_search.html"/>
<%include file="nav_counters.html"/>
<%namespace name="util" module="website.utils" import="*"/>

<div class="section">
<div class="searchresults">
<div class="grid is-col-min-12 column-gap-0 row-gap-1" id="speakers" data-num="0">
</div>
<div class="container">
<div class="section">
<div class="searchresults">
<div class="grid is-col-min-12 column-gap-0 row-gap-1" id="speakers" data-num="0">
</div>
</div>
</div>
</div>
<div class="section">
<div id="pagination">
<div class="section">
<div id="pagination">
</div>
</div>
</div>

<script type="module" src="/js/index-${versions['CACHE']}${min}.js"></script>

<%include file="search.html"/>
Expand Down
24 changes: 14 additions & 10 deletions src/website/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

/*eslint no-undef: "error"*/

const flagCounters = false;

import { getMetadataHead, getMetadataTail } from '/js/download-${versions["CACHE"]}${min}.js';
import {
getPrice,
Expand Down Expand Up @@ -149,7 +151,7 @@ function contextHtml(context) {
const footer = footerHtml(context.id, context.reviews.reviews);
const html = `
<div class="cell">
<div class="card card-min">
<div class="card card-min has-background-white-ter">
<div class="card-image">
<figure class="image is-2by3">
<picture>
Expand Down Expand Up @@ -247,18 +249,20 @@ getMetadataHead()
// now that we have all the data
setupEventListener(metadata, printSpeaker, speakerContainer);
// moved after the main display of speakers to minimise reflow
const speakerCount = document.querySelector('#speakerCount p:nth-child(2)');
const measurementCount = document.querySelector('#measurementCount p:nth-child(2)');
const brandCount = document.querySelector('#brandCount p:nth-child(2)');
const reviewCount = document.querySelector('#reviewCount p:nth-child(2)');
speakerCount.innerHTML = metadata.size;
measurementCount.innerHTML = getMeasurementCount(metadata);
brandCount.innerHTML = getBrandCount(metadata);
reviewCount.innerHTML = getReviewCount();
if (flagCounters) {
const speakerCount = document.querySelector('#speakerCount p:nth-child(2)');
const measurementCount = document.querySelector('#measurementCount p:nth-child(2)');
const brandCount = document.querySelector('#brandCount p:nth-child(2)');
const reviewCount = document.querySelector('#reviewCount p:nth-child(2)');
speakerCount.innerHTML = metadata.size;
measurementCount.innerHTML = getMeasurementCount(metadata);
brandCount.innerHTML = getBrandCount(metadata);
reviewCount.innerHTML = getReviewCount();
}
// display if not done above
const url = new URL(window.location);
if (url.pathname !== '' && url.pathname !== 'index.html') {
display(metadata, printSpeaker, speakerContainer);
display(metadata, printSpeaker, speakerContainer);
}
pagination(metadata.size);
})
Expand Down
2 changes: 1 addition & 1 deletion src/website/meta.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- coding: utf-8 -*-
// A library to display spinorama charts
//
// Copyright (C) 2020-23 Pierre Aubert pierreaubert(at)yahoo(dot)fr
// Copyright (C) 2020-2024 Pierre Aubert pierreaubert(at)yahoo(dot)fr
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion src/website/misc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- coding: utf-8 -*-
// A library to display spinorama charts
//
// Copyright (C) 2020-23 Pierre Aubert pierreaubert(at)yahoo(dot)fr
// Copyright (C) 2020-2024 Pierre Aubert pierreaubert(at)yahoo(dot)fr
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 2 additions & 0 deletions src/website/nav_menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<span class="is-size-5 ml-2">Home</span>
</div>
</a>
<!--
<a class="dropdown-item" href="/eqs.html">
<div class="has-icons-left">
<span class="icon is-left">
Expand All @@ -14,6 +15,7 @@
<span class="is-size-5 ml-2">EQs</span>
</div>
</a>
-->
<a class="dropdown-item" href="/compare.html">
<div class="has-icons-left">
<span class="icon is-left">
Expand Down
2 changes: 1 addition & 1 deletion src/website/onload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// -*- coding: utf-8 -*-
// A library to display spinorama charts
//
// Copyright (C) 2020-23 Pierre Aubert pierreaubert(at)yahoo(dot)fr
// Copyright (C) 2020-2024 Pierre Aubert pierreaubert(at)yahoo(dot)fr
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
Loading

0 comments on commit 98cf451

Please sign in to comment.