forked from sl4shh/mclc-example-launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
201 lines (177 loc) · 4.86 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!--
Sources utilisées:
- IziToast
- Colorlib
-->
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="asset/toast.css" />
<script src="asset/toast.js"></script>
<title>LauncherMC - Login</title>
</head>
<body>
<div class="login-page">
<div class="form">
<input type="text" placeholder="Pseudonyme" id="username" />
<input type="password" placeholder="Mot de passe" id="password" />
<button id="play">Jouer !</button>
</div>
</div>
<script>
// Importation des modules
const ipc = require("electron").ipcRenderer;
const custombar = require("custom-electron-titlebar");
// Variables globales
let playbtn = document.getElementById("play");
// Déclaration de la barre de base
let bar = new custombar.Titlebar({
menu: null,
icon: "asset/logo.png",
backgroundColor: custombar.Color.fromHex("#ffcccc"),
});
// Lors d'un click sur le bouton play, non désactivé
playbtn.addEventListener("click", () => {
playbtn.disabled = true;
let user = document.getElementById("username").value;
let pass = document.getElementById("password").value;
if (user && pass) {
ipc.send("login", { user, pass });
} else {
playbtn.disabled = false;
iziToast.error({
id: "error",
title: "Erreur",
message: "Veuillez entrer des identifiants",
position: "bottomRight",
transitionIn: "fadeInDown",
});
}
});
// Récéption de l'event erreur
ipc.on("err", (event, errorMessage) => {
localStorage.clear();
iziToast.error({
id: "error",
title: "Erreur",
message: errorMessage,
position: "bottomRight",
transitionIn: "fadeInDown",
});
playbtn.disabled = false;
});
</script>
<style>
* {
font-family: sans-serif;
}
@import url(https://fonts.googleapis.com/css?family=Roboto:300);
.login-page {
width: 360px;
padding: 8% 0 0;
margin: auto;
}
.form {
position: relative;
z-index: 1;
background: #ffffff;
max-width: 360px;
margin: 0 auto 100px;
padding: 45px;
text-align: center;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2),
0 5px 5px 0 rgba(0, 0, 0, 0.24);
}
.form input {
font-family: "Roboto", sans-serif;
outline: 0;
background: #f2f2f2;
width: 100%;
border: 0;
margin: 0 0 15px;
padding: 15px;
box-sizing: border-box;
font-size: 14px;
}
.form button {
font-family: "Roboto", sans-serif;
text-transform: uppercase;
outline: 0;
background: #4caf50;
width: 100%;
border: 0;
padding: 15px;
color: #ffffff;
font-size: 14px;
-webkit-transition: all 0.3 ease;
transition: all 0.3 ease;
cursor: pointer;
}
.form button:hover,
.form button:active,
.form button:focus {
background: #43a047;
}
.form button:disabled {
background: #444;
cursor: not-allowed;
}
.form .message {
margin: 15px 0 0;
color: #b3b3b3;
font-size: 12px;
}
.form .message a {
color: #4caf50;
text-decoration: none;
}
.form .register-form {
display: none;
}
.container {
position: relative;
z-index: 1;
max-width: 300px;
margin: 0 auto;
}
.container:before,
.container:after {
content: "";
display: block;
clear: both;
}
.container .info {
margin: 50px auto;
text-align: center;
}
.container .info h1 {
margin: 0 0 15px;
padding: 0;
font-size: 36px;
font-weight: 300;
color: #1a1a1a;
}
.container .info span {
color: #4d4d4d;
font-size: 12px;
}
.container .info span a {
color: #000000;
text-decoration: none;
}
.container .info span .fa {
color: #ef3b3a;
}
body {
background: #76b852;
/* fallback for old browsers */
background: url("./asset/background.jpg");
font-family: "Roboto", sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>
</body>
</html>