-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
107 lines (107 loc) · 3.58 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!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">
<title>Website I made</title>
<link rel="icon" href="/knightbot63.github.io/static/myIcon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="/knightbot63.github.io/static/home.css" />
</head>
<body onload="startTime()">
<div class="topnav">
<a href="https://knightbot63.repl.co">Knightbot63's Website</a>
<a onclick=darkMode()>Dark Mode</a>
<a href="/knightbot63.github.io/about.html">About</a>
<a href="/knightbot63.github.io/about_me.html">About Me!</a>
</div>
<h2>Welcome!</h2>
<h3 id="randomphrase">randomphrase</h3>
<h5 id="currentTime"></h5>
<br>
<br>
<br>
<br>
<br>
<br>
<h4 id="DarkModetext">Announcements/Updates:</h4>
<div class="update"><p>4/6/23: Introducing announcements! The Way to find and see updates on this website on the go! This new feature will include: Updates, Changes, and More!</p>
<p>4/7/23: This will eventually change to just HTML with no Python Flask applications.</p>
<p>4/12/23: Updated dark mode, adding other things.</p>
<p>5/1/23: Fixed a bug involving the favicon.png not appearing on most devices.</p></div>
<h4 id="DarkModetext">Follow count (scratch):</h4>
<h1 id="followcount">Loading...</h1>
<script>
function choose(choices) {
var index = Math.floor(Math.random() * choices.length);
return choices[index];
}
function httpGetAsync(theUrl, callback)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
}
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.send(null);
}
function getElementByXpath(elm, path) {
return elm.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
var randomphrase = document.getElementById("randomphrase").childNodes[0];
var followcount = document.getElementById("followcount").childNodes[0];
httpGetAsync("https://scratch.mit.edu/users/knightbot63/followers", function (out) {
var el = document.createElement( 'html' );
el.innerHTML = out;
followcount.data = el.getElementsByClassName("box-head")[0].childNodes[3].lastChild.data.match("\\((.*)\\)")[1];//getElementByXpath(el, "/html/body/div[1]/div[5]/div[2]/div[1]/h2");
});
var intervalID = window.setInterval(function() {httpGetAsync("https://scratchdb.lefty.one/v3/user/info/knightbot63", function (out) {followcount.data = JSON.parse(out).statistics.followers;});}, 5000);
randomphrase.data = choose([
"Have a good day!",
"Have fun!",
"We don't allow cookies 🥠",
"Sing",
"Did you know: no.",
"This site is 100% ok!",
"404: Error getting debug"
]);
function darkMode() {
var element = document.body;
element.classList.toggle("dark-mode");
}
window.onload = function() {
clock();
function clock() {
var text = "Time Now: ";
var now = new Date();
var TwentyFourHour = now.getHours();
var hour = now.getHours();
var min = now.getMinutes();
var sec = now.getSeconds();
var mid = 'pm';
if(sec < 10) {
sec = "0" + sec;
}
if (min < 10) {
min = "0" + min;
}
if (hour > 12) {
hour = hour - 12;
}
if (hour < 10 ) {
hour = "0" + hour;
}
if(hour==0){
hour=12;
}
if(TwentyFourHour < 12) {
mid = 'am';
}
document.getElementById('currentTime').innerHTML = text + hour+':'+min+':'+sec +' '+mid ;
setTimeout(clock, 1000);
}
}
</script>
</body>
</html>