-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
54 lines (44 loc) · 1.34 KB
/
script.js
File metadata and controls
54 lines (44 loc) · 1.34 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
let vConsole = null;
const iframe = document.getElementById("game-iframe");
const launcher = document.getElementById("launcher");
const backBtn = document.getElementById("back-btn");
const searchInput = document.getElementById("search-input");
const cards = document.querySelectorAll(".launcher-card");
searchInput.addEventListener("input", (e) => {
const searchText = e.target.value.toLowerCase();
cards.forEach(card => {
const title = card.querySelector(".launcher-title").textContent.toLowerCase();
if (title.includes(searchText)) {
card.style.display = "block";
} else {
card.style.display = "none";
}
});
});
cards.forEach(card => {
card.addEventListener("click", () => {
const url = card.dataset.url;
iframe.src = url;
iframe.style.display = "block";
launcher.style.display = "none";
backBtn.style.display = "block";
if (!vConsole) {
vConsole = new window.VConsole();
}
console.log(
"%c LOADED ",
"background:#000;color:" + getComputedStyle(card).color + ";padding:2px 6px;border-radius:4px",
url
);
});
});
backBtn.addEventListener("click", () => {
iframe.style.display = "none";
iframe.src = "about:blank";
if (vConsole) {
vConsole.destroy();
vConsole = null;
}
launcher.style.display = "flex";
backBtn.style.display = "none";
});