-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex2.html
246 lines (227 loc) · 7.91 KB
/
index2.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Maximilians Analysis Crackhütte</title>
<link rel="icon" href="logo.ico" type="image/x-icon">
<link rel="icon" href="logo.png" type="image/png">
<style>
/* Grundlayout */
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background: linear-gradient(135deg, #6e8efb, #a777e3);
color: #333;
}
.container {
background-color: #ffffff;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.1);
text-align: center;
width: 320px;
}
/* Logo-Stil */
.logo {
max-width: 250px;
margin-bottom: 10px;
}
/* Titel */
h1 {
font-size: 1.5em;
margin-bottom: 20px;
color: #5a5a5a;
}
/* Textbereich */
#output {
width: 100%;
height: 100px;
font-size: 1.1em;
border: 2px solid #e0e0e0;
border-radius: 8px;
padding: 10px;
resize: none;
box-sizing: border-box;
background-color: #f9f9f9;
color: #555;
margin-bottom: 20px;
}
/* Fortschrittsanzeige */
.progress-container {
width: 100%;
background-color: #e0e0e0;
border-radius: 8px;
overflow: hidden;
margin-bottom: 20px;
height: 20px;
}
.progress-bar {
height: 100%;
width: 0%;
/* Neuer Gradient von Rot über Gelb zu Grün */
background: linear-gradient(to right, #ff5555, #ff9900, #4cda4c);
transition: width 0.3s;
position: relative;
}
.progress-bar #progressText {
position: absolute;
right: 10px;
color: white;
font-weight: bold;
top: 0;
bottom: 0;
display: flex;
align-items: center;
}
/* Buttons */
.button-container {
display: flex;
justify-content: space-between;
gap: 10px;
}
button {
font-size: 1em;
padding: 10px 15px;
color: white;
background-color: #6e8efb;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
display: flex;
align-items: center;
gap: 5px;
}
button:hover {
background-color: #5a6dcf;
}
button:disabled {
background-color: #cccccc;
cursor: not-allowed;
}
/* Spezifischer Stil für den "Zufall"-Button */
#shuffleButton {
background: linear-gradient(45deg, red, blue, violet);
color: white;
border: none;
border-radius: 5px;
padding: 10px 15px;
cursor: pointer;
transition: background-position 0.5s, background-color 0.3s;
background-size: 200% 200%;
}
#shuffleButton:hover {
background-position: right center;
}
/* Shuffle-Icon */
.shuffle-icon {
width: 18px;
height: 18px;
}
</style>
</head>
<body>
<div class="container">
<img src="bodenlos.png" alt="Logo" class="logo">
<h1>Vokabel-Lerner</h1>
<textarea id="output" readonly></textarea>
<!-- Fortschrittsanzeige -->
<div class="progress-container">
<div class="progress-bar" id="progressBar">
<span id="progressText"></span>
</div>
</div>
<div class="button-container">
<button onclick="previousLine()" id="prevButton">Zurück</button>
<!-- Shuffle-Button mit angepasstem Gradient und Icon -->
<button onclick="shuffleLine()" id="shuffleButton">
<img src="shuffle.svg" alt="Shuffle" class="shuffle-icon">
Zufall
</button>
<button onclick="nextLine()" id="nextButton">Weiter</button>
</div>
</div>
<script>
let lines = [];
let currentVisitedIndex = -1;
let visitedIndices = [];
let unseenIndices = [];
// Laden der Textdatei
fetch('Begriffe.txt')
.then(response => response.text())
.then(text => {
lines = text.split('\n'); // Text in Zeilen splitten
unseenIndices = Array.from({length: lines.length}, (v, k) => k); // Indizes initialisieren
shuffleLine(); // Ersten Eintrag anzeigen
updateButtons(); // Buttons aktivieren/deaktivieren
updateProgressBar(); // Fortschrittsanzeige aktualisieren
})
.catch(error => console.error('Fehler beim Laden der Datei:', error));
// Funktion zur Anzeige der aktuellen Zeile
function displayLine() {
const output = document.getElementById('output');
if (currentVisitedIndex >= 0 && currentVisitedIndex < visitedIndices.length) {
const index = visitedIndices[currentVisitedIndex];
output.value = lines[index] || "Ende der Liste erreicht.";
} else {
output.value = "Keine weiteren Einträge.";
}
}
// Funktion für den "Weiter"-Button
function nextLine() {
if (currentVisitedIndex < visitedIndices.length - 1) {
currentVisitedIndex++;
displayLine();
updateButtons();
updateProgressBar();
} else if (unseenIndices.length > 0) {
shuffleLine(); // Nächsten zufälligen Eintrag anzeigen
} else {
alert("Alle Einträge wurden angezeigt.");
}
}
// Funktion für den "Zurück"-Button
function previousLine() {
if (currentVisitedIndex > 0) {
currentVisitedIndex--;
displayLine();
updateButtons();
updateProgressBar();
}
}
// Funktion für den "Shuffle"-Button
function shuffleLine() {
if (unseenIndices.length > 0) {
const randomIndex = Math.floor(Math.random() * unseenIndices.length);
const lineIndex = unseenIndices.splice(randomIndex, 1)[0]; // Index entfernen
visitedIndices.push(lineIndex);
currentVisitedIndex = visitedIndices.length - 1;
displayLine();
updateButtons();
updateProgressBar();
} else {
alert("Alle Einträge wurden angezeigt.");
}
}
// Buttons aktivieren/deaktivieren je nach Position
function updateButtons() {
document.getElementById('prevButton').disabled = currentVisitedIndex <= 0;
const atEnd = (currentVisitedIndex >= visitedIndices.length - 1) && (unseenIndices.length === 0);
document.getElementById('nextButton').disabled = atEnd;
}
// Funktion zum Aktualisieren der Fortschrittsanzeige
function updateProgressBar() {
const progressBar = document.getElementById('progressBar');
const progressText = document.getElementById('progressText');
const percentage = ((lines.length - unseenIndices.length) / lines.length) * 100;
progressBar.style.width = percentage + '%';
progressText.textContent = Math.floor(percentage) + '%';
}
</script>
</body>
</html>