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 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="/resources/scripts/main.js"></script>
|
||||
<script>
|
||||
const iframe = document.createElement('iframe');
|
||||
const lastPage = storage.session.get('lastPage');
|
||||
const isMobile = detect.mobile();
|
||||
const iframe = document.createElement('iframe');
|
||||
|
||||
iframe.id = 'main_frame'
|
||||
|
||||
if (storage.local.get('lastVersion') === null) {
|
||||
iframe.src = '/welcome.html';
|
||||
|
@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
window.addEventListener('load', function () {
|
||||
const relayId = Math.floor(Math.random() * 3);
|
||||
|
@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
window.addEventListener('load', () => {
|
||||
const relayId = Math.floor(Math.random() * 3);
|
||||
|
@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
window.addEventListener('load', () => {
|
||||
const relayId = Math.floor(Math.random() * 3);
|
||||
|
@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
window.addEventListener('load', function () {
|
||||
window.minecraftOpts = ['game_frame', 'assets.epk'];
|
||||
|
@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-nocheck
|
||||
const script = document.createElement('script');
|
||||
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;
|
||||
const launcherVersion = '1.5';
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
let installPwaEvent: BeforeInstallPromptEvent;
|
||||
|
||||
const theme = {
|
||||
load: function (themeToLoad?: string) {
|
||||
@ -59,10 +51,10 @@ const versionSelector = {
|
||||
const game = {
|
||||
play: function (version?: string) {
|
||||
if (version) {
|
||||
// @ts-expect-error 123
|
||||
// @ts-expect-error
|
||||
window.top.location.href = version;
|
||||
} else if (selectedVersion) {
|
||||
// @ts-expect-error 123
|
||||
// @ts-expect-error
|
||||
window.top.location.href = selectedVersion;
|
||||
} else {
|
||||
alert('Please select a version to play.');
|
||||
@ -173,7 +165,7 @@ const cookie = {
|
||||
for (const cookie of document.cookie.split('; ')) {
|
||||
const cookiePair = cookie.split('=');
|
||||
if (encodeURIComponent(key) === cookiePair[0]) {
|
||||
// @ts-expect-error 123
|
||||
// @ts-expect-error
|
||||
return decodeURIComponent(cookiePair[1]);
|
||||
}
|
||||
}
|
||||
@ -275,13 +267,14 @@ const detect = {
|
||||
|
||||
if (window.location.pathname === '/') {
|
||||
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 {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// @ts-expect-error 123
|
||||
delete window.installPwaEvent;
|
||||
|
||||
const profileName = document.getElementById('profile-name');
|
||||
if (profileName) {
|
||||
profileName.textContent = storage.local.get('username');
|
||||
@ -306,4 +299,4 @@ if (detect.mobile()) {
|
||||
link.href = '/resources/styles/mobile.css';
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
theme.load();
|
||||
theme.load();
|
||||
|
@ -3,7 +3,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
const data = await response.json();
|
||||
const modListElement = document.querySelector('.mod-list');
|
||||
|
||||
// @ts-expect-error 123
|
||||
// @ts-expect-error
|
||||
data.mods.forEach(({ id, name, description, author, authorLink, source }) => {
|
||||
const div = document.createElement('div');
|
||||
div.classList.add('mod-item');
|
||||
|
@ -3,7 +3,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
const data = await response.json();
|
||||
const modListElement = document.querySelector('.mod-list');
|
||||
|
||||
// @ts-expect-error 123
|
||||
// @ts-expect-error
|
||||
data.resourcepacks.forEach(({ id, name, description, author, authorLink, source }) => {
|
||||
const div = document.createElement('div');
|
||||
div.classList.add('mod-item');
|
||||
|
@ -53,16 +53,15 @@ if (window.location.pathname === '/welcome.html') {
|
||||
while (username.length < 3) {
|
||||
username += '_';
|
||||
}
|
||||
|
||||
storage.local.set('username', username);
|
||||
storage.local.set('theme', themeSelect.value);
|
||||
storage.local.set('lastVersion', launcherVersion);
|
||||
try {
|
||||
// @ts-expect-error 123
|
||||
window.top?.installPwaEvent.prompt();
|
||||
} catch (error) {
|
||||
console.warn('Failed to prompt PWA install:', error);
|
||||
}
|
||||
// @ts-expect-error 123
|
||||
|
||||
// @ts-expect-error
|
||||
installPwaEvent?.prompt();
|
||||
|
||||
// @ts-expect-error
|
||||
window.top.location.href = '/';
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user