-
Notifications
You must be signed in to change notification settings - Fork 0
/
newheader.html
68 lines (63 loc) · 1.8 KB
/
newheader.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<title>niplav</title>
<link rel="shortcut icon" type="image/png" href="./favicon.png">
<link rel="stylesheet" type="text/css" href="main.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!DOCTYPE HTML>
<html class="mathjax">
<style TYPE="text/css">
code.has-jax {font: inherit; font-size: 100%; background: inherit; border: inherit;}
</style>
<script type="text/x-mathjax-config">
window.MathJax={
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$', '$$'], ['\\[', '\\]']],
processEscapes: true,
autoload {
color: [],
colorv2: ['color']
},
packages: {'[+]': ['noerrors']}
},
options: {
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process'
},
loader: {
load: ['input/asciimath', '[tex]/noerrors']
}
};
</script>
<script id="MathJax-script" async src="./mathjax/tex-mml-chtml.js"></script>
<script>
var anchorhash={}
function addAnchor(element) {
var cnt=element.textContent
if(cnt==="home")
return;
var ref=element.textContent.replace(/[^a-zA-Z0-9 ]/mg, "")
ref=ref.replace(/ /mg, "-")
var newref=ref;
if(anchorhash[ref]===1)
for(i=1, newref=ref+"_"+i;anchorhash[ref+"_"+i]===1;i++, newref=ref+"_"+i)
;
ref=newref
element.setAttribute("id", `${ref}`)
element.innerHTML=`<a href="#${ref}" class="hanchor">${cnt}</a>`
anchorhash[ref]=1
}
document.addEventListener('DOMContentLoaded', function () {
// Add anchor links to all headings
var headers = document.querySelectorAll('h1, h2, h3, h4, h5, h6')
if (headers) {
headers.forEach(addAnchor)
}
// Change the title to the h1 header
var title = document.querySelector('h1')
if(title) {
var title_elem = document.querySelector('title')
title_elem.textContent=title.textContent + " – niplav"
}
});
</script>