forked from SteffenLehmann/Generico-Filter-Templates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverview.html
More file actions
344 lines (331 loc) · 20.8 KB
/
Copy pathOverview.html
File metadata and controls
344 lines (331 loc) · 20.8 KB
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
<div id="gridContainer" style="margin-left: 15px; margin-right: 15px; width: 100%;">
<div class="card-deck" style="margin-left: 15px; margin-right: 15px; display: flex; flex-wrap: wrap !important; overflow: hidden; justify-content: center;">
<div class="card">
<img class="card-img-top" src="https://www.moodle.aau.dk/pluginfile.php/3268145/mod_resource/content/2/Intro.png" alt="Section image: Two hands shaking">
<div class="card-body">
<h5 class="card-title">Introduction</h5>
<p class="card-text">The purpose of the course</p>
<p class="card-text">How Moodle works<br></p>
<p class="card-text">Learn more about Moodle</p>
<p class="card-text">Suggest new Moodle feature!<br></p>
</div>
</div>
<div class="card">
<img class="card-img-top" src="https://www.moodle.aau.dk/pluginfile.php/3268146/mod_resource/content/1/Templates%282%29.png" alt="Section image: Person looking at templates">
<div class="card-body">
<h5 class="card-title">Course Templates</h5>
<p class="card-text">Why use them</p>
<p class="card-text">How to use them</p>
<p class="card-text">Four templates</p>
</div>
</div>
<div class="card">
<img class="card-img-top" src="https://www.moodle.aau.dk/pluginfile.php/3268147/mod_resource/content/1/Course%20formats.png" alt="Section image: lectures in a grid">
<div class="card-body">
<h5 class="card-title">Section level</h5>
<p class="card-text">Why care about looks?</p>
<p class="card-text">Course formats</p>
<p class="card-text">Summary</p>
<p class="card-text">Hiding content</p>
<p class="card-text">Controlling student access</p>
</div>
</div>
<div class="card">
<img class="card-img-top" src="https://www.moodle.aau.dk/pluginfile.php/3280451/mod_resource/content/2/Display_Content.png" alt="Section image: A projector screen">
<div class="card-body">
<h5 class="card-title">Displaying content</h5>
<p class="card-text">Text and Media Area</p>
<p class="card-text">Collapsible Section</p>
<p class="card-text">Tracking students</p>
<p class="card-text">Access restriction</p>
</div>
</div>
<div class="card">
<img class="card-img-top" src="https://www.moodle.aau.dk/pluginfile.php/3284341/mod_resource/content/2/Uploading%20files.png" alt="Section image: paper with an upload icon">
<div class="card-body">
<h5 class="card-title">Teaching material</h5>
<p class="card-text">Using files</p>
<p class="card-text">Using PDFs</p>
<p class="card-text">Folder</p>
</div>
</div>
<div class="card">
<img class="card-img-top" src="https://www.moodle.aau.dk/pluginfile.php/3268148/mod_resource/content/1/Teaching_activities.png" alt="Section image: play button, books and projector screen">
<div class="card-body">
<h5 class="card-title">Embedding media</h5>
<p class="card-text">Panopto </p>
<p class="card-text">Interactive Content in H5P</p>
<p class="card-text">Linking to external sources</p>
</div>
</div>
<div class="card">
<img class="card-img-top" src="https://www.moodle.aau.dk/pluginfile.php/3268149/mod_resource/content/1/Feedback.png" alt="Section image: two speech bubbles one postive and the other negative">
<div class="card-body">
<h5 class="card-title">Communication</h5>
<p class="card-text">Teacher to student</p>
<p class="card-text">Student to Teacher</p>
<p class="card-text">Student to student</p>
</div>
</div>
<div class="card">
<img class="card-img-top" src="https://www.moodle.aau.dk/pluginfile.php/3268151/mod_resource/content/1/Running%20quizzes%281%29.png" alt="Section image: Student answering a multiple choice Quiz">
<div class="card-body">
<h5 class="card-title">Quiz and exams</h5>
<p class="card-text">Single/group assignment</p>
<p class="card-text">Quizzes in Moodle</p>
<p class="card-text"> Award micro-credential</p>
</div>
</div>
</div>
</div>
<div id="tab">
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="Introduction-tab" data-toggle="tab" href="#introduction" role="tab" aria-controls="home" aria-selected="true">Introduction</a>
</li>
<li class="nav-item">
<a class="nav-link" id="CourseTemplates-tab" data-toggle="tab" href="#CourseTemplates" role="tab" aria-controls="profile" aria-selected="false">Course Templates</a>
</li>
<li class="nav-item">
<a class="nav-link" id="SectionLevel-tab" data-toggle="tab" href="#SectionLevel" role="tab" aria-controls="contact" aria-selected="false">Section level</a>
</li>
<li class="nav-item">
<a class="nav-link" id="DisplayingContent-tab" data-toggle="tab" href="#DisplayingContent" role="tab" aria-controls="contact" aria-selected="false">Displaying Content</a>
</li>
<li class="nav-item">
<a class="nav-link" id="TeachingMaterial-tab" data-toggle="tab" href="#TeachingMaterial" role="tab" aria-controls="home" aria-selected="true">Teaching Material</a>
</li>
<li class="nav-item">
<a class="nav-link" id="EmbeddingMedia-tab" data-toggle="tab" href="#EmbeddingMedia" role="tab" aria-controls="profile" aria-selected="false">Embedding Media</a>
</li>
<li class="nav-item">
<a class="nav-link" id="Communication-tab" data-toggle="tab" href="#Communication" role="tab" aria-controls="contact" aria-selected="false">Communication</a>
</li>
<li class="nav-item">
<a class="nav-link" id="QuizAndExams-tab" data-toggle="tab" href="#QuizAndExams" role="tab" aria-controls="contact" aria-selected="false">Quiz and Exams</a>
</li>
</ul>
<div class="tab-content" id="myTabContent" style="color: #434343; font-size: .875rem; margin-top: 20px;">
<div class="tab-pane active" id="introduction" role="tabpanel" aria-labelledby="introduction-tab">
<div id="flex-container" style="display: flex; align-items: start; position: relative; overflow: hidden">
<div id="tab-text" class="tab-text">
<p class="card-text">The purpose of the course</p>
<p class="card-text">How Moodle works<br></p>
<p class="card-text">Learn more about Moodle</p>
<p class="card-text">Suggest new Moodle feature!<br></p>
</div>
<img id="dynamic-image" class="img-tab" src="https://www.moodle.aau.dk/pluginfile.php/3268145/mod_resource/content/2/Intro.png" alt="Section image: Two hands shaking" style="object-fit: scale-down; margin-left: 15px; display: block; max-width: 45%; margin-left: auto;">
</div>
</div>
<div class="tab-pane fade" id="CourseTemplates" role="tabpanel" aria-labelledby="CourseTemplates-prints">
<div id="flex-container" style="display: flex; align-items: start; position: relative; overflow: hidden">
<div id="tab-text" class="tab-text">
<p class="card-text">Why use them</p>
<p class="card-text">How to use them</p>
<p class="card-text">Four templates</p>
</div>
<img id="dynamic-image" class="img-tab" src="https://www.moodle.aau.dk/pluginfile.php/3268146/mod_resource/content/1/Templates%282%29.png" alt="Section image: Person looking at templates" style="object-fit: scale-down; margin-left: 15px; display: block; max-width: 45%; margin-left: auto;">
</div>
</div>
<div class="tab-pane fade" id="SectionLevel" role="tabpanel" aria-labelledby="SectionLevel">
<div id="flex-container" style="display: flex; align-items: start; position: relative; overflow: hidden">
<div id="tab-text" class="tab-text">
<p class="card-text">Why care about looks?</p>
<p class="card-text">Course formats</p>
<p class="card-text">Summary</p>
<p class="card-text">Hiding content</p>
<p class="card-text">Controlling student access</p>
</div>
<img id="dynamic-image" class="img-tab" src="https://www.moodle.aau.dk/pluginfile.php/3268147/mod_resource/content/1/Course%20formats.png" alt="Section image: lectures in a grid" style="object-fit: scale-down; margin-left: 15px; display: block; max-width: 45%; margin-left: auto;">
</div>
</div>
<div class="tab-pane fade" id="DisplayingContent" role="tabpanel" aria-labelledby="DisplayingContent">
<div id="flex-container" style="display: flex; align-items: start; position: relative; overflow: hidden">
<div id="tab-text" class="tab-text">
<p class="card-text">Text and Media Area</p>
<p class="card-text">Collapsible Section</p>
<p class="card-text">Tracking students</p>
<p class="card-text">Access restriction</p>
</div>
<img id="dynamic-image" class="img-tab" src="https://www.moodle.aau.dk/pluginfile.php/3280451/mod_resource/content/2/Display_Content.png" alt="Section image: A projector screen" style="object-fit: scale-down; margin-left: 15px; display: block; max-width: 45%; margin-left: auto;">
</div>
</div>
<div class="tab-pane fade" id="TeachingMaterial" role="tabpanel" aria-labelledby="TeachingMaterial">
<div id="flex-container" style="display: flex; align-items: start; position: relative; overflow: hidden">
<div id="tab-text" class="tab-text">
<p class="card-text">Using files</p>
<p class="card-text">Using PDFs</p>
<p class="card-text">Folder</p>
</div>
<img id="dynamic-image" class="img-tab" src="https://www.moodle.aau.dk/pluginfile.php/3284341/mod_resource/content/2/Uploading%20files.png" alt="Section image: paper with an upload icon" style="object-fit: scale-down; margin-left: 15px; display: block; max-width: 45%; margin-left: auto;">
</div>
</div>
<div class="tab-pane fade" id="EmbeddingMedia" role="tabpanel" aria-labelledby="Embedding Media">
<div id="flex-container" style="display: flex; align-items: start; position: relative; overflow: hidden">
<div id="tab-text" class="tab-text">
<p class="card-text">Panopto </p>
<p class="card-text">Interactive Content in H5P</p>
<p class="card-text">Linking to external sources</p>
</div>
<img id="dynamic-image" class="img-tab" src="https://www.moodle.aau.dk/pluginfile.php/3268148/mod_resource/content/1/Teaching_activities.png" alt="Section image: play button, books and projector screen" style="object-fit: scale-down; margin-left: 15px; display: block; max-width: 45%; margin-left: auto;">
</div>
</div>
<div class="tab-pane fade" id="Communication" role="tabpanel" aria-labelledby="Communication">
<div id="flex-container" style="display: flex; align-items: start; position: relative; overflow: hidden">
<div id="tab-text" class="tab-text">
<p class="card-text">Teacher to student</p>
<p class="card-text">Student to Teacher</p>
<p class="card-text">Student to student</p>
</div>
<img id="dynamic-image" class="img-tab" src="https://www.moodle.aau.dk/pluginfile.php/3268149/mod_resource/content/1/Feedback.png" alt="Section image: two speech bubbles one postive and the other negative" style="object-fit: scale-down; margin-left: 15px; display: block; max-width: 45%; margin-left: auto;">
</div>
</div>
<div class="tab-pane fade" id="QuizAndExams" role="tabpanel" aria-labelledby="Quiz And Exams">
<div id="flex-container" style="display: flex; align-items: start; position: relative; overflow: hidden">
<div id="tab-text" class="tab-text">
<p class="card-text">Single/group assignment</p>
<p class="card-text">Quizzes in Moodle</p>
<p class="card-text"> Award micro-credential</p>
</div>
<img id="dynamic-image" class="img-tab" src="https://www.moodle.aau.dk/pluginfile.php/3268151/mod_resource/content/1/Running%20quizzes%281%29.png" alt="Section image: Student answering a multiple choice Quiz" style="object-fit: scale-down; margin-left: 15px; display: block; max-width: 45%; margin-left: auto;">
</div>
</div>
</div>
</div>
<script>
// card elemets
const gridContainer = document.getElementById("gridContainer");
const cards = document.getElementsByClassName("card");
const text = document.getElementsByClassName("card-text");
const cardImages = document.getElementsByClassName("card-img-top");
// tab elements
const tab = document.getElementById("tab");
// Moodle elements to check for visibility
const courseIndex = document.getElementById('theme_space-drawers-courseindex');
const rightblockDrawer = document.getElementById('theme_space-drawers-blocks');
const navigationDrawer = document.getElementById('nav-drawer');
// state control
let courseIndexState = false;
let rightblockDrawerState = false;
let navDrawerState = false;
// CSS assingment
const width = '1131';
gridContainer.style.cssText = "horizontalpadding: 20px;";
const cardheight = "400px";
const imageHeightRatio = 0.25;
const imageFit = "scale-down";
//Aply CSS
changeClassParameters(cards, cardheight, "200px");
changeClassParametersTab(text, "#434343", ".875rem");
changeClassParametersImages(cardImages, imageFit, imageHeightRatio, cardheight);
// Initial call to set styles based on window width
updateStyles(courseIndexState, rightblockDrawerState, navDrawerState, width);
// Function to change CSS class parameters for multiple elements
function changeClassParameters(elements, height, width) {
for (let i = 0; i < elements.length; i++) {
let element = elements[i];
element.style.height = height;
element.style.width = width;
element.style.cssText += "margin-left: 1px; margin-right: 1px; margin-bottom: 2px; flex: 1 0 auto; overflow-x: hidden; overflow-y:auto"
}
}
// Function to change CSS class parameters for multiple elements
function changeClassParametersTab(elements, color, fontSize) {
for (let i = 0; i < elements.length; i++) {
let element = elements[i];
element.style.color = color;
element.style.fontSize = fontSize;
}
}
// Function to change CSS class parameters for multiple elements
function changeClassParametersImages(elements, fit, heightRatio, cardheight) {
const dynamicHeight = parseInt(cardheight, 10) * heightRatio;
for (let i = 0; i < elements.length; i++) {
let element = elements[i];
element.style.height = dynamicHeight + "px";
element.style.objectFit = fit;
}
}
//Control flex grow for the flex container that holds the cards
function controlFlexGrow(elements, courseIndexState, rightblockDrawerState, navDrawerState) {
if (window.outerWidth < 1980 || courseIndexState == true && window.outerWidth < 1980 || rightblockDrawerState == true && window.outerWidth < 1980 || navDrawerState == true && window.outerWidth < 1980|| window.outerWidth < 2234 && courseIndexState == true && outerWidth > 1980 || window.outerWidth < 2234 && rightblockDrawerState == true && outerWidth > 1980 || window.outerWidth < 2234 && navDrawerState == true && outerWidth > 1980) {
for (let i = 0; i < elements.length; i++) {
let element = elements[i];
element.style.cssText += "flex: 0 0 auto;"
}
} else if (window.outerWidth >= 1980 && courseIndexState == false && rightblockDrawerState == false && navDrawerState == false || window.outerWidth >= 2234) {
for (let i = 0; i < elements.length; i++) {
let element = elements[i];
element.style.cssText += "flex: 1 0 auto;"
}
}
}
// Add conditional styles based on window width
function tabControl(grid, tab, width, courseIndexState, rightblockDrawerState, navDrawerState) {
if (window.outerWidth < width || window.outerWidth <= 1420 && courseIndexState == true || window.outerWidth <= 1420 && rightblockDrawerState == true | window.outerWidth <= 1420 && navDrawerState == true) {
grid.style.display = "none";
tab.style.display = "block";
return;
} else if (window.outerWidth >= width && courseIndexState == false && rightblockDrawerState == false && navDrawerState == false || window.outerWidth >= 1420 && courseIndexState == true || window.outerWidth >= 1420 && rightblockDrawerState == true || window.outerWidth >= 1420 && navDrawerState == true) {
tab.style.display = "none";
grid.style.display = "block";
}
}
// Function to update styles based on window width
function updateStyles(courseIndexState, rightblockDrawerState, navDrawerState, width) {
controlFlexGrow(cards, courseIndexState, rightblockDrawerState, navDrawerState);
tabControl(gridContainer, tab, width, courseIndexState, rightblockDrawerState, navDrawerState);
}
// Function to check if element is visible
function respondToVisibility(element, width, callback) {
if (element === null || element === undefined) return;
var options = {
root: null, // Use the viewport
threshold: 0 // Call the callback when the element is completely visible or completely hidden
};
var observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
// Check if the element is visible
if (entry.intersectionRatio > 0) {
// Check if the element has the 'closed' class or the 'aria-hidden' attribute set to 'true'
if (element.classList.contains('closed') || element.getAttribute('aria-hidden') === 'true') {
callback(false);
} else {
callback(true);
}
} else {
// Check if the element has the 'closed' class or the 'aria-hidden' attribute set to 'true'
if (element.classList.contains('closed') || element.getAttribute('aria-hidden') === 'true') {
callback(false);
} else {
callback(false);
}
}
});
}, options);
observer.observe(element);
}
// Event listener to update styles on window resize
//window.addEventListener("resize", updateStyles);
window.addEventListener("resize", function() {
updateStyles(courseIndexState, rightblockDrawerState, navDrawerState, width);
});
// Event listener to update styles on window resize based on the Moodle element course index
respondToVisibility(courseIndex, width, function(isVisible) {
courseIndexState = isVisible;
controlFlexGrow(cards, courseIndexState, rightblockDrawerState, navDrawerState);
tabControl(gridContainer, tab, width, courseIndexState, rightblockDrawerState, navDrawerState);
});
// Event listener to update styles on window resize based on the Moodle element right block drawer
respondToVisibility(rightblockDrawer, width, function(isVisible) {
rightblockDrawerState = isVisible;
controlFlexGrow(cards, courseIndexState, rightblockDrawerState, navDrawerState);
tabControl(gridContainer, tab, width, courseIndexState, rightblockDrawerState, navDrawerState);
});
// Event listener to update styles on window resize based on the Moodle element nav drawer
respondToVisibility(navigationDrawer, width, function(isVisible) {
navDrawerState = isVisible;
controlFlexGrow(cards, courseIndexState, rightblockDrawerState, navDrawerState);
tabControl(gridContainer, tab, width, courseIndexState, rightblockDrawerState, navDrawerState);
});
</script>