forked from SuperBlueEyeBall/Old-GmingRealm-Repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamplegameloader.js
167 lines (163 loc) · 5.7 KB
/
examplegameloader.js
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
if (!window.top.location.href.startsWith("https://skybase-alpha.github.io/")) {
document.querySelector("title").innerHTML = "Google";
function hidey() {
var theURL = prompt(
"Please enter a URL to show in your history instead of Shadow's Games\r\nMake sure to include https:// or http://\r\nLeave blank for Google Classroom"
);
var tabBar = prompt(
"Please select a tab disguise by typing the corresponding letter\r\nLeave blank for Google Classroom\r\nc - Google Classroom\r\ng - Google\r\nb - Blank\r\nt - Custom"
);
if (tabBar !== "c" && tabBar !== "g" && tabBar !== "t" && tabBar !== "b") {
var tabIcon = "https://ssl.gstatic.com/classroom/favicon.png";
var tabName = "Classes";
} else if (tabBar == "c") {
var tabIcon = "https://ssl.gstatic.com/classroom/favicon.png";
var tabName = "Classes";
} else if (tabBar == "g") {
var tabIcon = "https://google.com/favicon.ico";
var tabName = "Google";
} else if (tabBar == "t") {
var tabIcon = prompt("URL for icon:");
var tabName = prompt("Tab Name");
} else if (tabBar == "" || tabBar == null) {
var tabIcon = "https://ssl.gstatic.com/classroom/favicon.png";
var tabName = "Classes";
} else if (tabBar == "b") {
var tabIcon =
"https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Antonia_Sautter_Creations.png/120px-Antonia_Sautter_Creations.png";
var tabName = "‎";
}
function inFrame() {
try {
return window.self !== window.top;
} catch (e) {
return !0;
}
}
if (1 != inFrame()) {
var a = window.open("about:blank", "_blank");
a.document.documentElement.innerHTML =
"<!DOCTYPE html><html><title>" +
tabName +
'</title><link rel="icon" type="image/png" href=' +
tabIcon +
'><style>body {margin:0;}</style><body><iframe height="100%" width="100%" src="' +
window.location.href +
'"frameborder="0" allowfullscreen></iframe></body></html>';
if (theURL == "" || theURL == null) {
window.location.replace("https://classroom.google.com/h");
} else {
window.location.replace(theURL);
}
}
}
} else {
alert("this site is poopoo");
window.close();
}
function gameHide(gamePath) {
var a = window.open("about:blank", "_blank");
a.document.documentElement.innerHTML =
"<!DOCTYPE html><html><title>" +
tabName +
'</title><link rel="icon" type="image/png" href=' +
tabIcon +
'><style>body {margin:0;}</style><body><iframe height="100%" width="100%" src="' +
gamePath +
'"frameborder="0" allowfullscreen></iframe></body></html>';
}
var gamesText = `{
"games":[
{
"name":"Example #1",
"img":"img/coolcustom.png",
"path":"/"
},
{
"name":"Example #2",
"img":"img/coolcustom.png",
"path":"/"
},
{
"name":"Example #3",
"img":"img/coolcustom.png",
"path":"/"
},
{
"name":"Example #4",
"img":"img/coolcustom.png",
"path":"/"
},
{
"name":"Example #5",
"img":"img/coolcustom.png",
"path":"/"
},
{
"name":"Example #6",
"img":"img/coolcustom.png",
"path":"/"
},
{
"name":"Example #7",
"img":"img/coolcustom.png",
"path":"/"
},
{
"name":"Example #8",
"img":"img/coolcustom.png",
"path":"/"
},
{
"name":"Example #9",
"img":"img/coolcustom.png",
"path":"/"
},
{
"name":"Example #10",
"img":"img/coolcustom.png",
"path":"/"
}
]
}`;
var gameObject = JSON.parse(gamesText);
for (i in gameObject.games) {
let elem1 = document.createElement("div");
elem1.className = "game-button";
document.getElementById("gameSelect").appendChild(elem1);
let elem2 = document.createElement("a");
elem2.href = gameObject.games[i].path;
elem1.appendChild(elem2);
let elem3 = document.createElement("img");
elem3.src = gameObject.games[i].img;
elem3.alt = gameObject.games[i].name;
elem2.appendChild(elem3);
let elem4 = document.createElement("p");
elem4.innerHTML = gameObject.games[i].name;
elem2.appendChild(elem4);
}
const gamesContainer = document.getElementById("gameSelect");
const searchBar = document.getElementById("search");
// Listen for input event on the search bar
searchBar.addEventListener("input", (e) => {
const query = searchBar.value.trim().toLowerCase();
// Loop through all the games in the container and show/hide them depending on whether they match the search query
for (let game of gamesContainer.children) {
if (game instanceof Element) {
if (query) {
const gameName = game.querySelector("p").innerText.trim().toLowerCase();
if (gameName.includes(query)) {
game.removeAttribute("hidden");
} else {
game.setAttribute("hidden", "");
}
} else {
game.removeAttribute("hidden");
}
}
}
});
// if (localStorage.getItem("hidden") == "y") {
// hidey();
// console.log("fff");
// }