11let appInd
2-
2+ let g = window . location . pathname === "/gm"
3+ let t = window . location . pathname === "/ta"
34function saveToLocal ( path ) {
45 sessionStorage . setItem ( "GoUrl" , path )
56}
@@ -12,9 +13,15 @@ function handleClick(app) {
1213 if ( app . local ) {
1314 saveToLocal ( app . link )
1415 window . location . href = "ta"
16+ if ( t ) {
17+ window . location . href = app . link
18+ }
1519 } else if ( app . local2 ) {
1620 saveToLocal ( app . link )
1721 window . location . href = app . link
22+ if ( t ) {
23+ window . location . href = app . link
24+ }
1825 } else if ( app . blank ) {
1926 blank ( app . link )
2027 } else if ( app . now ) {
@@ -25,13 +32,20 @@ function handleClick(app) {
2532 dy ( app . link )
2633 } else {
2734 go ( app . link )
35+ if ( t ) {
36+ blank ( app . link )
37+ }
2838 }
29-
3039 return false
3140}
3241
3342function CustomApp ( customApp ) {
34- let apps = localStorage . getItem ( "Acustom" )
43+ let apps
44+ if ( g ) {
45+ apps = localStorage . getItem ( "Gcustom" )
46+ } else {
47+ apps = localStorage . getItem ( "Acustom" )
48+ }
3549
3650 if ( apps === null ) {
3751 apps = { }
@@ -43,15 +57,22 @@ function CustomApp(customApp) {
4357
4458 apps [ key ] = customApp
4559
46- localStorage . setItem ( "Acustom" , JSON . stringify ( apps ) )
60+ if ( g ) {
61+ localStorage . setItem ( "Gcustom" , JSON . stringify ( apps ) )
62+ } else {
63+ localStorage . setItem ( "Acustom" , JSON . stringify ( apps ) )
64+ }
4765}
4866
4967function setPin ( index ) {
50- let pins = localStorage . getItem ( "Apinned" )
51- if ( pins == null ) {
52- pins = [ ]
68+ let pins
69+ if ( g ) {
70+ pins = localStorage . getItem ( "Gpinned" )
71+ } else {
72+ pins = localStorage . getItem ( "Apinned" )
5373 }
54- if ( pins == "" ) {
74+
75+ if ( pins === null || pins === "" ) {
5576 pins = [ ]
5677 } else {
5778 pins = pins . split ( "," ) . map ( Number )
@@ -62,7 +83,11 @@ function setPin(index) {
6283 } else {
6384 pins . push ( index )
6485 }
65- localStorage . setItem ( "Apinned" , pins )
86+ if ( g ) {
87+ localStorage . setItem ( "Gpinned" , pins )
88+ } else {
89+ localStorage . setItem ( "Apinned" , pins )
90+ }
6691 location . reload ( )
6792}
6893
@@ -141,134 +166,146 @@ function initializeCustomApp(customApp) {
141166}
142167
143168document . addEventListener ( "DOMContentLoaded" , ( ) => {
144- const storedApps = JSON . parse ( localStorage . getItem ( "Acustom" ) )
169+ let storedApps
170+ if ( g ) {
171+ storedApps = JSON . parse ( localStorage . getItem ( "Gcustom" ) )
172+ } else {
173+ storedApps = JSON . parse ( localStorage . getItem ( "Acustom" ) )
174+ }
145175 if ( storedApps ) {
146176 Object . values ( storedApps ) . forEach ( ( app ) => {
147177 initializeCustomApp ( app )
148178 } )
149179 }
180+ } )
150181
151- fetch ( "/assets/json/a.min.json" )
152- . then ( ( response ) => {
153- return response . json ( )
182+ let path = "/assets/json/a.min.json"
183+ if ( g ) {
184+ path = "/assets/json/g.min.json"
185+ } else {
186+ path = "/assets/json/a.min.json"
187+ }
188+ fetch ( path )
189+ . then ( ( response ) => {
190+ return response . json ( )
191+ } )
192+ . then ( ( appsList ) => {
193+ appsList . sort ( ( a , b ) => {
194+ if ( a . name . startsWith ( "[Custom]" ) ) return - 1
195+ if ( b . name . startsWith ( "[Custom]" ) ) return 1
196+ return a . name . localeCompare ( b . name )
154197 } )
155- . then ( ( appsList ) => {
156- appsList . sort ( ( a , b ) => {
157- if ( a . name . startsWith ( "[Custom]" ) ) return - 1
158- if ( b . name . startsWith ( "[Custom]" ) ) return 1
159- return a . name . localeCompare ( b . name )
160- } )
161- const nonPinnedApps = document . querySelector ( ".container-apps" )
162- const pinnedApps = document . querySelector ( ".pinned-apps" )
198+ const nonPinnedApps = document . querySelector ( ".container-apps" )
199+ const pinnedApps = document . querySelector ( ".pinned-apps" )
200+ if ( g ) {
201+ var pinList = localStorage . getItem ( "Gpinned" ) || ""
202+ } else {
163203 var pinList = localStorage . getItem ( "Apinned" ) || ""
164- pinList = pinList ? pinList . split ( "," ) . map ( Number ) : [ ]
165- appInd = 0
166-
167- appsList . forEach ( ( app ) => {
168- if ( app . categories && app . categories . includes ( "local" ) ) {
169- app . local = true
170- } else if ( app . link && ( app . link . includes ( "now.gg" ) || app . link . includes ( "nowgg.me" ) ) ) {
171- if ( app . partial === null || app . partial === undefined ) {
172- app . partial = true
173- app . say = "Now.gg is currently not working for some users."
174- }
175- } else if ( app . link && app . link . includes ( "nowgg.nl" ) ) {
176- if ( app . error === null || app . error === undefined ) {
177- app . error = true
178- app . say = "NowGG.nl is currently down."
179- }
204+ }
205+ pinList = pinList ? pinList . split ( "," ) . map ( Number ) : [ ]
206+ appInd = 0
207+
208+ appsList . forEach ( ( app ) => {
209+ if ( app . categories && app . categories . includes ( "local" ) ) {
210+ app . local = true
211+ } else if ( app . link && ( app . link . includes ( "now.gg" ) || app . link . includes ( "nowgg.me" ) ) ) {
212+ if ( app . partial === null || app . partial === undefined ) {
213+ app . partial = true
214+ app . say = "Now.gg is currently not working for some users."
180215 }
181-
182- let pinNum = appInd
183-
184- const columnDiv = document . createElement ( "div" )
185- columnDiv . classList . add ( "column" )
186- columnDiv . setAttribute ( "data-category" , app . categories . join ( " " ) )
187-
188- const pinIcon = document . createElement ( "i" )
189- pinIcon . classList . add ( "fa" , "fa-map-pin" )
190- pinIcon . ariaHidden = true
191-
192- const btn = document . createElement ( "button" )
193- btn . appendChild ( pinIcon )
194- btn . style . float = "right"
195- btn . style . backgroundColor = "rgb(45,45,45)"
196- btn . style . borderRadius = "50%"
197- btn . style . borderColor = "transparent"
198- btn . style . color = "white"
199- btn . style . top = "-200px"
200- btn . style . position = "relative"
201- btn . onclick = function ( ) {
202- setPin ( pinNum )
216+ } else if ( app . link && app . link . includes ( "nowgg.nl" ) ) {
217+ if ( app . error === null || app . error === undefined ) {
218+ app . error = true
219+ app . say = "NowGG.nl is currently down."
203220 }
204- btn . title = "Pin"
205-
206- const link = document . createElement ( "a" )
207-
208- link . onclick = function ( ) {
209- handleClick ( app )
221+ }
222+
223+ let pinNum = appInd
224+
225+ const columnDiv = document . createElement ( "div" )
226+ columnDiv . classList . add ( "column" )
227+ columnDiv . setAttribute ( "data-category" , app . categories . join ( " " ) )
228+
229+ const pinIcon = document . createElement ( "i" )
230+ pinIcon . classList . add ( "fa" , "fa-map-pin" )
231+ pinIcon . ariaHidden = true
232+
233+ const btn = document . createElement ( "button" )
234+ btn . appendChild ( pinIcon )
235+ btn . style . float = "right"
236+ btn . style . backgroundColor = "rgb(45,45,45)"
237+ btn . style . borderRadius = "50%"
238+ btn . style . borderColor = "transparent"
239+ btn . style . color = "white"
240+ btn . style . top = "-200px"
241+ btn . style . position = "relative"
242+ btn . onclick = function ( ) {
243+ setPin ( pinNum )
244+ }
245+ btn . title = "Pin"
246+
247+ const link = document . createElement ( "a" )
248+
249+ link . onclick = function ( ) {
250+ handleClick ( app )
251+ }
252+
253+ const image = document . createElement ( "img" )
254+ image . width = 145
255+ image . height = 145
256+ image . src = app . image
257+ image . loading = "lazy"
258+
259+ const paragraph = document . createElement ( "p" )
260+ paragraph . textContent = app . name
261+
262+ if ( app . error ) {
263+ paragraph . style . color = "red"
264+ if ( ! app . say ) {
265+ app . say = "This app is currently not working."
210266 }
211-
212- const image = document . createElement ( "img" )
213- image . width = 145
214- image . height = 145
215- image . src = app . image
216- image . loading = "lazy"
217-
218- const paragraph = document . createElement ( "p" )
219- paragraph . textContent = app . name
220-
221- if ( app . error ) {
222- paragraph . style . color = "red"
223- if ( ! app . say ) {
224- app . say = "This app is currently not working."
225- }
226- } else if ( app . load ) {
227- paragraph . style . color = "yellow"
228- if ( ! app . say ) {
229- app . say = "This app may experience excessive loading times."
230- }
231- } else if ( app . partial ) {
232- paragraph . style . color = "yellow"
233- if ( ! app . say ) {
234- app . say =
235- "This app is currently experiencing some issues, it may not work for you. (Dynamic doesn't work in about:blank)"
236- }
267+ } else if ( app . load ) {
268+ paragraph . style . color = "yellow"
269+ if ( ! app . say ) {
270+ app . say = "This app may experience excessive loading times."
271+ }
272+ } else if ( app . partial ) {
273+ paragraph . style . color = "yellow"
274+ if ( ! app . say ) {
275+ app . say = "This app is currently experiencing some issues, it may not work for you. (Dynamic doesn't work in about:blank)"
237276 }
277+ }
238278
239- link . appendChild ( image )
240- link . appendChild ( paragraph )
241- columnDiv . appendChild ( link )
279+ link . appendChild ( image )
280+ link . appendChild ( paragraph )
281+ columnDiv . appendChild ( link )
242282
243- if ( appInd != 0 ) {
244- columnDiv . appendChild ( btn )
245- }
283+ if ( appInd != 0 ) {
284+ columnDiv . appendChild ( btn )
285+ }
246286
247- if ( pinList != null && appInd != 0 ) {
248- if ( pinContains ( appInd , pinList ) ) {
249- pinnedApps . appendChild ( columnDiv )
250- } else {
251- nonPinnedApps . appendChild ( columnDiv )
252- }
287+ if ( pinList != null && appInd != 0 ) {
288+ if ( pinContains ( appInd , pinList ) ) {
289+ pinnedApps . appendChild ( columnDiv )
253290 } else {
254291 nonPinnedApps . appendChild ( columnDiv )
255292 }
256- appInd ++
257- } )
258-
259- const appsContainer = document . getElementById ( "apps-container" )
260- appsContainer . appendChild ( pinnedApps )
261- appsContainer . appendChild ( nonPinnedApps )
293+ } else {
294+ nonPinnedApps . appendChild ( columnDiv )
295+ }
296+ appInd ++
262297 } )
263- . catch ( ( error ) => {
264- console . error ( "Error fetching JSON data:" , error )
265- } )
266- } )
298+
299+ const appsContainer = document . getElementById ( "apps-container" )
300+ appsContainer . appendChild ( pinnedApps )
301+ appsContainer . appendChild ( nonPinnedApps )
302+ } )
303+ . catch ( ( error ) => {
304+ console . error ( "Error fetching JSON data:" , error )
305+ } )
267306
268307function show_category ( ) {
269- var selectedCategories = Array . from ( document . querySelectorAll ( "#category option:checked" ) ) . map (
270- ( option ) => option . value
271- )
308+ var selectedCategories = Array . from ( document . querySelectorAll ( "#category option:checked" ) ) . map ( ( option ) => option . value )
272309 var games = document . getElementsByClassName ( "column" )
273310
274311 for ( var i = 0 ; i < games . length ; i ++ ) {
0 commit comments