summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/page.tmpl26
-rw-r--r--templates/time.md1
2 files changed, 19 insertions, 8 deletions
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 <TMPL_VAR MTIME>
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 @@
+<span class="time-overlay" data-start="<TMPL_VAR startutc>" data-end="<TMPL_VAR endutc>"><TMPL_VAR time></span>