87
87
.language-container button : hover {
88
88
background-color : # 0056b3 ;
89
89
}
90
+
91
+ .quick-access {
92
+ display : flex;
93
+ flex-direction : column;
94
+ align-items : center;
95
+ margin-top : 20px ;
96
+ }
97
+
98
+ .quick-access-item {
99
+ display : flex;
100
+ align-items : center;
101
+ margin : 10px 0 ;
102
+ }
103
+
104
+ .quick-access img {
105
+ width : 50px ;
106
+ height : 50px ;
107
+ margin-right : 10px ;
108
+ cursor : pointer;
109
+ border-radius : 50% ;
110
+ transition : transform 0.3s ;
111
+ }
112
+
113
+ .quick-access img : hover {
114
+ transform : scale (1.1 );
115
+ }
116
+
117
+ .quick-access span {
118
+ font-size : 16px ;
119
+ color : # 333 ;
120
+ }
90
121
</ style >
91
122
</ head >
92
123
< body >
@@ -106,6 +137,7 @@ <h2>Anmelden</h2>
106
137
< button type ="submit "> Anmelden</ button >
107
138
</ form >
108
139
< p id ="message "> </ p >
140
+ < div class ="quick-access " id ="quickAccessContainer "> </ div >
109
141
</ div >
110
142
111
143
< div id ="verificationContainer " class ="container " style ="display: none; ">
@@ -122,6 +154,7 @@ <h2>Bestätigungscode</h2>
122
154
if ( language === 'de' ) {
123
155
document . getElementById ( 'languageSelection' ) . style . display = 'none' ;
124
156
document . getElementById ( 'loginContainer' ) . style . display = 'block' ;
157
+ loadQuickAccessIcons ( ) ;
125
158
} else if ( language === 'en' ) {
126
159
window . location . href = './en/en.html' ; // Link zur englischen Version
127
160
}
@@ -147,6 +180,9 @@ <h2>Bestätigungscode</h2>
147
180
if ( users [ username ] && users [ username ] . password === password ) {
148
181
userEmail = users [ username ] . email ; // Vorausgesetzt, die E-Mail wird bei der Registrierung gespeichert
149
182
sendVerificationCode ( userEmail ) ;
183
+ if ( confirm ( 'Möchten Sie ein Schnellzugriffs-Icon für dieses Konto speichern?' ) ) {
184
+ saveQuickAccessIcon ( username ) ;
185
+ }
150
186
document . querySelector ( 'form' ) . style . display = 'none' ;
151
187
document . getElementById ( 'verificationContainer' ) . style . display = 'block' ;
152
188
return false ; // Verhindert das Absenden des Formulars
@@ -170,6 +206,45 @@ <h2>Bestätigungscode</h2>
170
206
return false ;
171
207
}
172
208
}
209
+
210
+ function saveQuickAccessIcon ( username ) {
211
+ let quickAccess = JSON . parse ( localStorage . getItem ( 'quickAccess' ) ) || [ ] ;
212
+ if ( ! quickAccess . includes ( username ) ) {
213
+ quickAccess . push ( username ) ;
214
+ localStorage . setItem ( 'quickAccess' , JSON . stringify ( quickAccess ) ) ;
215
+ }
216
+ }
217
+
218
+ function loadQuickAccessIcons ( ) {
219
+ let quickAccess = JSON . parse ( localStorage . getItem ( 'quickAccess' ) ) || [ ] ;
220
+ const quickAccessContainer = document . getElementById ( 'quickAccessContainer' ) ;
221
+ quickAccessContainer . innerHTML = '' ;
222
+ quickAccess . forEach ( username => {
223
+ const div = document . createElement ( 'div' ) ;
224
+ div . className = 'quick-access-item' ;
225
+ const img = document . createElement ( 'img' ) ;
226
+ img . src = './img/mc_background.png' ; // Pfad zum Standard-Icon
227
+ img . alt = username ;
228
+ img . onclick = ( ) => quickLogin ( username ) ;
229
+ const span = document . createElement ( 'span' ) ;
230
+ span . textContent = username ;
231
+ div . appendChild ( img ) ;
232
+ div . appendChild ( span ) ;
233
+ quickAccessContainer . appendChild ( div ) ;
234
+ } ) ;
235
+ }
236
+
237
+ function quickLogin ( username ) {
238
+ let users = JSON . parse ( localStorage . getItem ( 'users' ) ) || { } ;
239
+ if ( users [ username ] ) {
240
+ document . getElementById ( 'username' ) . value = username ;
241
+ document . getElementById ( 'password' ) . value = users [ username ] . password ;
242
+ startLogin ( ) ;
243
+ }
244
+ }
245
+
246
+ // Lade Schnellzugriffs-Icons beim Laden der Seite
247
+ document . addEventListener ( 'DOMContentLoaded' , loadQuickAccessIcons ) ;
173
248
</ script >
174
249
</ body >
175
250
</ html >
0 commit comments