Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
DazaSeal
GitHub Repository: DazaSeal/Lunanom
Path: blob/master/public/index.js
334 views
1
const form = document.querySelector('form');
2
const input = document.querySelector('input');
3
4
form.addEventListener('submit', async event => {
5
event.preventDefault();
6
window.navigator.serviceWorker.register('./sw.js', {
7
scope: __uv$config.prefix
8
}).then(() => {
9
let url = input.value.trim();
10
if (!isUrl(url)) url = 'https://www.google.com/search?q=' + url;
11
else if (!(url.startsWith('https://') || url.startsWith('http://'))) url = 'http://' + url;
12
13
14
window.location.href = __uv$config.prefix + __uv$config.encodeUrl(url);
15
});
16
});
17
18
function isUrl(val = '') {
19
if (/^http(s?):\/\//.test(val) || val.includes('.') && val.substr(0, 1) !== ' ') return true;
20
return false;
21
};
22
23
function loadMario() {
24
window.location.replace('g4mescreen/supermario64.html');
25
}
26
27
function loadFireboyWatergirl() {
28
window.location.replace('g4mescreen/fbwg.html');
29
}
30
function myFunction() {
31
var x = document.getElementById("myTopnav");
32
if (x.className === "topnav") {
33
x.className += " responsive";
34
} else {
35
x.className = "topnav";
36
}
37
}
38
function showTime(){
39
var date = new Date();
40
var h = date.getHours(); // 0 - 23
41
var m = date.getMinutes(); // 0 - 59
42
var s = date.getSeconds(); // 0 - 59
43
var session = "AM";
44
45
if(h == 0){
46
h = 12;
47
}
48
49
if(h > 12){
50
h = h - 12;
51
session = "PM";
52
}
53
54
h = (h < 10) ? "0" + h : h;
55
m = (m < 10) ? "0" + m : m;
56
s = (s < 10) ? "0" + s : s;
57
58
var time = h + ":" + m + ":" + s + " " + session;
59
document.getElementById("MyClockDisplay").innerText = time;
60
document.getElementById("MyClockDisplay").textContent = time;
61
62
setTimeout(showTime, 1000);
63
64
}
65
66
67
showTime();
68