1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-26 10:05:10 +00:00
This commit is contained in:
zumbiepig
2024-08-19 17:14:36 -07:00
parent 1ce214f13b
commit eb738e6bd8
8 changed files with 84 additions and 36 deletions

View File

@@ -21,7 +21,6 @@
<meta property="og:description" content="MineXLauncher is a custom launcher for Eaglercraft that has many versions and clients." />
<meta property="og:locale" content="en-US" />
<script src="/resources/scripts/google-tag.js"></script>
<script src="/sw-register.js"></script>
<script src="/resources/scripts/main.js"></script>
<script>
const lastPage = storage.session.get('lastPage');

View File

@@ -611,10 +611,15 @@ nav {
.settings {
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
justify-content: center;
}
.settings-section {
margin: 5px;
}
#username-input,
#theme-select {
width: calc(100% - 22px);

View File

@@ -11,13 +11,15 @@ self.addEventListener('install', (event) => {
for (const asset of cacheAssets) {
await cache.add(asset);
const progress = `${++cachedAssets}/${totalAssets}`;
cachedAssets++;
const progress = `${cachedAssets}/${totalAssets}`;
const clients = await self.clients.matchAll();
clients.forEach((client) => {
client.postMessage({
title: 'sw-install-progress',
message: progress,
self.clients.matchAll().then((clients) => {
clients.forEach((client) => {
client.postMessage({
title: 'sw-install-progress',
message: progress,
});
});
});
}

View File

@@ -70,6 +70,10 @@
<option value="campfire">Campfire</option>
</select>
</div>
<div class="settings-section">
<label for="offline-checkbox">Enable offline:</label>
<input type="checkbox" id="offline-checkbox" />
</div>
</div>
</div>
</div>

View File

@@ -1,22 +0,0 @@
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker
.register('/service-worker.js')
.then((registration) => {
console.log('Service worker registered with scope:', registration.scope);
navigator.serviceWorker.addEventListener('message', (event) => {
if (event.data.title === 'sw-install-progress') {
console.log(`Service worker installation progress: ${event.data.message} assets downloaded`);
// Update your UI with the progress
} else if (event.data.title === 'sw-install-complete') {
console.log('Service worker installation is complete!');
alert('Service worker installation is complete!');
}
});
})
.catch((error) => {
console.error('Service worker registration failed:', error);
});
});
}

View File

@@ -39,6 +39,8 @@
<option value="starfall">Starfall</option>
<option value="campfire">Campfire</option>
</select>
<label for="offline-checkbox">Enable offline:</label>
<input type="checkbox" id="offline-checkbox" />
<button type="submit" class="setup-submit">Submit</button>
</form>
</div>