From 2f1ade9723eaae158731263cebc26ca4b3bb89e0 Mon Sep 17 00:00:00 2001 From: Simone Bortolin Date: Mon, 12 Dec 2022 23:08:37 +0100 Subject: Add web root script and Restore V1 Procedure (#32) * Add web root script (V3) ** Web serial, LineBreakTransformer, minimal UI ** Step 2 in fallback to avoid kernel panic ** Some new alert * Restore V1 Procedure * Minor update on V1 and V2 procedure (see #43) Co-authored-by: Ernesto Castellotti --- _layouts/default.html | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to '_layouts') diff --git a/_layouts/default.html b/_layouts/default.html index fe0aa0a..15482bb 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -270,10 +270,11 @@ layout: table_wrappers if (document.getElementById('last-modified')) { listOfScannedFilename.push("{{ page.path }}"); fetch("https://api.github.com/repos/{{ site.gh_owner_name }}/{{ site.gh_repository_name }}/commits?path={{ page.path }}") - .then((response) => { - return response.json(); - }) - .then(async function (commits) { + .then((response) => { + return response.json(); + }) + .then(async function (commits) { + try{ var date = new Date(commits[0]['commit']['committer']['date']); var modified = date.toLocaleDateString(undefined); @@ -283,7 +284,12 @@ layout: table_wrappers document.getElementById('contributors').textContent = authors.length + " " + (authors.length == 1 ? "Contributor" : "Contributors"); document.getElementById('contributors-modal-list').innerHTML = authors.map(x => "
  • " + x.name + "
  • ").join(''); - }); + } catch (err) { + document.getElementById('last-modified').textContent = "Sorry, last modified not currently available"; + document.getElementById('contributors').textContent = "Contributors"; + document.getElementById('contributors-modal-list').innerHTML = "
  • Sorry, list not currently available
  • "; + } + }); } } -- cgit v1.2.3