Skip to content

Commit 52dca67

Browse files
committed
Add a mode for presentation viewer with no video/slides sync but still slide-based navigation
Useful for one of the new presentations
1 parent 93609da commit 52dca67

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

_layouts/talk.html

+22-7
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,20 @@ <h2>{{page.title}} - by {{page.author}}{% if page.affiliation %} ({{page.affilia
5252
{% assign path = "../" %}
5353
<main>
5454
{% include related-issues/{{shortname}}.html %}
55-
<form id="form">
56-
{% if page.slidesurl %}
55+
{% assign videoSync = false %}
56+
{% if page.slidesurl %}
57+
{% assign videoSync = true %}
58+
{% endif %}
59+
{% if page.nosync == true%}
60+
{% assign videoSync = false %}
61+
{% endif %}
62+
63+
<form id="form" {% if videoSync %}{% else if page.slidesurl %}class="videonav"{% endif %}>
64+
{% if videoSync %}
5765
<input type="checkbox" name="sync" id="sync"><label for="sync" class="button">Sync video and hide transcript
5866
<a href="https://www.w3.org/2020/05/AC/talk-help.html" rel=help title="Help" class="picto im-question"></a></label>&nbsp;
59-
67+
{% endif %}
68+
{% if page.slidesurl %}
6069
<a class="picto im-angle-up button" id="align" href="#align" title="Align to top of window"></a>&nbsp;
6170
<span id="prevnext" aria-label="Slide navigation controls" role="navigation">
6271
<a id="firstslide" href="#firstslide" title="First slide" class="button" role="button">1st</a>
@@ -78,10 +87,16 @@ <h2>{{page.title}} - by {{page.author}}{% if page.affiliation %} ({{page.affilia
7887
"uploadDate": "2020-08-17T13:00:00+02:00",
7988
"duration": "{{page.duration_so}}",
8089
"embedUrl": "{{page.videourl}}"}
81-
</script>
82-
83-
<div {% if page.slidesurl %}id="video1"{%endif%}><iframe id="video" title="video of ‘{{page.title}} by {{page.author}}" src="{{page.videourl}}" allow="accelerometer; autoplay; encrypted-media;
84-
picture-in-picture" allowfullscreen="" {% if page.slidesurl %}width="640" height="360"{% else %}height=400 class=fw {% endif %} frameborder="0"></iframe></div>
90+
</script>
91+
<div {% if videoSync %}id="video1"{%endif%}><iframe id="video" title="video of ‘{{page.title}} by {{page.author}}" src="{{page.videourl}}" allow="accelerometer; autoplay; encrypted-media;
92+
picture-in-picture" allowfullscreen="" {% if videoSync %}width="640" height="360"{% else %}height=400 class=fw {% endif %} frameborder="0"></iframe></div>
93+
{% if page.nosync == true %}
94+
<p id=caption>
95+
<output id=cue aria-live=off>
96+
<noscript>(Synchronization requires JavaScript)</noscript>
97+
</output>
98+
</p>
99+
{% endif %}
85100
{% if page.slidesurl %}
86101
<output id="slidenr" aria-live="polite"><a href="#start">Slide 1 of 40</a></output>
87102

_tools/generate_talk_pages.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ shortname: ${shortname}
6565
thumbnailurl: ${talk.thumbnail}
6666
videourl: ${talk.video}
6767
slidesurl: ${slidesurl}
68-
prevlink: ${prevlink}
68+
` + (talk.nosync ? `nosync: ${talk.nosync}\n` : '') +
69+
`prevlink: ${prevlink}
6970
prevtitle: "${prevtitle}"
7071
nextlink: ${nextlink}
7172
nexttitle: "${nexttitle}"

presentation-viewer.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@
9898
visibility: hidden}
9999
#sync:checked ~ #player .slide.active {position: relative;
100100
visibility: visible}
101-
#sync:checked ~ #prevnext {display: inline}
101+
.videonav #prevnext, #sync:checked ~ #prevnext {display: inline}
102102
#sync:checked ~ #player #slides > *:not(.slide) {display: none}
103-
#sync:checked ~ #player #caption {display: block}
103+
.videonav #player #caption, #sync:checked ~ #player #caption {display: block}
104104

105105
/* ... and only the active elements of incremental display. */
106106
#sync:checked ~ #player .next {visibility: hidden}

presentation-viewer.js

+4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@
7777
// activate -- deactivate the current element and activate the new one
7878
function activate(new_index)
7979
{
80+
if (!syncelts[current]) {
81+
announce(new_index);
82+
return;
83+
}
8084
if (new_index < current) {
8185

8286
// Deactivate the old current element and activate the new.

0 commit comments

Comments
 (0)