<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

		<title>Embed library</title>

		<link rel="stylesheet" href="static/css/style.css" />
		<link rel="stylesheet" href="static/reveal/dist/reset.css" />
		<link rel="stylesheet" href="static/reveal/dist/reveal.css" />
		<link id="theme" rel="stylesheet" href="static/reveal/dist/theme/sky.css" />
		<link id="nav-theme" rel="stylesheet" href="static/css/nav/sky.css" />
                <link rel="stylesheet" href=
                    "https://use.fontawesome.com/releases/v5.6.3/css/all.css"
                    integrity=
                        "sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
                        crossorigin="anonymous">
	</head>
	<body>
                <div id="custom-nav">
                  <!-- the zero-width-space is a tweak against tidy removing empty tags -->
                  <a href="/embed-editor" title="Edit"><i class="fa fa-user-edit">​</i></a>
                </div>
		<div class="reveal">
			<div class="slides">
                          {% with messages = get_flashed_messages() %}
                            {% if messages %}
				<section data-theme="solarized">
                                    {% for m in messages %}
                                      <h4>{{ m }}</h4>
                                    {% endfor %}
                                  <a href="#/latest">Continue...</a>
                                </section>
                            {% endif %}
                          {% endwith %}
				<section data-theme="sky">
				    {% for embed in embeds %}
				        <section id="{{embed.id}}">
					    <h3 class="title slide_title">{{embed.id}}</h3>
                                            <div class="scrollable">
                                                {% if embed.type == "youtube" %}
                                                    <div class="iframe-container-{{embed.proportions}}">
                                                      <iframe src="https://www.youtube.com/embed/{{ embed.code }}?controls=0{{ embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
						    </div>
                                                {% elif embed.type == "vimeo" %}
                                                    <div class="iframe-container-{{embed.proportions}}">
                                                      <iframe src="https://player.vimeo.com/video/{{ embed.code }}?title=0&amp;byline=0&amp;portrait=0{{ embed.url_extras }}" allowfullscreen="allowfullscreen"></iframe>
						    </div>
                                                {% endif %}
					        <p>{{ embed.description }}</p>
                                            </div>
                                        </section>
				    {% endfor %}
				</section>
			</div>
		</div>
		<script src="/static/reveal/dist/reveal.js"></script>
		<script src="/static/reveal/plugin/notes/notes.js"></script>
		<script src="/static/reveal/plugin/markdown/markdown.js"></script>
		<script src="/static/reveal/plugin/highlight/highlight.js"></script>
                <script src="/static/js/jquery-3.7.1.min.js"></script> 
		<script>
			// More info about initialization & config:
			// - https://revealjs.com/initialization/
			// - https://revealjs.com/config/
			Reveal.initialize({
				hash: true,
                                progress: false,
                                help: false,
                                transition: 'convex',
                                controlsBackArrows: 'visible',  // would hopefully solve the faded-arrow thing
                                // slideNumber: "h.v",
				// Learn about plugins: https://revealjs.com/plugins/
				plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
			});
                        $(function() {
                            // force autoplay for bg videos (but why?!?)
                            $('.reveal .slide-background-content video').each((index, element) => element.play());
                            // open external links in new tab
                            $('.reveal a:not([href^="#"])').attr('target','_blank');
                            // extract css classes from img alt
                            $('.reveal img').addClass("w-50 float-right");
			    // make all headers max-size
                            // $('.reveal h1, .reveal h2, .reveal h3').addClass('r-fit-text');
                            var enterSlide = function() {
                                // set theme
                                var the_slide=$(Reveal.getCurrentSlide()),
                                    the_theme=the_slide.data('theme') ||
                                        the_slide.parent().data('theme') || 'sky';
                                $('#theme').attr('href',`static/reveal/dist/theme/${the_theme}.css`);
                                $('#nav-theme').attr('href',`static/css/nav/${the_theme}.css`);
                                // set (or hide) top link
                                var here = Reveal.getIndices();
                                if (here.v) {
                                    $('#top-link').removeAttr('disabled').attr('href', `#/${here.h}`);
                                } else {
                                    $('#top-link').removeAttr('href').attr('disabled', 'disabled');
                                }
                            };
                            enterSlide();
                            Reveal.addEventListener('slidechanged', enterSlide);
                        });
		</script>
	</body>
</html>