Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
titaniumnetwork-dev
GitHub Repository: titaniumnetwork-dev/Ludicrous
Path: blob/main/pages/games.tsx
1223 views
1
import type { NextPage } from 'next'
2
import Head from 'next/head'
3
import { IoHomeOutline, IoSettingsOutline, IoChevronDown, IoAppsOutline } from "react-icons/io5";
4
import styles from '../styles/Apps.module.css'
5
import { useRouter } from 'next/router';
6
import { useEffect } from 'react';
7
import absoluteUrl from 'next-absolute-url'
8
9
const Close: Function = () => {
10
if (global.window) {
11
if (global.window.opener) global.window.close();
12
global.window.history.go(-(global.window.history.length-1));
13
global.window.location.replace('https://www.google.com/webhp')
14
}
15
}
16
17
const g: any = global || {};
18
19
const appClicked: any = function(event: any) {
20
if (!event.nativeEvent.path) var el = event.nativeEvent.target.getAttribute('ludicrous-launch-url')?event.nativeEvent.target:event.nativeEvent.target.parentNode;
21
else var el = (event.nativeEvent.path||[]).find((e:any)=>e.classList&&e.classList.contains(styles['app']));
22
23
var app = el.getAttribute('ludicrous-launch-url');
24
25
location.href = '/route?query='+(encodeURIComponent(app));
26
}
27
28
const noAppClicked: any = function(event: any) {
29
if (!event.nativeEvent.path) var el = event.nativeEvent.target.getAttribute('ludicrous-launch-url')?event.nativeEvent.target:event.nativeEvent.target.parentNode;
30
else var el = (event.nativeEvent.path||[]).find((e:any)=>e.classList&&e.classList.contains(styles['app']));
31
32
var app = el.getAttribute('ludicrous-launch-url');
33
34
if (g.openFrame) g.openFrame(app, false);
35
history.pushState(null, '', location.pathname+'?origin='+app);
36
}
37
38
const gameClicked: any = function(event: any) {
39
if (!event.nativeEvent.path) var el = event.nativeEvent.target.getAttribute('ludicrous-launch-url')?event.nativeEvent.target:event.nativeEvent.target.parentNode;
40
else var el = (event.nativeEvent.path||[]).find((e:any)=>e.classList&&e.classList.contains(styles['app']));
41
42
var app = el.getAttribute('ludicrous-launch-url');
43
44
if (g.openFrame) g.openFrame('/gfiles/html5/'+app+'/', false, location.pathname);
45
history.pushState(null, '', location.pathname);
46
}
47
48
const upChevron: any = function() {
49
var el: any = document.getElementsByClassName(styles['down-chevron']);
50
51
if (el[0] && !el[0].style.transform) el[0].style.transform = 'rotate(180deg)'; else el[0].style.transform = '';
52
53
var e = document.getElementById(styles['main-page-content']);
54
55
if (el[0] && el[0].style.transform) {
56
if (e) e.scroll(0,1);
57
} else {
58
if (e) e.scroll(0, 0);
59
}
60
}
61
62
var times: any = 0;
63
64
const scrollListener: any = (event: any) => {
65
if (window.innerWidth<600) {return event.target.style.height = '75%'};
66
if (times>1&&window.innerWidth<600) return;
67
68
var el: any = document.getElementsByClassName(styles['down-chevron']);
69
70
if (event.target.scrollTop) {event.target.style.height = '75%'} else event.target.style.height = '';
71
72
if (el[0] && event.target.scrollTop) el[0].style.transform = 'rotate(180deg)'; else el[0].style.transform = '';
73
74
if (event.target.style.height) {
75
var d = document.getElementById('apps-header');
76
if (d) d.classList.remove(styles['apps-hidden']);
77
} else {
78
var d = document.getElementById('apps-header');
79
if (d) d.classList.add(styles['apps-hidden']);
80
}
81
82
times++;
83
}
84
85
const Games: NextPage = ({ apps, games, bookmarks, particles, origin }: any) => {
86
const Router = useRouter();
87
var win: any = global.window||{};
88
89
useEffect(() => {
90
Router.prefetch('/options');
91
Router.prefetch('/apps');
92
Router.prefetch('/');
93
94
if (global.window) {
95
(document.getElementById(styles['main-page-content'])||document.body).scrollTop = 1;
96
(document.getElementById(styles['inside-content-scroller'])||document.body).style.opacity = '1';
97
98
if (new URLSearchParams(location.search).get('origin')) {
99
if (g.openFrame) g.openFrame(new URLSearchParams(location.search).get('origin'), false);
100
}
101
}
102
});
103
104
const Home: any = () => {
105
106
if (global.window) {
107
(document.getElementById(styles['main-page-content'])||document.documentElement).scrollTop = 0;
108
109
setTimeout(function() {
110
var node: any = ((document.getElementById(styles['main-page-content'])||document.documentElement).childNodes[2]);
111
112
node.style.opacity = '0';
113
}, 250);
114
115
setTimeout(function() {
116
win.particles = particles;
117
Router.replace('/');
118
}, 400);
119
}
120
}
121
122
const Settings: any = () => {
123
if (global.window) {
124
(document.getElementById(styles['main-page-content'])||document.documentElement).scrollTop = 0;
125
126
setTimeout(function() {
127
var node: any = ((document.getElementById(styles['main-page-content'])||document.documentElement).childNodes[2]);
128
129
node.style.opacity = '0';
130
}, 250);
131
132
setTimeout(function() {
133
win.particles = particles;
134
Router.replace('/options');
135
}, 400);
136
}
137
}
138
139
const Apps: any = () => {
140
if (global.window) {
141
(document.getElementById(styles['main-page-content'])||document.documentElement).scrollTop = 0;
142
143
setTimeout(function() {
144
var node: any = ((document.getElementById(styles['main-page-content'])||document.documentElement).childNodes[2]);
145
146
node.style.opacity = '0';
147
}, 250);
148
149
setTimeout(function() {
150
win.particles = particles;
151
Router.replace('/apps');
152
}, 400);
153
}
154
}
155
156
return (
157
<div className={styles.main}>
158
<Head>
159
<meta name="description" content="Ludicrous | A School Site" />
160
<meta name="theme-color" content="#2467a5" />
161
<meta charSet='utf-8' />
162
<meta httpEquiv='X-UA-Compatible' content='IE=edge' />
163
<meta name='viewport' content='minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, viewport-fit=cover, maximum-scale=6'/>
164
<title>Ludicrous - Games</title>
165
<link rel='manifest' href='/manifest.json' />
166
<link href='/icons/favicon-16x16.png' rel='icon' type='image/png' sizes='16x16' />
167
<link href='/icons/favicon-32x32.png' rel='icon' type='image/png' sizes='32x32' />
168
<link rel='apple-touch-icon' href='/icons/apple-icon.png'></link>
169
</Head>
170
171
<main className={styles.main}>
172
173
<div id={styles['main-page-content']} onScroll={scrollListener}>
174
<div onClick={Home} className={styles["main-page-apps-init"]} id="apps-init"><IoHomeOutline /></div>
175
<div className={styles["main-page-about-init"]} id={"ab-cloak"} onClick={Settings}><IoSettingsOutline /></div>
176
<div id={styles['inside-content-scroller']}>
177
<h1 id={"apps-header"} className={styles['apps-hidden']} style={{transition: "0.25s ease"}}><span>Games</span> <IoChevronDown className={styles['down-chevron']} onClick={upChevron} /></h1>
178
179
<div id={styles['games-over']} style={{overflow: 'visible'}}>
180
{
181
games.map((game: any) => {
182
return (
183
<div key={game.id} onClick={gameClicked} ludicrous-launch-url={game.id} className={styles.app}>
184
<img src={'/img/'+game.id+'.png'} alt='' />
185
<h3>{game.name}</h3>
186
</div>
187
)
188
})
189
}
190
</div>
191
</div>
192
</div>
193
</main>
194
</div>
195
);
196
};
197
198
Games.getInitialProps = async function( { req } ) {
199
if (req) {
200
return {
201
apps: [{name: 'GeForce Now', icon: '/icon/gfn.ico', url: 'https://play.geforcenow.com/mall/',},{name: 'Youtube', icon: '/icon/yt.ico', url: 'https://www.youtube.com',},{name: 'Google Search', icon: '/icon/google.ico', url: 'https://www.google.com/webhp',},{name: 'Reddit', icon: '/icon/reddit.ico', url: 'https://reddit.com',},{name: 'Discord', icon: '/icon/discord.ico', url: 'https://discord.com',},{name: 'now.gg', icon: '/icon/now.ico', url: 'https://now.gg',},{name: 'Twitter', icon: '/icon/twitter.ico', url: 'https://twitter.com',},{name: 'Github', icon: '/icon/git.ico', url: 'https://github.com',},{name: 'Webretro', icon: '/icon/retro.ico', url: '/webretro/', proxy: false},{name: 'Spotify', icon: '/icon/spot.ico', url: 'https://spotify.com',},{name: 'Replit', icon: '/icon/repl.ico', url: 'https://replit.com',},{name: 'Wikipedia', icon: '/icon/wiki.ico', url: 'https://wikipedia.org',},].map((e:any,i)=>{return {...e,id:i+1+''}}),
202
bookmarks: [
203
{name: 'LTBEEF + Ingot', code: `javascript:(function () {var a = document.createElement('script');a.src = '!!{origin}/scripts/ingot.min.js';document.body.appendChild(a);}())`,description: `LTBEEF (literally the best exploit ever found): Disables any extension with a nice UI. go to <b style="text-decoration: underline !important;" onclick="open('https://chrome.google.com/webstorex')">https://chrome.google.com/webstorex</b> and run the bookmarklet. <b>USES INGOT UI by Nebelung</b>`},
204
{name: 'Flooder', code: `javascript:(e=>{var num=prompt('How Times Do You Want This Page To Show Up In your History?');done=false;x=window.location.href;for (var i=1; i<=num; i++){history.pushState(0, 0, i==num?x:i.toString());if(i==num){done=true}}if(done===true){alert('Flooding Successful!\n '+window.location.href+' \nIs Now In Your History '+num+(num==1?' time.':' Times. '))}})()`, description: `Flooder (history flooder): Floods your <i>History</i> with a set number of entries. Creator: waldo#9044`},
205
{name: 'Stealth Tab', code: "javascript:document.write(`<style> iframe{margin:0px; border:none; padding:0px; outline:none} body{margin:0px}</style><iframe src = ${prompt('enter url')}' width = ${window.innerWidth} height = ${window.innerHeight} />`)", description: `Stealth Tab (Porta Proxy): Creates a block-free frame of any URL you want. Open a new tab, and use the bookmarklet. Creator: CoolElectronics#4683`},
206
{name: 'Youtube', code: `javascript:(()=>{const hash=escape((new URLSearchParams(window.location.search).get('v'))); if (hash!==null){window.location.href='https://www.youtube-nocookie.com/embed/'+hash}})()`, description: 'Youtube: Unblocks blocked youtube videos. Go to a blocked youtube video and use the bookmarklet. Creator: SupremeRubisco#8061'}
207
].map((e:any,i)=>{return {...e,id:i+1+''}}),
208
games: [{"name":"Minecraft","id":"minecraft"},{"name":"1v1 lol","id":"1v1lol"},{"name":"2048","id":"2048"},{"name":"A Dark Room","id":"adarkroom"},{"name":"Among Us","id":"amongus"},{"name":"ASCII Space","id":"asciispace"},{"name":"Asteroids","id":"asteroids"},{"name":"Astray","id":"astray"},{"name":"Back Country","id":"backcountry"},{"name":"Black Hole Square","id":"blackholesquare"},{"name":"Bounce Back","id":"bounceback"},{"name":"Breaklock","id":"breaklock"},{"name":"Breakout","id":"breakout"},{"name":"Captain Callisto","id":"captaincallisto"},{"name":"Chess","id":"chess"},{"name":"Chroma Incident","id":"chromaincident"},{"name":"Chrome Dino","id":"chromedino"},{"name":"Connect 3","id":"connect3"},{"name":"Cookie Clicker","id":"cookieclicker"},{"name":"Crossy Road","id":"crossyroad"},{"name":"Cut the Rope","id":"cuttherope"},{"name":"Dogeminer","id":"dogeminer"},{"name":"Edge not Found","id":"edgenotfound"},{"name":"Evil Glitch","id":"evilglitch"},{"name":"Factory Balls Forever","id":"factoryballsforever"},{"name":"Flappy Bird","id":"flappybird"},{"name":"Geometry Dash","id":"geometrydash"},{"name":"Hextris","id":"hextris"},{"name":"Konnekt","id":"konnekt"},{"name":"Ninja vs Evil Corp","id":"ninjavsevilcorp"},{"name":"Packa Bunchas","id":"packabunchas"},{"name":"Pacman","id":"pacman"},{"name":"Paper io","id":"paperio"},{"name":"Particle Clicker","id":"particleclicker"},{"name":"Pushback","id":"pushback"},{"name":"q1k3","id":"q1k3"},{"name":"Racer","id":"racer"},{"name":"Radius Raid","id":"radiusraid"},{"name":"Retro Bowl","id":"retrobowl"},{"name":"Retro Haunt","id":"retrohaunt"},{"name":"Road Blocks","id":"roadblocks"},{"name":"Run 3","id":"run3"},{"name":"Shuttle Deck","id":"shuttledeck"},{"name":"Sleeping Beauty","id":"sleepingbeauty"},{"name":"Slither io","id":"slitherio"},{"name":"Slope","id":"slope"},{"name":"Snake","id":"snake"},{"name":"Space Company","id":"spacecompany"},{"name":"Space Garden","id":"spacegarden"},{"name":"Space Huggers","id":"spacehuggers"},{"name":"Temple Run","id":"templerun"},{"name":"Tetris","id":"tetris"},{"name":"The Maze of Space Goblins","id":"themazeofspacegoblins"},{"name":"Tower Master","id":"towermaster"},{"name":"Trimps","id":"trimps"},{"name":"Underrun","id":"underrun"},{"name":"xx142-b2exe","id":"xx142-b2exe"}],
209
origin: absoluteUrl(req).origin
210
};
211
} else if (global.window) {
212
return {
213
apps: [{name: 'GeForce Now', icon: '/icon/gfn.ico', url: 'https://play.geforcenow.com/mall/',},{name: 'Youtube', icon: '/icon/yt.ico', url: 'https://www.youtube.com',},{name: 'Google Search', icon: '/icon/google.ico', url: 'https://www.google.com/webhp',},{name: 'Reddit', icon: '/icon/reddit.ico', url: 'https://reddit.com',},{name: 'Discord', icon: '/icon/discord.ico', url: 'https://discord.com',},{name: 'now.gg', icon: '/icon/now.ico', url: 'https://now.gg',},{name: 'Twitter', icon: '/icon/twitter.ico', url: 'https://twitter.com',},{name: 'Github', icon: '/icon/git.ico', url: 'https://github.com',},{name: 'Webretro', icon: '/icon/retro.ico', url: '/webretro/', proxy: false},{name: 'Spotify', icon: '/icon/spot.ico', url: 'https://spotify.com',},{name: 'Replit', icon: '/icon/repl.ico', url: 'https://replit.com',},{name: 'Wikipedia', icon: '/icon/wiki.ico', url: 'https://wikipedia.org',},].map((e:any,i)=>{return {...e,id:i+1+''}}),
214
bookmarks: [
215
{name: 'LTBEEF + Ingot', code: `javascript:(function () {var a = document.createElement('script');a.src = '!!{origin}/scripts/ingot.min.js';document.body.appendChild(a);}())`,description: `LTBEEF (literally the best exploit ever found): Disables any extension with a nice UI. go to <b style="text-decoration: underline !important;" onclick="open('https://chrome.google.com/webstorex')">https://chrome.google.com/webstorex</b> and run the bookmarklet. <b>USES INGOT UI by Nebelung</b>`},
216
{name: 'Flooder', code: `javascript:(e=>{var num=prompt('How Times Do You Want This Page To Show Up In your History?');done=false;x=window.location.href;for (var i=1; i<=num; i++){history.pushState(0, 0, i==num?x:i.toString());if(i==num){done=true}}if(done===true){alert('Flooding Successful!\n '+window.location.href+' \nIs Now In Your History '+num+(num==1?' time.':' Times. '))}})()`, description: `Flooder (history flooder): Floods your <i>History</i> with a set number of entries. Creator: waldo#9044`},
217
{name: 'Stealth Tab', code: "javascript:document.write(`<style> iframe{margin:0px; border:none; padding:0px; outline:none} body{margin:0px}</style><iframe src = ${prompt('enter url')}' width = ${window.innerWidth} height = ${window.innerHeight} />`)", description: `Stealth Tab (Porta Proxy): Creates a block-free frame of any URL you want. Open a new tab, and use the bookmarklet. Creator: CoolElectronics#4683`},
218
{name: 'Youtube', code: `javascript:(()=>{const hash=escape((new URLSearchParams(window.location.search).get('v'))); if (hash!==null){window.location.href='https://www.youtube-nocookie.com/embed/'+hash}})()`, description: 'Youtube: Unblocks blocked youtube videos. Go to a blocked youtube video and use the bookmarklet. Creator: SupremeRubisco#8061'}
219
].map((e:any,i)=>{return {...e,id:i+1+''}}),
220
games: [{"name":"Minecraft","id":"minecraft"},{"name":"1v1 lol","id":"1v1lol"},{"name":"2048","id":"2048"},{"name":"A Dark Room","id":"adarkroom"},{"name":"Among Us","id":"amongus"},{"name":"ASCII Space","id":"asciispace"},{"name":"Asteroids","id":"asteroids"},{"name":"Astray","id":"astray"},{"name":"Back Country","id":"backcountry"},{"name":"Black Hole Square","id":"blackholesquare"},{"name":"Bounce Back","id":"bounceback"},{"name":"Breaklock","id":"breaklock"},{"name":"Breakout","id":"breakout"},{"name":"Captain Callisto","id":"captaincallisto"},{"name":"Chess","id":"chess"},{"name":"Chroma Incident","id":"chromaincident"},{"name":"Chrome Dino","id":"chromedino"},{"name":"Connect 3","id":"connect3"},{"name":"Cookie Clicker","id":"cookieclicker"},{"name":"Crossy Road","id":"crossyroad"},{"name":"Cut the Rope","id":"cuttherope"},{"name":"Dogeminer","id":"dogeminer"},{"name":"Edge not Found","id":"edgenotfound"},{"name":"Evil Glitch","id":"evilglitch"},{"name":"Factory Balls Forever","id":"factoryballsforever"},{"name":"Flappy Bird","id":"flappybird"},{"name":"Geometry Dash","id":"geometrydash"},{"name":"Hextris","id":"hextris"},{"name":"Konnekt","id":"konnekt"},{"name":"Ninja vs Evil Corp","id":"ninjavsevilcorp"},{"name":"Packa Bunchas","id":"packabunchas"},{"name":"Pacman","id":"pacman"},{"name":"Paper io","id":"paperio"},{"name":"Particle Clicker","id":"particleclicker"},{"name":"Pushback","id":"pushback"},{"name":"q1k3","id":"q1k3"},{"name":"Racer","id":"racer"},{"name":"Radius Raid","id":"radiusraid"},{"name":"Retro Bowl","id":"retrobowl"},{"name":"Retro Haunt","id":"retrohaunt"},{"name":"Road Blocks","id":"roadblocks"},{"name":"Run 3","id":"run3"},{"name":"Shuttle Deck","id":"shuttledeck"},{"name":"Sleeping Beauty","id":"sleepingbeauty"},{"name":"Slither io","id":"slitherio"},{"name":"Slope","id":"slope"},{"name":"Snake","id":"snake"},{"name":"Space Company","id":"spacecompany"},{"name":"Space Garden","id":"spacegarden"},{"name":"Space Huggers","id":"spacehuggers"},{"name":"Temple Run","id":"templerun"},{"name":"Tetris","id":"tetris"},{"name":"The Maze of Space Goblins","id":"themazeofspacegoblins"},{"name":"Tower Master","id":"towermaster"},{"name":"Trimps","id":"trimps"},{"name":"Underrun","id":"underrun"},{"name":"xx142-b2exe","id":"xx142-b2exe"}],
221
origin: global.window.location.origin
222
};
223
} else {
224
return {};
225
}
226
}
227
228
229
export default Games
230
231