-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
62 lines (56 loc) · 1.97 KB
/
index.html
File metadata and controls
62 lines (56 loc) · 1.97 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="css/tei.css">
<script src="js/CETEI.js"></script>
<script>
let c = new CETEI();
let behaviors = {
"tei": {
"head": function(e) {
let level = document.evaluate("count(ancestor::tei-div)", e, null, XPathResult.NUMBER_TYPE, null);
let result = document.createElement("h" + (level.numberValue>7 ? 7 : level.numberValue));
for (let n of Array.from(e.childNodes)) {
result.appendChild(n.cloneNode());
}
return result;
},
"lb": ["<br>"],
/* Insert a <p> with the content of the <pb>'s @n attribute inside it
Add a line above with CSS */
"pb": ["<p class=\"break\">$@n</p>"],
}
};
c.addBehaviors(behaviors);
function loadXML(file) {
c.getHTML5(file, function(data){
let contentDiv = document.getElementById('content');
contentDiv.innerHTML = ''; // Clear previous content
contentDiv.appendChild(data);
});
}
document.querySelectorAll('a[data-file]').forEach(link => {
link.addEventListener('click', function(event) {
event.preventDefault(); // Prevent default link behavior
let file = this.getAttribute('data-file');
loadXML(file);
});
});
c.getHTML5('data/Konde_ACDH-CH_Artikel.xml', function(data){
document.getElementsByTagName('body')[0].appendChild(data);
});
</script>
</head>
<body>
<ul>
<li><a href="#" data-file="data/Konde_ACDH-CH_Artikel.xml">Load Konde Article</a></li>
<li><a href="#" data-file="data/fpn-washington.xml">Load washington File</a></li>
<li><a href="#" data-file="data/hamlet-tei.xml">Load hamlet Files</a></li>
<!-- Add more links manually for each XML file -->
</ul>
<div id="content"></div>
</body>
</html>