|
13 | 13 | <div id="accounts" style="visibility: hidden;"> |
14 | 14 | <button class="account" onclick="electronAPI.send('login')" style="margin-bottom: 0.5vh;">Add Account</button> |
15 | 15 | </div> |
| 16 | + <button id="account" onclick="clickAccountsButton()"><p style="visibility: hidden;">Click to switch</p></button> |
16 | 17 | <script> |
17 | 18 | const accounts = document.getElementById('accounts') |
18 | 19 | function clickAccountsButton() { |
19 | 20 | if (accounts.children.length <= 1) electronAPI.send('login') |
20 | 21 | else if (accounts.style.visibility == 'visible') accounts.style.visibility = 'hidden' |
21 | 22 | else accounts.style.visibility = 'visible' |
22 | 23 | } |
| 24 | + electronAPI.on('launch', (event, status) => { |
| 25 | + if (status == 'starting') { |
| 26 | + document.getElementById('launch').disabled = true |
| 27 | + document.getElementById('launch').innerText = 'Launching' |
| 28 | + } else if (status == 'download_starting') { |
| 29 | + document.getElementById('launch').innerText = 'Downloading' |
| 30 | + } else if (status == 'downloading_java_starting') { |
| 31 | + document.getElementById('launch').innerText = 'Downloading Java' |
| 32 | + } else if (status == 'downloading_java_done') { |
| 33 | + document.getElementById('launch').innerText = 'Downloading' |
| 34 | + } else if (status == 'downloading_libraries_starting') { |
| 35 | + document.getElementById('launch').innerText = 'Downloading Libraries' |
| 36 | + } else if (status == 'downloading_libraries_done') { |
| 37 | + document.getElementById('launch').innerText = 'Downloading' |
| 38 | + } else if (status == 'downloading_assets_starting') { |
| 39 | + document.getElementById('launch').innerText = 'Downloading Assets' |
| 40 | + } else if (status == 'downloading_assets_done') { |
| 41 | + document.getElementById('launch').innerText = 'Downloading' |
| 42 | + } else if (status == 'downloading_mods_starting') { |
| 43 | + document.getElementById('launch').innerText = 'Downloading Mods' |
| 44 | + } else if (status == 'downloading_mods_done') { |
| 45 | + document.getElementById('launch').innerText = 'Downloading' |
| 46 | + } else if (status == 'download_done') { |
| 47 | + document.getElementById('launch').innerText = 'Launching' |
| 48 | + } else if (status == 'authenticating') { |
| 49 | + document.getElementById('launch').innerText = 'Authenticating' |
| 50 | + } else if (status == 'launching') { |
| 51 | + document.getElementById('launch').innerText = 'Launching' |
| 52 | + } else if (status == 'done' || status == 'error') { |
| 53 | + document.getElementById('launch').disabled = false |
| 54 | + document.getElementById('launch').innerText = `LAUNCH ${document.getElementById('versions-button').innerText}` |
| 55 | + } |
| 56 | + }) |
23 | 57 | </script> |
24 | | - <button id="account" onclick="clickAccountsButton()"><p style="visibility: hidden;">Click to switch</p></button> |
25 | 58 | <img id="avatar" src="https://minotar.net/helm/mhf_question/64.png" draggable="false"> |
26 | 59 | <div id="versions" style="visibility: hidden;"></div> |
27 | 60 | <script> |
|
87 | 120 | electronAPI.on('simpleclient_versions', (event, versionList) => { |
88 | 121 | Array.from(versions.children).forEach(child => child.remove()) |
89 | 122 | const changeVersion = version => { |
90 | | - document.getElementById('launch').innerText = 'LAUNCH ' + version.minecraft_version |
91 | | - document.getElementById('launch').value = version.id |
92 | | - document.getElementById('versions-button').innerText = version.minecraft_version |
| 123 | + document.getElementById('launch').innerText = `LAUNCH ${version.minecraft_version}` |
| 124 | + document.getElementById('launch').value = version.id |
| 125 | + document.getElementById('versions-button').innerText = version.minecraft_version |
93 | 126 | } |
94 | 127 | versionList.forEach(version => { |
95 | 128 | const button = document.createElement('button') |
|
0 commit comments