-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.html
82 lines (73 loc) · 3.25 KB
/
home.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html>
<head>
<title>Projected Love</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/themes/prism-okaidia.min.css" />
<style>
html, body, pre {
background-color: #000000 !important;
color: #F8F8F2;
font-family: 'Courier New', Courier, monospace;
font-size: 14px;
margin: 0;
padding: 0;
overflow: hidden !important;
}
pre {
tab-size: 4;
}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/themes/prism-okaidia.min.css" />
</head>
<body>
<pre><code id="code" class="language-python"></code></pre>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/components/prism-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/components/prism-python.min.js"></script>
<script>
function typePythonCode() {
fetch('love.txt')
.then(response => response.text())
.then(data => {
const codeElement = document.getElementById('code');
const codeLines = data.split('\n');
let lineIndex = 0;
let charIndex = 0;
function typeChar() {
if (lineIndex < codeLines.length) {
const line = codeLines[lineIndex];
if (charIndex < line.length) {
codeElement.innerHTML += line.charAt(charIndex);
charIndex++;
} else {
codeElement.innerHTML += '\n'; // Preserve line breaks
lineIndex++;
charIndex = 0;
}
// Simulate human typing speed
const typingSpeeds = [75, 100, 125, 150]; // milliseconds Faster:
const speed = typingSpeeds[Math.floor(Math.random() * typingSpeeds.length)];
Prism.highlightElement(codeElement);
setTimeout(typeChar, speed);
} else {
// Wait for 1 minute after typing is done, then delete the contents and start over
setTimeout(() => {
codeElement.innerHTML = '';
typePythonCode();
}, 60 * 1000); // 1 minute
}
}
typeChar();
// Scroll to bottom every 1 second
setInterval(function() {
window.scrollTo(0,document.body.scrollHeight);
}, 1000);
});
}
typePythonCode();
</script>
</body>
</html>