Skip to content

Commit bcd9d1a

Browse files
committed
Better launch button
1 parent ad5005a commit bcd9d1a

File tree

3 files changed

+56
-25
lines changed

3 files changed

+56
-25
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simplelauncher",
3-
"version": "0.3.20",
3+
"version": "0.4.0",
44
"description": "Launcher for SimpleClient",
55
"main": "src/main.js",
66
"scripts": {

src/gui/index.html

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,37 @@
2828
else if (accounts.style.visibility == 'visible') accounts.style.visibility = 'hidden'
2929
else accounts.style.visibility = 'visible'
3030
}
31+
const launchButton = document.getElementById('launch')
3132
electronAPI.on('launch', (event, status) => {
3233
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>`
3536
} else if (status == 'downloading') {
36-
document.getElementById('launch').innerText = 'Downloading'
37+
launchButton.children[1].innerText = 'Downloading'
3738
} else if (status == 'downloading_meta') {
38-
document.getElementById('launch').innerText = 'Downloading Metadata'
39+
launchButton.children[1].innerText = 'Downloading Metadata'
3940
} else if (status == 'downloading_java') {
40-
document.getElementById('launch').innerText = 'Downloading Java'
41+
launchButton.children[1].innerText = 'Downloading Java'
4142
} else if (status == 'downloading_fabric') {
42-
document.getElementById('launch').innerText = 'Downloading Fabric Loader'
43+
launchButton.children[1].innerText = 'Downloading Fabric Loader'
4344
} else if (status == 'downloading_libraries') {
44-
document.getElementById('launch').innerText = 'Downloading Libraries'
45+
launchButton.children[1].innerText = 'Downloading Libraries'
4546
} else if (status == 'extracting_natives') {
46-
document.getElementById('launch').innerText = 'Extracting Natives'
47+
launchButton.children[1].innerText = 'Extracting Natives'
4748
} else if (status == 'downloading_assets') {
48-
document.getElementById('launch').innerText = 'Downloading Assets'
49+
launchButton.children[1].innerText = 'Downloading Assets'
4950
} else if (status == 'downloading_mods') {
50-
document.getElementById('launch').innerText = 'Downloading Mods'
51+
launchButton.children[1].innerText = 'Downloading Mods'
5152
} else if (status == 'authenticating') {
52-
document.getElementById('launch').innerText = 'Authenticating'
53+
launchButton.children[1].innerText = 'Authenticating'
5354
} else if (status == 'launching') {
54-
document.getElementById('launch').innerText = 'Launching'
55+
launchButton.children[1].innerText = 'Launching'
5556
} 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}`
5859
} 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>`
6162
}
6263
})
6364
</script>
@@ -66,14 +67,14 @@
6667
<script>
6768
electronAPI.on('accounts', (event, accountList, index) => {
6869
if (accountList.length == 0) {
69-
document.getElementById('launch').disabled = true
70+
launchButton.disabled = true
7071
document.getElementById('account').value = undefined
7172
document.getElementById('account').innerText = 'Login with Microsoft'
7273
document.getElementById('avatar').src = 'https://minotar.net/helm/mhf_question/64.png'
7374
} else {
7475
Array.from(accounts.children).filter(child => child.id).forEach(child => child.remove())
7576
const changeAccount = account => {
76-
document.getElementById('launch').disabled = false
77+
launchButton.disabled = false
7778
document.getElementById('account').value = account.uuid
7879
document.getElementById('account').innerText = account.name
7980
document.getElementById('avatar').src = `https://minotar.net/helm/${account.uuid}/64.png`
@@ -98,19 +99,19 @@
9899
}
99100
electronAPI.on('auth', (event, status) => {
100101
if (status == 'starting') {
101-
document.getElementById('launch').disabled = true
102+
launchButton.disabled = true
102103
document.getElementById('account').disabled = true
103104
document.getElementById('account').innerText = 'Authenticating...'
104105
} else if (status == 'cancelled') {
105-
document.getElementById('launch').disabled = accounts.children.length <= 1
106+
launchButton.disabled = accounts.children.length <= 1
106107
document.getElementById('account').disabled = false
107108
document.getElementById('account').innerText = 'Login with Microsoft'
108109
} else if (status == 'error') {
109-
document.getElementById('launch').disabled = accounts.children.length <= 1
110+
launchButton.disabled = accounts.children.length <= 1
110111
document.getElementById('account').disabled = false
111112
document.getElementById('account').innerText = 'Login with Microsoft'
112113
} else if (status == 'done') {
113-
document.getElementById('launch').disabled = false
114+
launchButton.disabled = false
114115
document.getElementById('account').disabled = false
115116
document.getElementById('account').innerText = ''
116117
}
@@ -126,8 +127,8 @@
126127
electronAPI.on('simpleclient_versions', (event, versionList) => {
127128
Array.from(versions.children).forEach(child => child.remove())
128129
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
131132
document.getElementById('versions-button').innerText = version.minecraft_version
132133
}
133134
versionList.forEach(version => {

src/gui/style.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,36 @@ body {
7474
cursor: default;
7575
}
7676

77+
#launch-text-1 {
78+
position: fixed;
79+
width: calc(44vh - 14vh);
80+
height: 4vh;
81+
left: calc(50vw - 44vh / 2);
82+
top: calc(50vh - 3px - 8.5vh);
83+
color: #eeeeee;
84+
font-size: 3vh;
85+
font-weight: 600;
86+
transition-duration: 0.2s;
87+
overflow: hidden;
88+
white-space: nowrap;
89+
text-overflow: ellipsis;
90+
}
91+
92+
#launch-text-2 {
93+
position: fixed;
94+
width: calc(44vh - 14vh);
95+
height: 4vh;
96+
left: calc(50vw - 44vh / 2);
97+
top: calc(50vh - 3px - 4.75vh);
98+
color: #eeeeee;
99+
font-size: 2vh;
100+
font-weight: 600;
101+
transition-duration: 0.2s;
102+
overflow: hidden;
103+
white-space: nowrap;
104+
text-overflow: ellipsis;
105+
}
106+
77107
#account {
78108
position: fixed;
79109
width: calc(44vh - 8vh + 2px);

0 commit comments

Comments
 (0)