|
28 | 28 | else if (accounts.style.visibility == 'visible') accounts.style.visibility = 'hidden' |
29 | 29 | else accounts.style.visibility = 'visible' |
30 | 30 | } |
| 31 | + const launchButton = document.getElementById('launch') |
31 | 32 | electronAPI.on('launch', (event, status) => { |
32 | 33 | if (status == 'starting') { |
33 | | - document.getElementById('launch').disabled = true |
34 | | - document.getElementById('launch').innerText = 'Launching' |
| 34 | + launchButton.disabled = true |
| 35 | + launchButton.innerHTML = `<p id="launch-text-1">Launching ${document.getElementById('versions-button').innerText}</p><p id="launch-text-2"></p>` |
35 | 36 | } else if (status == 'downloading') { |
36 | | - document.getElementById('launch').innerText = 'Downloading' |
| 37 | + launchButton.children[1].innerText = 'Downloading' |
37 | 38 | } else if (status == 'downloading_meta') { |
38 | | - document.getElementById('launch').innerText = 'Downloading Metadata' |
| 39 | + launchButton.children[1].innerText = 'Downloading Metadata' |
39 | 40 | } else if (status == 'downloading_java') { |
40 | | - document.getElementById('launch').innerText = 'Downloading Java' |
| 41 | + launchButton.children[1].innerText = 'Downloading Java' |
41 | 42 | } else if (status == 'downloading_fabric') { |
42 | | - document.getElementById('launch').innerText = 'Downloading Fabric Loader' |
| 43 | + launchButton.children[1].innerText = 'Downloading Fabric Loader' |
43 | 44 | } else if (status == 'downloading_libraries') { |
44 | | - document.getElementById('launch').innerText = 'Downloading Libraries' |
| 45 | + launchButton.children[1].innerText = 'Downloading Libraries' |
45 | 46 | } else if (status == 'extracting_natives') { |
46 | | - document.getElementById('launch').innerText = 'Extracting Natives' |
| 47 | + launchButton.children[1].innerText = 'Extracting Natives' |
47 | 48 | } else if (status == 'downloading_assets') { |
48 | | - document.getElementById('launch').innerText = 'Downloading Assets' |
| 49 | + launchButton.children[1].innerText = 'Downloading Assets' |
49 | 50 | } else if (status == 'downloading_mods') { |
50 | | - document.getElementById('launch').innerText = 'Downloading Mods' |
| 51 | + launchButton.children[1].innerText = 'Downloading Mods' |
51 | 52 | } else if (status == 'authenticating') { |
52 | | - document.getElementById('launch').innerText = 'Authenticating' |
| 53 | + launchButton.children[1].innerText = 'Authenticating' |
53 | 54 | } else if (status == 'launching') { |
54 | | - document.getElementById('launch').innerText = 'Launching' |
| 55 | + launchButton.children[1].innerText = 'Launching' |
55 | 56 | } else if (status == 'done') { |
56 | | - document.getElementById('launch').disabled = false |
57 | | - document.getElementById('launch').innerText = `LAUNCH ${document.getElementById('versions-button').innerText}` |
| 57 | + launchButton.disabled = false |
| 58 | + launchButton.innerHTML = `LAUNCH ${document.getElementById('versions-button').innerText}` |
58 | 59 | } else if (status == 'error') { |
59 | | - document.getElementById('launch').disabled = false |
60 | | - document.getElementById('launch').innerText = 'An error ocurred' |
| 60 | + launchButton.disabled = false |
| 61 | + launchButton.innerHTML = `LAUNCH ${document.getElementById('versions-button').innerText}<p id="launch-text-2">An error ocurred</p>` |
61 | 62 | } |
62 | 63 | }) |
63 | 64 | </script> |
|
66 | 67 | <script> |
67 | 68 | electronAPI.on('accounts', (event, accountList, index) => { |
68 | 69 | if (accountList.length == 0) { |
69 | | - document.getElementById('launch').disabled = true |
| 70 | + launchButton.disabled = true |
70 | 71 | document.getElementById('account').value = undefined |
71 | 72 | document.getElementById('account').innerText = 'Login with Microsoft' |
72 | 73 | document.getElementById('avatar').src = 'https://minotar.net/helm/mhf_question/64.png' |
73 | 74 | } else { |
74 | 75 | Array.from(accounts.children).filter(child => child.id).forEach(child => child.remove()) |
75 | 76 | const changeAccount = account => { |
76 | | - document.getElementById('launch').disabled = false |
| 77 | + launchButton.disabled = false |
77 | 78 | document.getElementById('account').value = account.uuid |
78 | 79 | document.getElementById('account').innerText = account.name |
79 | 80 | document.getElementById('avatar').src = `https://minotar.net/helm/${account.uuid}/64.png` |
|
98 | 99 | } |
99 | 100 | electronAPI.on('auth', (event, status) => { |
100 | 101 | if (status == 'starting') { |
101 | | - document.getElementById('launch').disabled = true |
| 102 | + launchButton.disabled = true |
102 | 103 | document.getElementById('account').disabled = true |
103 | 104 | document.getElementById('account').innerText = 'Authenticating...' |
104 | 105 | } else if (status == 'cancelled') { |
105 | | - document.getElementById('launch').disabled = accounts.children.length <= 1 |
| 106 | + launchButton.disabled = accounts.children.length <= 1 |
106 | 107 | document.getElementById('account').disabled = false |
107 | 108 | document.getElementById('account').innerText = 'Login with Microsoft' |
108 | 109 | } else if (status == 'error') { |
109 | | - document.getElementById('launch').disabled = accounts.children.length <= 1 |
| 110 | + launchButton.disabled = accounts.children.length <= 1 |
110 | 111 | document.getElementById('account').disabled = false |
111 | 112 | document.getElementById('account').innerText = 'Login with Microsoft' |
112 | 113 | } else if (status == 'done') { |
113 | | - document.getElementById('launch').disabled = false |
| 114 | + launchButton.disabled = false |
114 | 115 | document.getElementById('account').disabled = false |
115 | 116 | document.getElementById('account').innerText = '' |
116 | 117 | } |
|
126 | 127 | electronAPI.on('simpleclient_versions', (event, versionList) => { |
127 | 128 | Array.from(versions.children).forEach(child => child.remove()) |
128 | 129 | const changeVersion = version => { |
129 | | - document.getElementById('launch').innerText = `LAUNCH ${version.minecraft_version}` |
130 | | - document.getElementById('launch').value = version.id |
| 130 | + launchButton.innerText = `LAUNCH ${version.minecraft_version}` |
| 131 | + launchButton.value = version.id |
131 | 132 | document.getElementById('versions-button').innerText = version.minecraft_version |
132 | 133 | } |
133 | 134 | versionList.forEach(version => { |
|
0 commit comments