Skip to content

Commit

Permalink
Webpage inhancement.
Browse files Browse the repository at this point in the history
  • Loading branch information
KmolYuan committed Apr 18, 2022
1 parent 4098134 commit aae8989
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions src/assets/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
top: 1em;
left: 1em;
font-size: 18pt;
opacity: 0.5;
}

.footer {
Expand Down Expand Up @@ -256,26 +257,27 @@
}).then(() => {
// Pinned objects
if (window.location.search.match(/print-pdf/gi)) {
let target = $('div.slide-background');
target.append($('.top-object'));
$('div.pdf-page').each((_, e) => $(e).append($(e).children('.chapter-header').remove()));
$('div.slide-background').append($('.top-object'));
setTimeout(function () {
$('div.pdf-page').each((_, e) => $(e).find('.slide-background').append($(e).find('.chapter-header')));
}, 1000);
} else {
let target = $('div.reveal');
target.append($('.top-object'));
target.append($(Reveal.getCurrentSlide()).children('.chapter-header').remove());
target.append($(Reveal.getCurrentSlide()).children('.chapter-header'));
Reveal.on('slidechanged', e => {
$(e.previousSlide).append(target.children('.chapter-header').remove());
target.append($(e.currentSlide).children('.chapter-header').remove());
$(e.previousSlide).append(target.children('.chapter-header'));
target.append($(e.currentSlide).children('.chapter-header'));
});
// Close button
$("#close").click(close_modal);
/* {%auto-reload} */
}
// Open external links in new windows or tabs
$('a').filter('[href^="http"], [href^="//"]')
.not('[href*="' + window.location.host + '"]')
.attr('rel', "noopener noreferrer")
.attr('target', '_blank');
// Close button
$("#close").click(close_modal);
/* {%auto-reload} */
});
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/project/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use yaml_peg::serde::Optional;
const TEMPLATE: &str = include_str!("../assets/template.html");
const RELOAD: &str = "\
let ws = new WebSocket(\"ws://\" + window.location.host + \"/ws/\");
ws.onmessage = _ => location.reload();";
ws.onmessage = _ => location.reload();";

/// Metadata contains HTML settings and global slide settings, they are totally YAML Maps.
///
Expand Down

0 comments on commit aae8989

Please sign in to comment.