-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
35 lines (33 loc) · 1.25 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Memory Lane</title>
</head>
<body>
<div id="content"></div>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
fetch("/README.md")
.then((response) => response.text())
.then((data) => {
document.getElementById("content").innerHTML = marked(data);
})
.then(() => {
const codeblock = document.querySelectorAll("pre");
codeblock.forEach((el) => {
el.onclick = function () {
document.execCommand("copy");
el.addEventListener("copy", function (event) {
event.preventDefault();
if (event.clipboardData) {
event.clipboardData.setData("text/plain", el.textContent);
console.log(event.clipboardData.getData("text"));
}
});
};
});
});
</script>
</body>
</html>