-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
721 lines (630 loc) · 30.9 KB
/
index.html
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>KittenStore</title>
<!-- Onsen UI CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/onsenui/css/onsenui.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/onsenui/css/onsen-css-components.css">
<!-- Tailwind (breaks some stuff) -->
<!-- <script src="https://cdn.tailwindcss.com"></script> -->
<!-- Bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
<!-- Font Awesome Pro -->
<link href="https://pro.fontawesome.com/releases/v6.0.0-beta3/css/all.css" rel="stylesheet">
<!-- Google Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<!-- Local Styles -->
<link rel="stylesheet" href="assets/css/styling.css">
<!-- Adds Download Button On Desktop -->
<link rel="manifest" href="/manifest.json">
<!-- Favicon -->
<link rel="icon" type="image/png" href="assets/img/500icon-rounded.png" />
<!-- Onsen UI JS -->
<script src="https://cdn.jsdelivr.net/npm/onsenui/js/onsenui.min.js"></script>
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js')
.then(() => console.log("Service Worker Registered"))
.catch(e => console.log(e));
}
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
const iphonexPatch = localStorage.getItem('iphonexPatch') === 'true';
const htmlElement = document.documentElement;
if (iphonexPatch && ons.platform.isIPhoneX()) {
htmlElement.setAttribute('onsflag-iphonex-portrait', '');
htmlElement.setAttribute('onsflag-iphonex-landscape', '');
} else {
htmlElement.removeAttribute('onsflag-iphonex-portrait');
htmlElement.removeAttribute('onsflag-iphonex-landscape');
}
});
</script>
</head>
<body>
<!-- Popup 1 (hidden by default) -->
<div id="add-to-homescreen-popup1"
class="d-none position-fixed bottom-0 start-0 w-100 h-100 d-flex align-items-center justify-content-center bg-dark bg-opacity-50"
style="z-index: 1050;">
<div class="bg-white p-4 rounded-3 shadow-lg text-center" style="max-width: 400px;">
<img style="max-width: 70px; border-radius: 10px;" src="assets/img/250icon.png" alt="">
<br><br>
<p class="h5 fw-bold mb-3">Welcome to KittenStore</p>
<p class="text-muted mb-4">A modern IPA library viewer and downloader.
</p>
<button onclick="ShowPopup2()" class="btn btn-primary px-4 py-2">Get Started</button>
</div>
</div>
<!-- Popup 2 (hidden by default) -->
<div id="add-to-homescreen-popup2"
class="d-none position-fixed bottom-0 start-0 w-100 h-100 d-flex align-items-center justify-content-center bg-dark bg-opacity-50"
style="z-index: 1050;">
<div class="bg-white p-4 rounded-3 shadow-lg text-center" style="max-width: 400px;">
<img style="max-width: 70px; border-radius: 10px;" src="assets/img/safari.png" alt="">
<p class="h5 fw-bold mb-3">Go to this in Safari</p>
<p class="text-muted mb-4">Please open this page in Safari at <span id="the-site-uri"></span>. Then click
continue.</p>
<button onclick="ShowPopup3()" class="btn btn-primary px-4 py-2">Continue</button>
</div>
</div>
<!-- Popup 3 (hidden by default) -->
<div id="add-to-homescreen-popup3"
class="d-none position-fixed bottom-0 start-0 w-100 h-100 d-flex align-items-center justify-content-center bg-dark bg-opacity-50"
style="z-index: 1050;">
<div class="bg-white p-4 rounded-3 shadow-lg text-center" style="max-width: 400px;">
<i style="min-width: 70px; border-radius: 10px;width:70px;" class="fa-solid fa-square-plus fa-2xl"></i><br><br>
<p class="h5 fw-bold mb-3">Install App</p>
<p class="text-muted mb-4">Click the share button at the bottom, Select Add to Home Screen and open KittenStore
from your homescreen</p>
</div>
</div>
</div>
<ons-navigator id="appNavigator" swipeable swipe-target-width="80px">
<ons-page>
<ons-splitter id="appSplitter">
<ons-splitter-content page="tabbar.html"></ons-splitter-content>
</ons-splitter>
</ons-page>
</ons-navigator>
<template id="tabbar.html">
<ons-page id="tabbar-page">
<ons-toolbar>
<div class="center">Home</div>
</ons-toolbar>
<ons-tabbar swipeable id="appTabbar" position="auto">
<ons-tab label="Home" icon="md-home" page="home.html" active></ons-tab>
<ons-tab label="Repositories" icon="md-folder" page="repos.html"></ons-tab>
<ons-tab label="Info" icon="md-info" page="info.html"></ons-tab>
<ons-tab label="Settings" icon="md-settings" page="settings.html"></ons-tab>
</ons-tabbar>
<script>
ons.getScriptPage().addEventListener('prechange', function (event) {
if (event.target.matches('#appTabbar')) {
event.currentTarget.querySelector('ons-toolbar .center').innerHTML = event.tabItem.getAttribute('label');
}
});
</script>
</ons-page>
</template>
<!-- Home/Apps Tab -->
<template id="home.html">
<ons-page>
<div class="search-bar-wrapper">
<ons-search-input id="searchInput" placeholder="Search apps..." aria-label="Search apps" autocapitalize="off"
autocorrect="off"></ons-search-input>
</div>
<div id="app-list" class="app-list"></div>
<script>
document.addEventListener('init', function () {
fetchApps();
});
async function fetchRepositories() {
try {
// Fetch the default repos from repos.txt
const response = await fetch('/repos.txt');
if (!response.ok) {
throw new Error('Network response was not ok');
}
const text = await response.text();
const defaultRepoUrls = text.split('\n').filter(url => url.trim() !== '');
// Get custom repos from localStorage
const customRepos = JSON.parse(localStorage.getItem('customRepos')) || [];
const repoUrls = [...defaultRepoUrls, ...customRepos];
// Fetch repo data from all URLs
const repos = await Promise.all(repoUrls.map(async url => {
const repoResponse = await fetch(url);
if (!repoResponse.ok) {
throw new Error(`Failed to fetch repo: ${url}`);
}
return { url, data: await repoResponse.json() };
}));
return repos;
} catch (error) {
console.error('Error fetching repositories:', error);
return [];
}
}
// Fetch all repositories
fetchRepositories().then(repos => console.log(repos));
async function fetchApps() {
const repos = await fetchRepositories();
const appList = document.getElementById('app-list');
appList.innerHTML = '';
window.apps = [];
repos.forEach(repo => {
repo.data.apps.forEach(app => {
app.repoName = repo.data.name;
window.apps.push(app);
});
});
renderApps(window.apps);
// Re-attach the event listener for the search input
const searchInput = document.getElementById('searchInput');
searchInput.value = ''; // Clear the search input
searchInput.removeEventListener('input', handleSearch);
searchInput.addEventListener('input', handleSearch);
}
function handleSearch(event) {
const query = event.target.value.toLowerCase();
const filteredApps = window.apps.filter(app => app.name.toLowerCase().includes(query));
renderApps(filteredApps);
}
function renderApps(apps) {
const appList = document.getElementById('app-list');
appList.innerHTML = '';
apps.forEach(app => {
const latestVersion = app.versions && app.versions[0]; // Ensure versions is not undefined
if (!latestVersion) return; // Skip rendering if versions is undefined or empty
const cardHtml = `
<ons-card class="app-card">
<div class="app-content">
<div class="app-icon">
<img src="${app.iconURL}" alt="${app.name} Icon"
onerror="this.onerror=null; this.src='https://placehold.co/400x400/000000/FFFFFF/png?text=No%5CnIcon&font=roboto';">
</div>
<div class="app-details">
<div class="app-title">${truncateTitle(app.name)}</div>
<div class="app-version">v${latestVersion.version}</div>
<div class="app-repo">From: ${app.repoName}</div>
</div>
</div>
<div class="install-button-wrapper">
<ons-button class="install-button" id="push-button" onclick="showInstallOptions('${app.name}')" aria-label="Install ${app.name}">Install</ons-button>
</div>
</ons-card>
`;
appList.insertAdjacentHTML('beforeend', cardHtml);
});
}
function truncateTitle(title) {
return title.length > 17 ? title.substring(0, 17) + '...' : title;
}
function showInstallOptions(appName) {
document.querySelector('#appNavigator').pushPage('page2.html', {
data: { appName }
});
}
</script>
</ons-page>
</template>
<!-- Info/About Tab -->
<template id="info.html">
<ons-page>
<br>
<div class="text-center">
<img style="width: 10vw;" src="assets/img/500icon-rounded.png" alt="logo">
<h1>Welcome to KittenStore</h1>
<p class="w-50 text-start m-auto">KittenStore is a user-friendly frontend designed for viewing and installing IPA files. I developed KittenStore to address the often frustrating and convoluted process of finding reliable IPA files. With so many distracting Linkvertise links and intrusive ads cluttering the search experience, KittenStore aims to streamline this process and provide a clean, straightforward interface for users to easily access and install the IPA files they need.</p>
</div><br>
<hr><br>
<div class="credits-header">
<p class="intro">Troubleshooting:</p>
</div>
<div class="container w-100 limited-width">
<div class="row align-items-center">
<!-- Text on the left -->
<div class="col-md-5">
<p class="limited-width">
Please ensure you have URL Scheme enabled when trying to install apps with TrollStore. It is under the
security section in your TrollStore app.
</p>
</div>
<!-- Image on the right -->
<div class="col-md-7 text-center">
<img src="assets/img/URL_scheme_Troll.jpeg" alt="Screenshot" class="img-fluid centered-image">
</div>
</div>
</div>
<br>
<div class="credits-list">
<div class="credits-header">
<p class="intro">Disclaimer:</p>
</div>
<p class="limited-width">
This project serves as an indexing and display platform for iOS application files (IPAs). The creator of this project:
<br>
<ol>
<li>Does not develop, produce, or maintain any of the applications listed.</li>
<li>Does not host or store any IPA files.</li>
<li>Is not responsible for the use, misuse, or consequences of using any listed applications.</li>
<li>Does not endorse or encourage software piracy or any illegal activities.</li>
</ol>
This platform functions solely as a search and display tool, similar to a search engine, for existing IPA files.
<br>
For any concerns, inquiries, or removal requests, please contact the project maintainer via Discord: CodingKitten
<br>
Note: This disclaimer is subject to change and does not constitute legal advice.</p>
<div class="credits-header">
<p class="intro">Emoji Guide for App Selection (Status):</p>
</div>
<div class="bs-table mt-6">
<table class="bs-table table table-striped">
<thead>
<tr class="bs-table">
<th class="bs-table">Indicator</th>
<th class="bs-table">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="bs-table">✅</td>
<td class="bs-table">An app is working or up-to-date.</td>
</tr>
<tr>
<td class="bs-table">❌</td>
<td class="bs-table">An app is either discontinued or not working.</td>
</tr>
<tr>
<td class="bs-table">⚠️</td>
<td class="bs-table">An app is outdated but still functional.</td>
</tr>
<tr>
<td class="bs-table">❔</td>
<td class="bs-table">The app's original source is inaccessible or has not been tested and its functionality is uncertain.</td>
</tr>
<tr>
<td class="bs-table">👍</td>
<td class="bs-table">An app or tweak is considered better than another one from the repo. (Example: Paperback > Aidoku)</td>
</tr>
<tr>
<td class="bs-table">⭐</td>
<td class="bs-table">An app fully supports Widgets.</td>
</tr>
<tr>
<td class="bs-table">💡</td>
<td class="bs-table">An app contains a hand-made tutorial. (Linked in its description)</td>
</tr>
</tbody>
</table>
</div>
<p class="limited-width">These emojis should assist you in making informed decisions when selecting apps or
tweaks from this repository. Please consider the provided emoji guidance when choosing the right application
for your needs.</p>
</div>
<p id="version" class="text-center">Loading version...</p>
</ons-page>
</template>
<!-- App detail page template -->
<template id="page2.html">
<ons-page id="page2">
<ons-toolbar>
<div class="left"><ons-back-button>Back</ons-back-button></div>
<div class="center">{{ appName }}</div>
</ons-toolbar>
<div class="app-details-page">
<img class="app-icon-large" src="" alt="{{ appName }} Icon">
<div class="app-description"></div>
<div class="app-repo"></div> <!-- Add this line -->
<div class="app-size"></div>
<div class="install-buttons">
<ons-button id="trollstore-install" aria-label="Install with TrollStore">Install with TrollStore</ons-button>
<ons-button id="sidestore-install" aria-label="Install with SideStore">Install with SideStore</ons-button>
<ons-button id="altstore-install" aria-label="Install with Altstore">Install with Altstore</ons-button>
<ons-button id="appdb-search" aria-label="Search on AppDB">Search on AppDB</ons-button>
<ons-button id="ipa-download" aria-label="Download IPA">Download IPA</ons-button>
</div>
</div>
<script>
document.addEventListener('init', async function (event) {
const page = event.target;
if (page.id === 'page2') {
const { appName } = page.data;
try {
const app = await fetchAppByName(appName);
const latestVersion = app.versions && app.versions[0]; // Ensure versions is not undefined
if (!latestVersion) {
page.querySelector('.app-description').innerText = 'No versions available for this app.';
return;
}
page.querySelector('.center').innerText = app.name;
const appIconElement = page.querySelector('.app-icon-large');
appIconElement.src = app.iconURL;
appIconElement.onerror = function () {
this.src = 'https://placehold.co/400x400/000000/FFFFFF/png?text=No%5CnIcon&font=roboto';
};
const cleanedDescription = latestVersion.localizedDescription.replace(/\nLast updated:.*$/m, '').replace(/Status:.*$/m, '');
const lastUpdatedDate = new Date(latestVersion.date);
const currentDate = new Date();
const diffTime = Math.abs(currentDate - lastUpdatedDate);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
const updatedDescription = `${cleanedDescription}\nLast updated: ${diffDays} days ago`;
page.querySelector('.app-description').innerHTML = makeLinksClickable(updatedDescription);
const statusMatch = latestVersion.localizedDescription.match(/Status:\s*(.*)/);
const statusEmojis = statusMatch ? statusMatch[1] : '';
const statusElement = document.createElement('div');
statusElement.className = 'app-status';
statusElement.innerText = statusEmojis;
page.querySelector('.app-description').appendChild(statusElement);
page.querySelector('.app-repo').innerText = `From: ${app.repoName}`;
const fileSize = formatFileSize(latestVersion.size);
page.querySelector('.app-size').innerText = `File Size: ${fileSize}`;
page.querySelector('#trollstore-install').onclick = function () {
const trollStoreURL = `apple-magnifier://install?url=${encodeURIComponent(latestVersion.downloadURL)}`;
location.href = trollStoreURL;
};
page.querySelector('#sidestore-install').onclick = function () {
const sideStoreURL = `sidestore://source?url=${encodeURIComponent(latestVersion.downloadURL)}`;
location.href = sideStoreURL;
};
page.querySelector('#altstore-install').onclick = function () {
const appdbURL = `altstore://install?url=${encodeURIComponent(latestVersion.downloadURL)}`;
window.open(appdbURL, '_blank');
};
page.querySelector('#appdb-search').onclick = function () {
const appdbURL = `https://appdb.to/?name=${encodeURIComponent(app.name)}`;
window.open(appdbURL, '_blank');
};
page.querySelector('#ipa-download').onclick = function () {
window.open(latestVersion.downloadURL, '_blank');
};
updateInstallButtons();
} catch (error) {
console.error('Error fetching app details:', error);
page.querySelector('.app-description').innerText = 'Failed to load app details.';
}
}
});
async function fetchAppByName(appName) {
const repos = await fetchRepositories();
for (const repo of repos) {
const app = repo.data.apps.find(app => app.name === appName);
if (app) {
app.repoName = repo.data.name; // Store the repo name with the app
return app;
}
}
throw new Error(`App "${appName}" not found in any repository`);
}
function formatFileSize(bytes) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
function updateInstallButtons() {
const showTrollStore = localStorage.getItem('showTrollStore') !== 'false';
const showSideStore = localStorage.getItem('showSideStore') !== 'false';
const showAppDB = localStorage.getItem('showAppDB') !== 'false';
const showAltStore = localStorage.getItem('showAltStore') !== 'false';
const trollstoreButton = document.getElementById('trollstore-install');
const sidestoreButton = document.getElementById('sidestore-install');
const appdbButton = document.getElementById('appdb-search');
const altstoreButton = document.getElementById('altstore-install');
if (trollstoreButton) trollstoreButton.style.display = showTrollStore ? 'inline-block' : 'none';
if (sidestoreButton) sidestoreButton.style.display = showSideStore ? 'inline-block' : 'none';
if (appdbButton) appdbButton.style.display = showAppDB ? 'inline-block' : 'none';
if (altstoreButton) altstoreButton.style.display = showAltStore ? 'inline-block' : 'none';
if (esignButton) esignButton.style.display = showEsign ? 'inline-block' : 'none';
if (scarletButton) scarletButton.style.display = showScarlet ? 'inline-block' : 'none';
}
function makeLinksClickable(text) {
return text.replace(/https?:\/\/[^\s]+/g, url => `<a href="${url}" target="_blank">${url}</a>`);
}
</script>
</ons-page>
</template>
<!-- Settings Tab -->
<template id="settings.html">
<ons-page id="settings-page">
<div style="padding: 20px;">
<ons-list>
<ons-list-item>
<div class="center">
<span class="list-item__title">Install Options:</span>
</div>
</ons-list-item>
<ons-list-item>
<div class="center">
<span class="list-item__title">Show TrollStore Button</span>
</div>
<div class="right">
<ons-switch id="trollstore-switch"></ons-switch>
</div>
</ons-list-item>
<ons-list-item>
<div class="center">
<span class="list-item__title">Show SideStore Button</span>
</div>
<div class="right">
<ons-switch id="sidestore-switch"></ons-switch>
</div>
</ons-list-item>
<ons-list-item>
<div class="center">
<span class="list-item__title">Show AppDB Button</span>
</div>
<div class="right">
<ons-switch id="appdb-switch"></ons-switch>
</div>
</ons-list-item>
<ons-list-item>
<div class="center">
<span class="list-item__title">Show AltStore Button</span>
</div>
<div class="right">
<ons-switch id="altstore-switch"></ons-switch>
</div>
</ons-list-item>
<ons-list-item>
<div class="center">
<span class="list-item__title">Preferences:</span>
</div>
</ons-list-item>
<ons-list-item>
<div class="center">
<span class="list-item__title">iPhone X Patch</span>
</div>
<div class="right">
<ons-switch id="iphonex-patch-switch"></ons-switch>
</div>
</ons-list-item>
<ons-list-item>
<div class="center">
<span class="list-item__title">Dark Mode</span>
</div>
<div class="right">
<ons-switch id="dark-mode-switch"></ons-switch>
</div>
</ons-list-item>
</ons-list>
</div>
<script>
document.addEventListener('init', function (event) {
const page = event.target;
if (page.id === 'settings-page') {
const trollstoreSwitch = document.getElementById('trollstore-switch');
const sidestoreSwitch = document.getElementById('sidestore-switch');
const appdbSwitch = document.getElementById('appdb-switch');
const altstoreSwitch = document.getElementById('altstore-switch');
const iphonexPatchSwitch = document.getElementById('iphonex-patch-switch');
const darkModeSwitch = document.getElementById('dark-mode-switch');
// Set default values if not already set
if (localStorage.getItem('showTrollStore') === null) localStorage.setItem('showTrollStore', 'true');
if (localStorage.getItem('showSideStore') === null) localStorage.setItem('showSideStore', 'true');
if (localStorage.getItem('showAppDB') === null) localStorage.setItem('showAppDB', 'true');
if (localStorage.getItem('showAltStore') === null) localStorage.setItem('showAltStore', 'true');
if (localStorage.getItem('iphonexPatch') === null) localStorage.setItem('iphonexPatch', 'false');
if (localStorage.getItem('darkMode') === null) localStorage.setItem('darkMode', 'false');
trollstoreSwitch.checked = localStorage.getItem('showTrollStore') === 'true';
sidestoreSwitch.checked = localStorage.getItem('showSideStore') === 'true';
appdbSwitch.checked = localStorage.getItem('showAppDB') === 'true';
altstoreSwitch.checked = localStorage.getItem('showAltStore') === 'true';
iphonexPatchSwitch.checked = localStorage.getItem('iphonexPatch') === 'true';
darkModeSwitch.checked = localStorage.getItem('darkMode') === 'true';
trollstoreSwitch.addEventListener('change', function () {
localStorage.setItem('showTrollStore', this.checked);
updateInstallButtons();
});
sidestoreSwitch.addEventListener('change', function () {
localStorage.setItem('showSideStore', this.checked);
updateInstallButtons();
});
appdbSwitch.addEventListener('change', function () {
localStorage.setItem('showAppDB', this.checked);
updateInstallButtons();
});
altstoreSwitch.addEventListener('change', function () {
localStorage.setItem('showAltStore', this.checked);
updateInstallButtons();
});
iphonexPatchSwitch.addEventListener('change', function () {
localStorage.setItem('iphonexPatch', this.checked);
applyIPhoneXPatch();
});
darkModeSwitch.addEventListener('change', function () {
localStorage.setItem('darkMode', this.checked);
applyDarkMode();
});
// Apply dark mode on page load
applyDarkMode();
}
});
function applyDarkMode() {
const darkMode = localStorage.getItem('darkMode') === 'true';
if (darkMode) {
document.body.classList.add('dark-mode');
document.documentElement.style.setProperty('--background-color', '#000');
document.documentElement.style.setProperty('--text-color', '#fff');
document.documentElement.style.setProperty('--card-color', '#1c1c1c');
document.documentElement.style.setProperty('--card-border-color', 'transparent');
document.documentElement.style.setProperty('--tabbar-background-color', '#1c1c1c');
} else {
document.body.classList.remove('dark-mode');
// Optionally reset to light mode defaults or handle it as needed
document.documentElement.style.removeProperty('--background-color');
document.documentElement.style.removeProperty('--text-color');
document.documentElement.style.removeProperty('--card-color');
document.documentElement.style.removeProperty('--card-border-color');
document.documentElement.style.removeProperty('--tabbar-background-color');
}
}
function updateInstallButtons() {
const showTrollStore = localStorage.getItem('showTrollStore') !== 'false';
const showSideStore = localStorage.getItem('showSideStore') !== 'false';
const showAppDB = localStorage.getItem('showAppDB') !== 'false';
const showAltStore = localStorage.getItem('showAltStore') !== 'false';
const showEsign = localStorage.getItem('showEsign') !== 'false';
const showScarlet = localStorage.getItem('showScarlet') !== 'false';
const trollstoreButton = document.getElementById('trollstore-install');
const sidestoreButton = document.getElementById('sidestore-install');
const appdbButton = document.getElementById('appdb-search');
const altstoreButton = document.getElementById('altstore-install');
const esignButton = document.getElementById('esign-install');
const scarletButton = document.getElementById('scarlet-install');
if (trollstoreButton) trollstoreButton.style.display = showTrollStore ? 'inline-block' : 'none';
if (sidestoreButton) sidestoreButton.style.display = showSideStore ? 'inline-block' : 'none';
if (appdbButton) appdbButton.style.display = showAppDB ? 'inline-block' : 'none';
if (altstoreButton) altstoreButton.style.display = showAltStore ? 'inline-block' : 'none';
if (esignButton) esignButton.style.display = showEsign ? 'inline-block' : 'none';
if (scarletButton) scarletButton.style.display = showScarlet ? 'inline-block' : 'none';
}
function makeLinksClickable(text) {
return text.replace(/https?:\/\/[^\s]+/g, url => `<a href="${url}" target="_blank">${url}</a>`);
}
function applyIPhoneXPatch() {
const iphonexPatch = localStorage.getItem('iphonexPatch') === 'true';
const htmlElement = document.documentElement;
if (iphonexPatch) {
if (ons.platform.isIPhoneX()) {
htmlElement.setAttribute('onsflag-iphonex-portrait', '');
htmlElement.setAttribute('onsflag-iphonex-landscape', '');
}
} else {
htmlElement.removeAttribute('onsflag-iphonex-portrait');
htmlElement.removeAttribute('onsflag-iphonex-landscape');
}
}
document.addEventListener('DOMContentLoaded', function () {
updateInstallButtons();
applyIPhoneXPatch();
applyDarkMode();
});
</script>
</ons-page>
</template>
<!-- Custom Repos Tab -->
<template id="repos.html">
<ons-page>
<div style="padding: 10px;">
<ons-list-title>Custom Repositories</ons-list-title>
<div class="custom-repo-container">
<ons-input id="repo-input" placeholder="Add new repository URL" float></ons-input>
<ons-button class="add-cstm-repo-btn" onclick="addCustomRepoFromInput()">Add Repository</ons-button>
</div>
<br>
<ons-list id="repo-list"></ons-list>
</div>
</ons-page>
</template>
<script src="assets/js/custom-repos.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>