diff --git a/src/404.html b/src/404.html index 7329e02..71b8ce7 100644 --- a/src/404.html +++ b/src/404.html @@ -35,12 +35,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/articles/index.html b/src/articles/index.html index 6887546..e629fd9 100644 --- a/src/articles/index.html +++ b/src/articles/index.html @@ -76,12 +76,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
@@ -94,7 +90,7 @@ data-full-width-responsive="true" >
-
+
×
@@ -210,7 +206,7 @@
-
+
×
diff --git a/src/home/archive/index.html b/src/home/archive/index.html index 76a0655..4b5b27b 100644 --- a/src/home/archive/index.html +++ b/src/home/archive/index.html @@ -222,12 +222,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/home/clients/index.html b/src/home/clients/index.html index 6de6980..6546c7b 100644 --- a/src/home/clients/index.html +++ b/src/home/clients/index.html @@ -96,12 +96,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/home/downloads/index.html b/src/home/downloads/index.html index ae18c18..46913d7 100644 --- a/src/home/downloads/index.html +++ b/src/home/downloads/index.html @@ -84,12 +84,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/home/game/index.html b/src/home/game/index.html index 72dffe2..469edf0 100644 --- a/src/home/game/index.html +++ b/src/home/game/index.html @@ -116,12 +116,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/mobile/index.html b/src/mobile/index.html index 268cc61..84f890b 100644 --- a/src/mobile/index.html +++ b/src/mobile/index.html @@ -41,12 +41,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/mods/mods/index.html b/src/mods/mods/index.html index 7a07d21..e4e4c35 100644 --- a/src/mods/mods/index.html +++ b/src/mods/mods/index.html @@ -69,12 +69,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/mods/resourcepacks/index.html b/src/mods/resourcepacks/index.html index c5d9200..dff5c9b 100644 --- a/src/mods/resourcepacks/index.html +++ b/src/mods/resourcepacks/index.html @@ -66,12 +66,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/offline.html b/src/offline.html index 6c62387..e2a715b 100644 --- a/src/offline.html +++ b/src/offline.html @@ -35,12 +35,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/offline/index.html b/src/offline/index.html index ae8988d..9bfafbf 100644 --- a/src/offline/index.html +++ b/src/offline/index.html @@ -82,12 +82,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/resources/scripts/main.ts b/src/resources/scripts/main.ts index 2e9c42d..f63710c 100644 --- a/src/resources/scripts/main.ts +++ b/src/resources/scripts/main.ts @@ -160,8 +160,8 @@ const navigate = { const article = { open: function (articleId: string) { - const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null; - const modalContent = document.querySelector(`#article-${articleId} div`) as HTMLElement | null; + const modal = document.querySelector(`.article[data-article-id='${articleId}']`) as HTMLElement | null; + const modalContent = document.querySelector(`.article[data-article-id='${articleId}'] > div`) as HTMLElement | null; if (!articleAnimationLock && modal && modalContent) { articleAnimationLock = true; modal.style.animation = '0.5s ease-in-out 1 normal article'; @@ -184,7 +184,7 @@ const article = { } }, close: function (articleId: string) { - const modal = document.querySelector(`#article-${articleId}`) as HTMLElement | null; + const modal = document.querySelector(`.article[data-article-id='${articleId}']`) as HTMLElement | null; if (!articleAnimationLock && modal) { articleAnimationLock = true; modal.style.animation = '0.5s ease-in-out 1 reverse article-tempfix'; @@ -301,26 +301,6 @@ const detect = { }; const mods = { - check: function (mod: string): boolean { - const mods: string[] = storage.local.get('mods') ?? []; - return mods.includes(mod); - }, - add: function (mod: string): void { - const mods: string[] = storage.local.get('mods') ?? []; - if (!mods.includes(mod)) { - mods.push(mod); - mods.sort(); - storage.local.set('mods', mods); - } - }, - remove: function (mod: string): void { - const mods: string[] = storage.local.get('mods') ?? []; - const modIndex = mods.indexOf(mod); - if (modIndex !== -1) { - mods.splice(modIndex, 1); - storage.local.set('mods', mods); - } - }, toggle: function (modId: string): void { const mod = `/resources/mods/downloads/${modId}.js`; const mods: string[] = storage.local.get('mods') ?? []; @@ -329,7 +309,7 @@ const mods = { mods.push(mod); mods.sort(); storage.local.set('mods', mods); - const modInstallElem = document.querySelector(`#mod-${modId}`); + const modInstallElem = document.querySelector(`.mod-list > div .links .install[data-mod-id='${modId}']`); if (modInstallElem) { modInstallElem.textContent = 'Uninstall'; modInstallElem.classList.add('installed'); @@ -337,7 +317,7 @@ const mods = { } else { mods.splice(modIndex, 1); storage.local.set('mods', mods); - const modInstallElem = document.querySelector(`#mod-${modId}`); + const modInstallElem = document.querySelector(`.mod-list > div .links .install[data-mod-id='${modId}']`); if (modInstallElem) { modInstallElem.textContent = 'Install'; modInstallElem.classList.remove('installed'); @@ -402,11 +382,13 @@ const base64Gzip = { }, }; -if (detect.mobile()) { - const link = document.createElement('link'); - link.rel = 'stylesheet'; - link.href = '/resources/styles/mobile.css'; - document.head.appendChild(link); +function downloadFile(url: string, name?: string) { + const a = document.createElement('a'); + a.href = url; + a.download = name ?? ''; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); } if (window.location.pathname === '/') { @@ -437,6 +419,13 @@ if (window.location.pathname === '/') { if (iframe.contentWindow) iframe.contentWindow.installPwaEvent = event; }); } else { + if (detect.mobile()) { + const link = document.createElement('link'); + link.rel = 'stylesheet'; + link.href = '/resources/styles/mobile.css'; + document.head.appendChild(link); + } + theme.load(); document.addEventListener('DOMContentLoaded', async () => { @@ -602,7 +591,7 @@ if (window.location.pathname === '/settings/') { } else if (window.location.pathname === '/mods/mods/' || window.location.pathname === '/mods/resourcepacks/') { document.addEventListener('DOMContentLoaded', async () => { const addonType: 'mods' | 'resourcepacks' = window.location.pathname === '/mods/mods/' ? 'mods' : 'resourcepacks'; - const addonData: { + const data: { id: string; name: string; description: string; @@ -612,14 +601,14 @@ if (window.location.pathname === '/settings/') { }[] = (await (await fetch('/resources/data/main.json')).json()).addons; const modList = document.querySelector('.mod-list'); // @ts-expect-error - addonData[addonType].forEach((addon) => { + data[addonType].forEach((addon) => { const modItem = document.createElement('div'); modItem.innerHTML = `
${ addon.name }

By ${addon.author}

${addon.description}

`; modList?.appendChild(modItem); }); @@ -627,11 +616,11 @@ if (window.location.pathname === '/settings/') { if (addonType === 'mods') { const installedMods = storage.local.get('mods') ?? []; const modElements = document.querySelectorAll('.mod-list > div .links .install'); - modElements.forEach((modElement) => { - const modId = /^mod-(.*)$/.exec(modElement.id)?.[1]; + modElements.forEach((element) => { + const modId = (element as HTMLElement).dataset['modId']; if (installedMods.includes(`/resources/mods/downloads/${modId}.js`)) { - modElement.textContent = 'Uninstall'; - modElement.classList.add('installed'); + element.textContent = 'Uninstall'; + element.classList.add('installed'); } }); } @@ -639,27 +628,29 @@ if (window.location.pathname === '/settings/') { } else if (window.location.pathname === '/updates/') { document.addEventListener('DOMContentLoaded', async () => { const updatesContainer = document.querySelector('.updates-container'); - const updateData: { version: string; changelog: string[] }[] = ( + const data: { version: string; changelog: string[] }[] = ( await (await fetch('/resources/data/main.json')).json() ).updates; - updateData.forEach((update) => { - const versionHeader = document.createElement('strong'); - versionHeader.textContent = `MineXLauncher ${update.version}`; - updatesContainer?.appendChild(versionHeader); + data.forEach((update) => { + const version = document.createElement('div'); + const name = document.createElement('strong'); + name.textContent = `MineXLauncher ${update.version}`; - const changelog = document.createElement('ul'); + const changes = document.createElement('ul'); update.changelog.forEach((change) => { - const changelogItem = document.createElement('li'); - changelogItem.textContent = change; - changelog.appendChild(changelogItem); + const item = document.createElement('li'); + item.textContent = change; + changes.appendChild(item); }); - updatesContainer?.appendChild(changelog); + version.appendChild(name); + version.appendChild(changes); + updatesContainer?.appendChild(version); }); }); } if (window.location.hostname === null) { // Stop the minifier from removing these functions - console.debug([navigate, query, versionSelector, game, mods, base64Gzip, article]); + console.debug([navigate, query, versionSelector, game, mods, base64Gzip, article, downloadFile]); } diff --git a/src/resources/styles/themes/default.css b/src/resources/styles/themes/default.css index 34f4b96..bdcaa3c 100644 --- a/src/resources/styles/themes/default.css +++ b/src/resources/styles/themes/default.css @@ -321,21 +321,16 @@ body { display: flex; flex-direction: row; justify-content: space-between; + color: #ddd; font-size: 14px; text-decoration: none; border-top: 1px solid #333; box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.2); } -.bottom-bar > div { - display: flex; - margin: 0 10px; - text-decoration: none; -} - -.bottom-bar > div a:hover { - text-decoration: underline; +.bottom-bar > span[onclick]:hover { cursor: pointer; + text-decoration: underline; } .updates-container { diff --git a/src/servers/index.html b/src/servers/index.html index 5957799..ffddd14 100644 --- a/src/servers/index.html +++ b/src/servers/index.html @@ -62,12 +62,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/settings/index.html b/src/settings/index.html index 1cdcd0d..b106130 100644 --- a/src/settings/index.html +++ b/src/settings/index.html @@ -78,12 +78,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/updates/index.html b/src/updates/index.html index fbf96cc..6c2bab2 100644 --- a/src/updates/index.html +++ b/src/updates/index.html @@ -61,12 +61,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.
diff --git a/src/welcome/index.html b/src/welcome/index.html index 855b192..8744257 100644 --- a/src/welcome/index.html +++ b/src/welcome/index.html @@ -36,12 +36,8 @@
-
- Join the MineXLauncher Discord -
-
- © 2024 MineXLauncher. All rights reserved. -
+ Join the MineXLauncher Discord + © 2024 MineXLauncher. All rights reserved.