Skip to content

Commit

Permalink
Improve JS codebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
KmolYuan committed Mar 16, 2022
1 parent d84bcd7 commit 73a5a95
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
34 changes: 16 additions & 18 deletions src/assets/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,30 +246,28 @@
Reveal.configure({keyboard: {27: "toggleOverview"}});
}

$(document).ready(() => {
Reveal.on('ready', _ => {
let top = $('.top-object').html();
if (window.location.search.match(/print-pdf/gi))
$('div.slide-background').append(top);
else
$('div.reveal').append(top);
});
Reveal.initialize({/* {%option} */
plugins: [RevealNotes, RevealSearch, RevealHighlight, RevealMath.MathJax2, RevealZoom, /* {%plugin} */],
mathjax2: {
mathjax: 'https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js',
config: 'TeX-AMS_HTML-full',
tex2jax: {
inlineMath: [['$', '$'], ['\\(', '\\)', '\\[', '\\]']],
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
}
Reveal.initialize({/* {%option} */
plugins: [RevealNotes, RevealSearch, RevealHighlight, RevealMath.MathJax2, RevealZoom, /* {%plugin} */],
mathjax2: {
mathjax: 'https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js',
config: 'TeX-AMS_HTML-full',
tex2jax: {
inlineMath: [['$', '$'], ['\\(', '\\)', '\\[', '\\]']],
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
}
});
}
}).then(() => {
// Pinned objects
if (window.location.search.match(/print-pdf/gi))
$('div.slide-background').append($('.top-object').html());
else
$('div.reveal').append($('.top-object').html());
// 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} */
});
Expand Down
2 changes: 1 addition & 1 deletion src/project/js_option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl ToHtml for JsOption {
.into_iter()
.map(|(k, j)| {
"\n".to_string()
+ &" ".repeat(12)
+ &" ".repeat(8)
+ &lower_camelcase(&k)
+ ": "
+ &j.to_html(_ctx)
Expand Down

0 comments on commit 73a5a95

Please sign in to comment.