Skip to content

Commit b47068e

Browse files
authored
fix(rtd): remove flyout in iframes (#367)
* fix(rtd): remove flyout in iframes * fix(rtd): remove dirhtml and default to html Because dirhtml seems to have issues with iframes * fix(html): correct css style
1 parent 973522a commit b47068e

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

.readthedocs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ build:
1010
post_install:
1111
- ipython kernel install --name "manim-slides" --user
1212
sphinx:
13-
builder: dirhtml
13+
builder: html
1414
configuration: docs/source/conf.py
1515
fail_on_warning: true
1616
python:

manim_slides/convert.py

+1
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ def convert_to(self, dest: Path) -> None:
416416
file_to_data_uri=file_to_data_uri,
417417
get_duration_ms=get_duration_ms,
418418
has_notes=has_notes,
419+
env=os.environ,
419420
**options,
420421
)
421422

manim_slides/templates/revealjs.html

+29-21
Original file line numberDiff line numberDiff line change
@@ -316,28 +316,36 @@
316316
hideCursorTime: {{ hide_cursor_time }}
317317
});
318318

319-
{% if data_uri %}
320-
// Fix found by @t-fritsch on GitHub
321-
// see: https://github.com/hakimel/reveal.js/discussions/3362#discussioncomment-6651475.
322-
function fixBase64VideoBackground(event) {
323-
// event.previousSlide, event.currentSlide, event.indexh, event.indexv
324-
if (event.currentSlide.getAttribute('data-background-video')) {
325-
const background = Reveal.getSlideBackground(event.indexh, event.indexv),
326-
video = background.querySelector('video'),
327-
sources = video.querySelectorAll('source');
328-
329-
sources.forEach((source, i) => {
330-
const src = source.getAttribute('src');
331-
if(src.match(/^data:video.*;base64$/)) {
332-
const nextSrc = sources[i+1]?.getAttribute('src');
333-
video.setAttribute('src', `${src},${nextSrc}`);
334-
}
335-
});
336-
}
319+
{% if data_uri -%}
320+
// Fix found by @t-fritsch on GitHub
321+
// see: https://github.com/hakimel/reveal.js/discussions/3362#discussioncomment-6651475.
322+
function fixBase64VideoBackground(event) {
323+
// event.previousSlide, event.currentSlide, event.indexh, event.indexv
324+
if (event.currentSlide.getAttribute('data-background-video')) {
325+
const background = Reveal.getSlideBackground(event.indexh, event.indexv),
326+
video = background.querySelector('video'),
327+
sources = video.querySelectorAll('source');
328+
329+
sources.forEach((source, i) => {
330+
const src = source.getAttribute('src');
331+
if(src.match(/^data:video.*;base64$/)) {
332+
const nextSrc = sources[i+1]?.getAttribute('src');
333+
video.setAttribute('src', `${src},${nextSrc}`);
334+
}
335+
});
337336
}
338-
Reveal.on( 'ready', fixBase64VideoBackground );
339-
Reveal.on( 'slidechanged', fixBase64VideoBackground );
340-
{% endif %}
337+
}
338+
Reveal.on( 'ready', fixBase64VideoBackground );
339+
Reveal.on( 'slidechanged', fixBase64VideoBackground );
340+
{%- endif %}
341341
</script>
342+
343+
{% if env['READTHEDOCS'] -%}
344+
<style>
345+
readthedocs-flyout, readthedocs-notification {
346+
display: none;
347+
}
348+
</style>
349+
{%- endif %}
342350
</body>
343351
</html>

0 commit comments

Comments
 (0)