Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
titaniumnetwork-dev
GitHub Repository: titaniumnetwork-dev/Ludicrous
Path: blob/main/pages/options.tsx
1223 views
1
import type { NextPage } from 'next'
2
import Head from 'next/head'
3
import { IoAppsOutline, IoHomeOutline, IoChevronDown } from "react-icons/io5";
4
import styles from '../styles/Settings.module.css'
5
import { useRouter } from 'next/router';
6
import { useEffect } from 'react';
7
8
const Close: Function = () => {
9
if (global.window) {
10
if (global.window.opener) global.window.close();
11
global.window.history.go(-(global.window.history.length-1));
12
global.window.location.replace('https://www.google.com/webhp')
13
}
14
}
15
16
const g: any = global || {};
17
18
const upChevron: any = function() {
19
var el: any = document.getElementsByClassName(styles['down-chevron']);
20
21
if (el[0] && !el[0].style.transform) el[0].style.transform = 'rotate(180deg)'; else el[0].style.transform = '';
22
23
var e = document.getElementById(styles['main-page-content']);
24
25
if (el[0] && el[0].style.transform) {
26
if (e) e.scroll(0,1);
27
} else {
28
if (e) e.scroll(0, 0);
29
}
30
}
31
32
const aboutBlank: Function = (event: any) => {
33
if (global.window) {
34
var openWin: any = global.window.open('about:blank');
35
36
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>');
37
openWin.document.close();
38
39
Close();
40
}
41
}
42
43
const scrollListener: any = (event: any) => {
44
if (window.innerWidth<600) {return event.target.style.height = '75%'};
45
46
var el: any = document.getElementsByClassName(styles['down-chevron']);
47
48
if (event.target.scrollTop) {event.target.style.height = '75%'} else event.target.style.height = '';
49
50
if (el[0] && event.target.scrollTop) el[0].style.transform = 'rotate(180deg)'; else el[0].style.transform = '';
51
52
if (event.target.style.height) {
53
var d = document.getElementById('apps-header');
54
if (d) d.classList.remove(styles['apps-hidden']);
55
} else {
56
var d = document.getElementById('apps-header');
57
if (d) d.classList.add(styles['apps-hidden']);
58
}
59
}
60
61
const setTabTitle: any = function() {
62
var input: any = document.getElementById('tab-cloak-input');
63
64
if (input) {
65
localStorage.setItem('__lud$title', input.value);
66
67
document.title = input.value;
68
}
69
}
70
71
if (global.window) {
72
var win: any = global.window;
73
}
74
75
const setTabIcon: any = function() {
76
var input: any = document.getElementById('tab-cloak-input');
77
78
if (input) {
79
localStorage.setItem('__lud$icon', input.value);
80
81
win.__lud$icon = input.value;
82
}
83
}
84
85
const resetTabInfo: any = function() {
86
localStorage.removeItem('__lud$icon');
87
localStorage.removeItem('__lud$title');
88
89
win.__lud$icon = '/favicon.ico';
90
}
91
92
const Options: NextPage = ({particles}: any) => {
93
const Router = useRouter();
94
var win: any = global.window||{};
95
96
useEffect(() => {
97
Router.prefetch('/options');
98
Router.prefetch('/apps');
99
Router.prefetch('/');
100
});
101
102
if (global.window) {
103
var main: any = function() {
104
(document.getElementById(styles['main-page-content'])||document.body).scrollTop = 1;
105
(document.getElementById(styles['inside-content-scroller'])||document.body).style.opacity = '1';
106
107
var el: any = (document.getElementById('theme-select')||document.createElement('input'));
108
109
el.value = g.localStorage.getItem('__lud$theme')||'dark';
110
111
el.onchange = ((e: any)=>{var b: any = document.querySelector('#theme-select');g.localStorage.setItem('__lud$theme', b.value);g.window.__lud$theme=b.value;b.value=b.value});
112
113
var el2: any = (document.getElementById('engine-select')||document.createElement('input'));
114
115
el2.value = g.localStorage.getItem('__lud$engine')||'https://www.google.com/search?q=';
116
117
var el3: any = (document.getElementById('stealth-select')||document.createElement('input'));
118
119
el3.value = g.localStorage.getItem('__lud$method')||'stealth';
120
121
var el4: any = (document.getElementById('proxy-select')||document.createElement('input'));
122
123
el4.value = g.localStorage.getItem('__lud$proxy')||'Ultraviolet';
124
}
125
126
window.addEventListener('load', function(e: any) {
127
setTimeout(main, 1);
128
});
129
130
if (document.readyState=='complete') {
131
setTimeout(main, 1);
132
}
133
}
134
135
const Home: any = () => {
136
if (global.window) {
137
(document.getElementById(styles['main-page-content'])||document.documentElement).scrollTop = 0;
138
139
setTimeout(function() {
140
var node: any = ((document.getElementById(styles['main-page-content'])||document.documentElement).childNodes[2]);
141
142
node.style.opacity = '0';
143
}, 250);
144
145
setTimeout(function() {
146
win.particles = particles;
147
Router.replace('/');
148
}, 400);
149
}
150
}
151
152
const Apps: any = () => {
153
if (global.window) {
154
(document.getElementById(styles['main-page-content'])||document.documentElement).scrollTop = 0;
155
156
setTimeout(function() {
157
var node: any = ((document.getElementById(styles['main-page-content'])||document.documentElement).childNodes[2]);
158
159
node.style.opacity = '0';
160
}, 250);
161
162
setTimeout(function() {
163
win.particles = particles;
164
Router.replace('/apps');
165
}, 400);
166
}
167
}
168
169
var win: any = global.window||{};
170
171
return (
172
<div className={styles.main}>
173
<Head>
174
<meta name="description" content="Ludicrous | A School Site" />
175
<meta name="theme-color" content="#2467a5" />
176
<meta charSet='utf-8' />
177
<meta httpEquiv='X-UA-Compatible' content='IE=edge' />
178
<meta name='viewport' content='minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, viewport-fit=cover, maximum-scale=6'/>
179
<title>Ludicrous - Settings</title>
180
<link rel='manifest' href='/manifest.json' />
181
<link href='/icons/favicon-16x16.png' rel='icon' type='image/png' sizes='16x16' />
182
<link href='/icons/favicon-32x32.png' rel='icon' type='image/png' sizes='32x32' />
183
<link rel='apple-touch-icon' href='/icons/apple-icon.png'></link>
184
</Head>
185
186
<main className={styles.main}>
187
188
<div id={styles['main-page-content']} onScroll={scrollListener}>
189
<div onClick={Apps} className={styles["main-page-apps-init"]} id="apps-init"><IoAppsOutline /></div>
190
<div className={styles["main-page-about-init"]} id={"ab-cloak"} onClick={Home}><IoHomeOutline /></div>
191
192
<div id={styles['inside-content-scroller']}>
193
<h1 id={"apps-header"} className={styles['apps-hidden']} style={{transition: "0.25s ease"}}><span>Settings</span> <IoChevronDown className={styles['down-chevron']} onClick={upChevron} /></h1>
194
195
<div id={styles['box-container']}>
196
<div className={styles['settings-box']}>
197
<h2>Tab Cloak</h2>
198
199
<input id="tab-cloak-input" className={styles['settings-input']} placeholder="Enter tab title or icon url" />
200
<button className={styles['settings-button']} onClick={setTabTitle} >Title</button>
201
<button className={styles['settings-button']} onClick={setTabIcon} >Icon</button>
202
<button className={styles['settings-button']} onClick={resetTabInfo} >Reset</button>
203
</div>
204
205
<div className={styles['settings-box']}>
206
<h2>Theme</h2>
207
208
<select id="theme-select" className={styles['theme-select']}>
209
<option value="light">
210
Light
211
</option>
212
<option value="dark">
213
Dark
214
</option>
215
<option value="fracital">
216
Fracital
217
</option>
218
<option value="illusive">
219
Illusive
220
</option>
221
<option value="contrast">
222
Tron
223
</option>
224
</select>
225
</div>
226
227
<div className={styles['settings-box']}>
228
<h2>Search Engine</h2>
229
230
<select id="engine-select" className={styles['engine-select']} onChange={(e:any)=>{
231
var el: any = document.getElementById('engine-select');
232
g.localStorage.setItem('__lud$engine', el.value)
233
}}>
234
<option value="https://www.google.com/search?q=">
235
Google
236
</option>
237
<option value="https://duckduckgo.com/?q=">
238
DuckDuckGo
239
</option>
240
<option value="https://search.brave.com/search?q=">
241
Brave
242
</option>
243
<option value="https://www.bing.com/search?q=">
244
Bing
245
</option>
246
</select>
247
</div>
248
249
<div className={styles['settings-box']}>
250
<h2>About:Blank</h2>
251
252
<button onClick={()=>{g.ludicrous.blank()}} className={styles['settings-button']}>
253
Activate
254
</button>
255
</div>
256
257
<div className={styles['settings-box']}>
258
<h2>Stealth</h2>
259
260
<select id="stealth-select" className={styles['theme-select']} onChange={()=>{
261
var el: any = document.getElementById('stealth-select');
262
263
localStorage.setItem('__lud$method', el.value||'stealth');
264
}}>
265
<option value="stealth">
266
On
267
</option>
268
<option value="normal">
269
Off
270
</option>
271
</select>
272
</div>
273
274
<div className={styles['settings-box']}>
275
<h2>Proxy [Backend]</h2>
276
277
<select id="proxy-select" className={styles['theme-select']} onChange={()=>{
278
var el: any = document.getElementById('proxy-select');
279
280
localStorage.setItem('__lud$proxy', el.value||'Ultraviolet');
281
}}>
282
<option value="Ultraviolet">
283
Ultraviolet
284
</option>
285
<option value="Dynamic">
286
Dynamic
287
</option>
288
</select>
289
</div>
290
</div>
291
</div>
292
</div>
293
</main>
294
</div>
295
);
296
};
297
298
299
export default Options;
300
301