Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
titaniumnetwork-dev
GitHub Repository: titaniumnetwork-dev/Ludicrous
Path: blob/main/pages/apps.tsx
1223 views
1
import type { NextPage } from 'next'
2
import Head from 'next/head'
3
import { IoHomeOutline, IoSettingsOutline, IoChevronDown } from "react-icons/io5";
4
import styles from '../styles/Apps.module.css'
5
import { loadFull } from "tsparticles";
6
import { useRouter } from 'next/router';
7
import { useEffect } from 'react';
8
import absoluteUrl from 'next-absolute-url'
9
10
const Close: Function = () => {
11
if (global.window) {
12
if (global.window.opener) global.window.close();
13
global.window.history.go(-(global.window.history.length-1));
14
global.window.location.replace('https://www.google.com/webhp')
15
}
16
}
17
18
const g: any = global || {};
19
20
const appClicked: any = function(event: any) {
21
if (!event.nativeEvent.path) var el = event.nativeEvent.target.getAttribute('ludicrous-launch-url')?event.nativeEvent.target:event.nativeEvent.target.parentNode;
22
else var el = (event.nativeEvent.path||[]).find((e:any)=>e.classList&&e.classList.contains(styles['app']));
23
24
var app = el.getAttribute('ludicrous-launch-url');
25
26
location.href = '/route?query='+(encodeURIComponent(app));
27
}
28
29
const noAppClicked: any = function(event: any) {
30
if (!event.nativeEvent.path) var el = event.nativeEvent.target.getAttribute('ludicrous-launch-url')?event.nativeEvent.target:event.nativeEvent.target.parentNode;
31
else var el = (event.nativeEvent.path||[]).find((e:any)=>e.classList&&e.classList.contains(styles['app']));
32
33
var app = el.getAttribute('ludicrous-launch-url');
34
35
if (g.openFrame) g.openFrame(app, false);
36
history.pushState(null, '', location.pathname+'?origin='+app);
37
}
38
39
const gameClicked: any = function(event: any) {
40
if (!event.nativeEvent.path) var el = event.nativeEvent.target.getAttribute('ludicrous-launch-url')?event.nativeEvent.target:event.nativeEvent.target.parentNode;
41
else var el = (event.nativeEvent.path||[]).find((e:any)=>e.classList&&e.classList.contains(styles['app']));
42
43
var app = el.getAttribute('ludicrous-launch-url');
44
45
if (g.openFrame) g.openFrame('/gfiles/html5/'+app+'/', false);
46
history.pushState(null, '', location.pathname+'?origin=/gfilesgfiles/html5/'+app+'/');
47
}
48
49
const upChevron: any = function() {
50
var el: any = document.getElementsByClassName(styles['down-chevron']);
51
52
if (el[0] && !el[0].style.transform) el[0].style.transform = 'rotate(180deg)'; else el[0].style.transform = '';
53
54
var e = document.getElementById(styles['main-page-content']);
55
56
if (el[0] && el[0].style.transform) {
57
if (e) e.scroll(0,1);
58
} else {
59
if (e) e.scroll(0, 0);
60
}
61
}
62
63
var times: any = 0;
64
65
const scrollListener: any = (event: any) => {
66
if (window.innerWidth<600) {return event.target.style.height = '75%'};
67
if (times>1&&window.innerWidth<600) return;
68
69
var el: any = document.getElementsByClassName(styles['down-chevron']);
70
71
if (event.target.scrollTop) {event.target.style.height = '75%'} else event.target.style.height = '';
72
73
if (el[0] && event.target.scrollTop) el[0].style.transform = 'rotate(180deg)'; else el[0].style.transform = '';
74
75
if (event.target.style.height) {
76
var d = document.getElementById('apps-header');
77
if (d) d.classList.remove(styles['apps-hidden']);
78
} else {
79
var d = document.getElementById('apps-header');
80
if (d) d.classList.add(styles['apps-hidden']);
81
}
82
83
times++;
84
}
85
86
const aboutBlank: Function = (event: any) => {
87
if (global.window) {
88
var openWin: any = global.window.open('about:blank');
89
90
openWin.document.write('<head><title>Classes</title><link rel="icon" type="image/png" href="https://ssl.gstatic.com/classroom/favicon.png"><style>body {margin:0;overflow:hidden}</style></head><body><iframe width="100%" height="100%" src="' + global.window.location.href + '" frameborder="0"></iframe></body>');
91
openWin.document.close();
92
93
Close();
94
}
95
}
96
97
const flip: any = function(el: any) {
98
for (var n = el; n.parentNode; n = n.parentNode) {
99
if (el.parentNode.tagName == "SVG") {
100
el = n;
101
break;
102
}
103
104
continue;
105
}
106
107
if (el.style.transform) {
108
el.style.transform = '';
109
} else {
110
el.style.transform = 'rotate(180deg)';
111
}
112
}
113
114
const appsHide: any = function(e: any) {
115
const div = document.getElementById(styles['launch-over']);
116
117
if (div) div.classList.toggle(styles['visible']);
118
119
if (div) if (div.classList.contains(styles['visible'])) location.hash = 'apps';
120
121
flip(e.target);
122
}
123
124
const gamesHide: any = function(e: any) {
125
const div = document.getElementById(styles['games-over']);
126
127
if (div) div.classList.toggle(styles['visible']);
128
129
if (div) if (div.classList.contains(styles['visible'])) location.hash = 'games';
130
131
flip(e.target);
132
}
133
134
const exploitHide: any = function(e: any) {
135
const div = document.getElementById(styles['exploits-over']);
136
137
if (div) div.classList.toggle(styles['visible']);
138
139
if (div) if (div.classList.contains(styles['visible'])) location.hash = 'exploits';
140
141
flip(e.target);
142
}
143
144
const creditsHide: any = function(e: any) {
145
const div = document.getElementById(styles['credits-over']);
146
147
if (div) div.classList.toggle(styles['visible']);
148
149
if (div) if (div.classList.contains(styles['visible'])) location.hash = 'credits';
150
151
flip(e.target);
152
}
153
154
const Apps: NextPage = ({ apps, games, bookmarks, particles, origin }: any) => {
155
const Router = useRouter();
156
var win: any = global.window||{};
157
158
useEffect(() => {
159
Router.prefetch('/options');
160
Router.prefetch('/apps');
161
Router.prefetch('/');
162
163
if (global.window) {
164
(document.getElementById(styles['main-page-content'])||document.body).scrollTop = 1;
165
(document.getElementById(styles['inside-content-scroller'])||document.body).style.opacity = '1';
166
167
if (new URLSearchParams(location.search).get('origin')) {
168
if (g.openFrame) g.openFrame(new URLSearchParams(location.search).get('origin'), false);
169
}
170
171
if (location.hash=='#credits') if(document.getElementById('creditshow')) {creditsHide({target:document.getElementById('creditshow')});};
172
if (location.hash=='#games') if(document.getElementById('gameshow')) {gamesHide({target:document.getElementById('gameshow')});};
173
if (location.hash=='#launch') if(document.getElementById('appshow')) {appsHide({target:document.getElementById('appshow')});};
174
if (location.hash=='#exploits') if(document.getElementById('bookshow')) {exploitHide({target:document.getElementById('bookshow')});};
175
}
176
});
177
178
const Home: any = () => {
179
180
if (global.window) {
181
(document.getElementById(styles['main-page-content'])||document.documentElement).scrollTop = 0;
182
183
setTimeout(function() {
184
var node: any = ((document.getElementById(styles['main-page-content'])||document.documentElement).childNodes[2]);
185
186
node.style.opacity = '0';
187
}, 250);
188
189
setTimeout(function() {
190
win.particles = particles;
191
Router.replace('/');
192
}, 400);
193
}
194
}
195
196
const Settings: any = () => {
197
if (global.window) {
198
(document.getElementById(styles['main-page-content'])||document.documentElement).scrollTop = 0;
199
200
setTimeout(function() {
201
var node: any = ((document.getElementById(styles['main-page-content'])||document.documentElement).childNodes[2]);
202
203
node.style.opacity = '0';
204
}, 250);
205
206
setTimeout(function() {
207
win.particles = particles;
208
Router.replace('/options');
209
}, 400);
210
}
211
}
212
213
const particlesInit: any = async (main: any) => {await loadFull(main)};
214
215
const particlesLoaded: any = (e: any) => {};
216
217
return (
218
<div className={styles.main}>
219
<Head>
220
<meta name="description" content="Ludicrous | A School Site" />
221
<meta name="theme-color" content="#2467a5" />
222
<meta charSet='utf-8' />
223
<meta httpEquiv='X-UA-Compatible' content='IE=edge' />
224
<meta name='viewport' content='minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, viewport-fit=cover, maximum-scale=6'/>
225
<title>Ludicrous - Apps</title>
226
<link rel='manifest' href='/manifest.json' />
227
<link href='/icons/favicon-16x16.png' rel='icon' type='image/png' sizes='16x16' />
228
<link href='/icons/favicon-32x32.png' rel='icon' type='image/png' sizes='32x32' />
229
<link rel='apple-touch-icon' href='/icons/apple-icon.png'></link>
230
</Head>
231
232
<main className={styles.main}>
233
234
<div id={styles['main-page-content']} onScroll={scrollListener}>
235
<div onClick={Home} className={styles["main-page-apps-init"]} id="apps-init"><IoHomeOutline /></div>
236
<div className={styles["main-page-about-init"]} id={"ab-cloak"} onClick={Settings}><IoSettingsOutline /></div>
237
<div id={styles['inside-content-scroller']}>
238
<h1 id={"apps-header"} className={styles['apps-hidden']} style={{transition: "0.25s ease"}}><span>Apps</span> <IoChevronDown className={styles['down-chevron']} onClick={upChevron} /></h1>
239
240
<hr className={styles['type-sep']} />
241
242
<h2>Quick Launch <IoChevronDown className={styles['toggle-chevron']} onClick={appsHide} id="appshow" /></h2>
243
<div id={styles['launch-over']}>
244
{
245
apps.map((app: any) => {
246
if (app.proxy==false) {
247
return (
248
<div onClick={noAppClicked} key={app.id} className={styles.app} ludicrous-launch-url={app.url}>
249
<img src={app.icon} alt='' />
250
<h3>{app.name}</h3>
251
</div>
252
)
253
}
254
255
return (
256
<div onClick={appClicked} key={app.id} className={styles.app} ludicrous-launch-url={app.url}>
257
<img src={app.icon} alt='' />
258
<h3>{app.name}</h3>
259
</div>
260
)
261
})
262
}
263
</div>
264
265
<hr className={styles['type-sep']} />
266
267
<h2>Games <IoChevronDown className={styles['toggle-chevron']} onClick={gamesHide} id="gameshow" /></h2>
268
<div id={styles['games-over']}>
269
{
270
games.map((game: any) => {
271
return (
272
<div key={game.id} onClick={gameClicked} ludicrous-launch-url={game.id} className={styles.app}>
273
<img src={'/img/'+game.id+'.png'} alt='' />
274
<h3>{game.name}</h3>
275
</div>
276
)
277
})
278
}
279
</div>
280
281
<hr className={styles['type-sep']} />
282
283
<h2 id={styles['no-bottom-margin']}>Bookmarklets <IoChevronDown className={styles['toggle-chevron']} onClick={exploitHide} id="bookshow" /></h2>
284
<h5>Drag to Bookmarks bar</h5>
285
286
<div id={styles['exploits-over']}>
287
{
288
bookmarks.map((bookmark: any) => {
289
return (
290
<div className={styles['smol-exp-div']} key={bookmark.id} dangerouslySetInnerHTML={{
291
__html: (`
292
<a style="text-decoration: none;" href="${bookmark.code.replace(/\!\!\{origin\}/gi, origin)}">
293
<div class="${styles.app}">
294
<h3 style="top:0">${bookmark.name}</h3>
295
<p class="${styles.bdesc}">${bookmark.description}</p>
296
</div>
297
</a>
298
`)
299
}}>
300
</div>
301
)
302
})
303
}
304
</div>
305
306
<h2>Credits <IoChevronDown className={styles['toggle-chevron']} onClick={creditsHide} id="creditshow"/></h2>
307
308
<div id={styles['credits-over']}>
309
Me
310
</div>
311
</div>
312
</div>
313
</main>
314
</div>
315
);
316
};
317
318
Apps.getInitialProps = async function( { req } ) {
319
if (req) {
320
return {
321
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+''}}),
322
bookmarks: [
323
{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>`},
324
{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`},
325
{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`},
326
{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'}
327
].map((e:any,i)=>{return {...e,id:i+1+''}}),
328
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"}],
329
origin: absoluteUrl(req).origin
330
};
331
} else if (global.window) {
332
return {
333
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+''}}),
334
bookmarks: [
335
{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>`},
336
{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`},
337
{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`},
338
{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'}
339
].map((e:any,i)=>{return {...e,id:i+1+''}}),
340
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"}],
341
origin: global.window.location.origin
342
};
343
} else {
344
return {};
345
}
346
}
347
348
export default Apps
349
350