-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlearningmap.html
209 lines (189 loc) · 8.84 KB
/
learningmap.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
<!-- Learningmap v.1.3 - Copyright (C) 2021, TRMSC - https://trmsc1.wordpress.com/ -->
<!-- GNU General Public Licence 3.0 - http://www.gnu.de/documents/gpl-3.0.en.html -->
<!-- CODE FOR AN AUTOMATED LEARNINGMAP DEPENDING ON THE CHECKLIST-PROGRESS -->
<!-- J A V A S C R I P T - P A R T -->
<script>
window.onload = function() {
jquery_load_check_interval = setInterval(function() {
if (window.jQuery) {
learningmap();
console.log("jquery successfully loaded...");
console.log($.fn.jquery);
clearInterval(jquery_load_check_interval);
} else {
console.log("new try to load jquery...");
}
}, 150);
function learningmap() {
/* Get information from the checklist */
checklistFinish = parseFloat(
$(".checklist_progress_outer")
.css("width")
.replace("%", "")
.replace(",", ".")
);
checklistProgress = Math.ceil(
parseFloat(
$(".checklist_progress_inner")
.css("width")
.replace("%", "")
.replace(",", ".")
)
);
/* Use checklistRoundup to exclude a result of eg 99%; Change border-radius if progress > o */
var checklistRoundup = 0;
if (checklistProgress > 0) {
checklistRoundup = 0.5;
$("#mapCover").css({
"border-radius": "0px 15px 15px 0px"
});
}
/* Calculate the state */
checklistState = Math.ceil(checklistRoundup + checklistProgress / (checklistFinish / 100));
if (checklistState > 100) {
checklistState = 100;
}
/* Cover the map depending on the state */
$("#mapCover").css({
"margin-left": checklistState + "%"
});
$("#mapCover").css({
width: 100 - checklistState + "%"
});
/* Points */
let mapPointsValue = Math.round(checklistState);
$("#mapPoints").html(mapPointsValue);
/* Emblem */
switch (true) {
case mapPointsValue >= 0 && mapPointsValue < 33:
$("#mapEmblem").addClass("fa-compass");
break;
case mapPointsValue >= 33 && mapPointsValue < 66:
$("#mapEmblem").addClass("fa-flask");
break;
case mapPointsValue >= 66 && mapPointsValue < 100:
$("#mapEmblem").addClass("fa-magic");
break;
case mapPointsValue == 100:
$("#mapEmblem").addClass("fa-diamond");
break;
}
/* Stars */
switch (true) {
case mapPointsValue == 0:
$("#mapStars").html("0");
break;
case mapPointsValue > 0 && mapPointsValue < 25:
$("#mapStars").html("1");
break;
case mapPointsValue >= 25 && mapPointsValue < 50:
$("#mapStars").html("2");
break;
case mapPointsValue >= 50 && mapPointsValue < 75:
$("#mapStars").html("3");
break;
case mapPointsValue >= 75 && mapPointsValue < 100:
$("#mapStars").html("4");
break;
case mapPointsValue == 100:
$("#mapStars").html("5");
break;
}
/* Days */
var mapDateValue = new Date();
var mapTodayValue = mapDateValue.getDay();
if (mapTodayValue == 0) {
mapTodayValue = 7;
}
$("#mapToday").html(mapTodayValue);
if (mapTodayValue > 5) {
mapTodayValue = 5;
}
var mapLeftdaysValue = 5 - mapTodayValue;
if (mapLeftdaysValue == 1) {
$("#mapLeftdays").html(mapLeftdaysValue + " Tag");
} else {
$("#mapLeftdays").html(mapLeftdaysValue + " Tage");
}
/* Chart */
mapChartValue = mapPointsValue / mapTodayValue;
switch (true) {
case mapChartValue >= 20 && mapChartValue < 100:
$("#mapChart").html("Weiter so!");
break;
case mapChartValue < 20 && mapTodayValue < 5:
$("#mapChart").html("Halte dich ran!");
break;
case mapPointsValue < 100 && mapTodayValue == 5:
$("#mapChart").html("Letzte Chance!");
break;
case mapPointsValue >= 100:
$("#mapChart").html("Starke Leistung!");
break;
}
/* Loading animation */
$(".mapLoadingfield").css("filter", "opacity(1)");
mapLoading = setInterval(function() {
clearInterval(mapLoading);
$("#mapContent").css("cursor", "auto");
}, 2200);
}
};
</script>
<!-- H T M L - P A R T -->
<!-- Cursor and Heading -->
<br>
<div id="mapContent" style="cursor:wait;">
<h2 class="mapLoadingfield" style="text-align: center; transition: all cubic-bezier(0.41, 0.71, 0.57, 1) 2s; filter: opacity(0.9)">Deine Lernlandkarte in dieser Woche:</h2>
<!-- BACKGROUND OF THE MAP -->
<div id="mapBackground" style="
background-image: url(
GROßGESCHRIEBENES ERSETZEN: BILDADRESSE FÜR DEN HINTERGRUND OHNE ANFÜHRUNGSZEICHEN
);
background-size: cover;
background-position: right;
padding: 0px;
border: 3px solid #c5c1ae;
border-radius: 20px;
">
<!-- COVER OF THE MAP -->
<div id="mapCover" style="
background-image: linear-gradient(271deg, rgb(0 0 0 / 7%) 95%, rgb(255 243 220 / 31%) 100%, transparent 35%), url(
GROßGESCHRIEBENES ERSETZEN: BILDADRESSE FÜR DIE ABDECKUNG OHNE ANFÜHRUNGSZEICHEN
);
background-size: initial;
background-repeat: no-repeat;
width: 100%;
height: 350px;
margin-left: 0%;
border-radius: 15px;
overflow: hidden;
transition: all cubic-bezier(0.45, 0.71, 0.51, 1.22) 2s;
"></div>
</div>
<br>
<!-- Part under the map -->
<div class="row mapLoadingfield" style="margin: 0px!important; padding-left: 10px; padding-right: 10px; transition: all cubic-bezier(0.41, 0.71, 0.57, 1) 2s; filter: opacity(0.7)">
<div class="col-sm-1" style="align-self: center; text-align: left;">
<h3>
<i id="mapEmblem" class="fa" style="border: 2px #bbae8d; border-style: dashed; border-radius: 100%; padding: 8px; background-color: #f7ffba;"></i>
</h3>
</div>
<div class="col">
<h5 style="align-self: center; text-align: center">
<i class="fa fa-star" style="border: 2px solid #6c757d; padding: 10px; margin-top: 5px; margin-bottom: 5px; border-radius: 10px 0px; background-color: rgb(245 255 169 / 80%);"> <span id="mapStars"></span></i> |
<i class="fa fa-leaf" style="border: 2px solid #6c757d; padding: 10px; margin-top: 5px; margin-bottom: 5px; border-radius: 10px 0px; background-color: rgb(245 255 169 / 80%);"> <span id="mapPoints"></span>/100</i> |
<i class="fa fa-map-pin" style="border: 2px solid #6c757d; padding: 10px; margin-top: 5px; margin-bottom: 5px; border-radius: 10px 0px; background-color: rgb(245 255 169 / 80%);"> Tag <span id="mapToday"></span></i> |
<i class="fa fa-fire" style="border: 2px solid #6c757d; padding: 10px; margin-top: 5px; margin-bottom: 5px; border-radius: 10px 0px; background-color: rgb(245 255 169 / 80%);"> Noch <span id="mapLeftdays"></span></i> |
<i class="fa fa-line-chart" style="border: 2px solid #6c757d; padding: 10px; margin-top: 5px; margin-bottom: 5px; border-radius: 10px 0px; background-color: rgb(245 255 169 / 80%);"> <span id="mapChart"></span></i>
</h5>
</div>
<div class="col-sm-1" style="align-self: center; text-align: right;">
<h3>
<a href="" onclick="javascript: window.location.href"><i class="fa fa-refresh" data-toggle="tooltip" title="" data-original-title="Neu laden"></i></a><br>
</h3>
</div>
</div>
</div>
<!-- Vor dem Speichern sollte unter dieser Zeile <p><br></p> stehen. -->
<p><br></p>