mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
done
This commit is contained in:
parent
acb6902814
commit
365d5014d1
@ -1,4 +1,14 @@
|
|||||||
import eslint from '@eslint/js';
|
import eslint from '@eslint/js';
|
||||||
import tseslint from 'typescript-eslint';
|
import tseslint from 'typescript-eslint';
|
||||||
|
|
||||||
export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended);
|
export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, {
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/ban-ts-comment': [
|
||||||
|
{
|
||||||
|
'ts-expect-error': false,
|
||||||
|
'ts-nocheck': false,
|
||||||
|
'ts-check': true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
@ -24,9 +24,11 @@
|
|||||||
<script src="/sw-register.js"></script>
|
<script src="/sw-register.js"></script>
|
||||||
<script src="/resources/scripts/main.js"></script>
|
<script src="/resources/scripts/main.js"></script>
|
||||||
<script>
|
<script>
|
||||||
const iframe = document.createElement('iframe');
|
|
||||||
const lastPage = storage.session.get('lastPage');
|
const lastPage = storage.session.get('lastPage');
|
||||||
const isMobile = detect.mobile();
|
const isMobile = detect.mobile();
|
||||||
|
const iframe = document.createElement('iframe');
|
||||||
|
|
||||||
|
iframe.id = 'main_frame'
|
||||||
|
|
||||||
if (storage.local.get('lastVersion') === null) {
|
if (storage.local.get('lastVersion') === null) {
|
||||||
iframe.src = '/welcome.html';
|
iframe.src = '/welcome.html';
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', function () {
|
||||||
const relayId = Math.floor(Math.random() * 3);
|
const relayId = Math.floor(Math.random() * 3);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
const relayId = Math.floor(Math.random() * 3);
|
const relayId = Math.floor(Math.random() * 3);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
const relayId = Math.floor(Math.random() * 3);
|
const relayId = Math.floor(Math.random() * 3);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', function () {
|
||||||
window.minecraftOpts = ['game_frame', 'assets.epk'];
|
window.minecraftOpts = ['game_frame', 'assets.epk'];
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.async = true;
|
script.async = true;
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
interface BeforeInstallPromptEvent extends Event {
|
|
||||||
readonly platforms: string[];
|
|
||||||
readonly userChoice: Promise<{ outcome: 'accepted' | 'dismissed'; platform: string }>;
|
|
||||||
prompt(): Promise<{ outcome: 'accepted' | 'dismissed'; platform: string }>;
|
|
||||||
}
|
|
||||||
|
|
||||||
let selectedVersion: string | undefined;
|
let selectedVersion: string | undefined;
|
||||||
const launcherVersion = '1.5';
|
const launcherVersion = '1.5';
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
let installPwaEvent: BeforeInstallPromptEvent;
|
|
||||||
|
|
||||||
const theme = {
|
const theme = {
|
||||||
load: function (themeToLoad?: string) {
|
load: function (themeToLoad?: string) {
|
||||||
@ -59,10 +51,10 @@ const versionSelector = {
|
|||||||
const game = {
|
const game = {
|
||||||
play: function (version?: string) {
|
play: function (version?: string) {
|
||||||
if (version) {
|
if (version) {
|
||||||
// @ts-expect-error 123
|
// @ts-expect-error
|
||||||
window.top.location.href = version;
|
window.top.location.href = version;
|
||||||
} else if (selectedVersion) {
|
} else if (selectedVersion) {
|
||||||
// @ts-expect-error 123
|
// @ts-expect-error
|
||||||
window.top.location.href = selectedVersion;
|
window.top.location.href = selectedVersion;
|
||||||
} else {
|
} else {
|
||||||
alert('Please select a version to play.');
|
alert('Please select a version to play.');
|
||||||
@ -173,7 +165,7 @@ const cookie = {
|
|||||||
for (const cookie of document.cookie.split('; ')) {
|
for (const cookie of document.cookie.split('; ')) {
|
||||||
const cookiePair = cookie.split('=');
|
const cookiePair = cookie.split('=');
|
||||||
if (encodeURIComponent(key) === cookiePair[0]) {
|
if (encodeURIComponent(key) === cookiePair[0]) {
|
||||||
// @ts-expect-error 123
|
// @ts-expect-error
|
||||||
return decodeURIComponent(cookiePair[1]);
|
return decodeURIComponent(cookiePair[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,13 +267,14 @@ const detect = {
|
|||||||
|
|
||||||
if (window.location.pathname === '/') {
|
if (window.location.pathname === '/') {
|
||||||
window.addEventListener('beforeinstallprompt', (event) => {
|
window.addEventListener('beforeinstallprompt', (event) => {
|
||||||
installPwaEvent = event as BeforeInstallPromptEvent;
|
const mainFrame = document.getElementById('main_frame') as HTMLIFrameElement;
|
||||||
|
if (mainFrame.contentWindow) {
|
||||||
|
// @ts-expect-error
|
||||||
|
mainFrame.contentWindow.installPwaEvent = event;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
// @ts-expect-error 123
|
|
||||||
delete window.installPwaEvent;
|
|
||||||
|
|
||||||
const profileName = document.getElementById('profile-name');
|
const profileName = document.getElementById('profile-name');
|
||||||
if (profileName) {
|
if (profileName) {
|
||||||
profileName.textContent = storage.local.get('username');
|
profileName.textContent = storage.local.get('username');
|
||||||
|
@ -3,7 +3,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const modListElement = document.querySelector('.mod-list');
|
const modListElement = document.querySelector('.mod-list');
|
||||||
|
|
||||||
// @ts-expect-error 123
|
// @ts-expect-error
|
||||||
data.mods.forEach(({ id, name, description, author, authorLink, source }) => {
|
data.mods.forEach(({ id, name, description, author, authorLink, source }) => {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.classList.add('mod-item');
|
div.classList.add('mod-item');
|
||||||
|
@ -3,7 +3,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const modListElement = document.querySelector('.mod-list');
|
const modListElement = document.querySelector('.mod-list');
|
||||||
|
|
||||||
// @ts-expect-error 123
|
// @ts-expect-error
|
||||||
data.resourcepacks.forEach(({ id, name, description, author, authorLink, source }) => {
|
data.resourcepacks.forEach(({ id, name, description, author, authorLink, source }) => {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.classList.add('mod-item');
|
div.classList.add('mod-item');
|
||||||
|
@ -53,16 +53,15 @@ if (window.location.pathname === '/welcome.html') {
|
|||||||
while (username.length < 3) {
|
while (username.length < 3) {
|
||||||
username += '_';
|
username += '_';
|
||||||
}
|
}
|
||||||
|
|
||||||
storage.local.set('username', username);
|
storage.local.set('username', username);
|
||||||
storage.local.set('theme', themeSelect.value);
|
storage.local.set('theme', themeSelect.value);
|
||||||
storage.local.set('lastVersion', launcherVersion);
|
storage.local.set('lastVersion', launcherVersion);
|
||||||
try {
|
|
||||||
// @ts-expect-error 123
|
// @ts-expect-error
|
||||||
window.top?.installPwaEvent.prompt();
|
installPwaEvent?.prompt();
|
||||||
} catch (error) {
|
|
||||||
console.warn('Failed to prompt PWA install:', error);
|
// @ts-expect-error
|
||||||
}
|
|
||||||
// @ts-expect-error 123
|
|
||||||
window.top.location.href = '/';
|
window.top.location.href = '/';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user