From 3ebd0fbcc8511bf682b9f4ba36e168035a5c0bed Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 22 Sep 2023 17:57:37 -0400 Subject: add devel --- templates/page.tmpl | 26 ++++++++++++++++++-------- templates/time.md | 1 + 2 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 templates/time.md (limited to 'templates') diff --git a/templates/page.tmpl b/templates/page.tmpl index 7cf2eb50..b3600e2c 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -307,18 +307,28 @@ Last edited document.querySelector('.times').querySelector('.others').style.display = 'none'; } } + if (document.querySelector('.time-overlay')) { + document.querySelectorAll('.time-overlay').forEach(function (o) { + if (o.getAttribute('title')) return; + var dateOptions = {dateStyle: 'short', timeStyle: 'short'}; + var localStart = (new Date(o.getAttribute('start'))).toLocaleString([], dateOptions); + var localEnd = (new Date(o.getAttribute('end'))).toLocaleString([], dateOptions); + o.setAttribute('title', 'Your local time: ~ ' + localStart + ' to ~ ' + localEnd); + } + } + if (document.querySelector('a[name=transcript]')) { var transcriptLink = document.createElement('a'); transcriptLink.setAttribute('href', '#transcript'); transcriptLink.textContent = 'View transcript'; -var video = document.querySelector('.mainVideo video'); -if (video) { - var resources = document.querySelector('.mainVideo video').closest('.vid').querySelector('.resources'); - var transcriptDiv = document.createElement('div'); -transcriptDiv.appendChild(transcriptLink) - if (resources) { resources.prepend(transcriptDiv); } - } -} + var video = document.querySelector('.mainVideo video'); + if (video) { + var resources = document.querySelector('.mainVideo video').closest('.vid').querySelector('.resources'); + var transcriptDiv = document.createElement('div'); + transcriptDiv.appendChild(transcriptLink) + if (resources) { resources.prepend(transcriptDiv); } + } + } var chat = document.querySelector('.chat-iframe'); if (chat) { if (chat.getAttribute('data-track')) { diff --git a/templates/time.md b/templates/time.md new file mode 100644 index 00000000..b3f3c90e --- /dev/null +++ b/templates/time.md @@ -0,0 +1 @@ + -- cgit v1.2.3