-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.html
40 lines (37 loc) · 1.69 KB
/
scripts.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-pK1WpvzWVBQiP0/GjnvRxV4mOb0oxFuyRxJlk6vVw146n3egcN5C925NCP7a7BY8" crossorigin="anonymous"></script>
<script type="text/javascript">
var $document = $(document);
$document.ready(function() {
//render maths with KaTeX
$('eq').map(function() {
var display = (this.getAttribute('env') == "displaymath");
katex.render(this.textContent, this, {displayMode: display, fleqn: true, throwOnError: false});
});
//add anchor links to headers and itenv/rmenv
$('.section h1, .section h2, .section h3, .section h4, .section h5').each(function() {
anchor = '#' + $(this).parent().attr('id');
$(this).addClass("hasAnchor").prepend('<a href="' + anchor + '" class="anchor"></a>');
});
$('.itenv, .rmenv, .theorem, .lemma, .corollary, .proposition, .conjecture, .definition, .example, .exercise, .hypothesis').each(function() {
if ($(this).attr('id') !== undefined) {
anchor = '#' + $(this).attr('id');
$(this).addClass("hasAnchor").prepend('<a href="' + anchor + '" class="anchor"></a>');
};
});
//customise the header
$('div.font-settings button.size-3').map(function() {
// this.setAttribute("class", "button size-2")
// if (this.innerText == "Sepia") {
// this.setAttribute("style", "display: none;");
// }
if (this.innerText == "White") {
this.innerText = "Light";
}
if (this.innerText == "Night") {
this.innerText = "Dark";
}
});
// (remove the <a> tag from the title)
// $('.book .book-header h1')[0].innerHTML = $('.book .book-header h1')[0].innerText
});
</script>