Skip to content

Commit 6ea8cbb

Browse files
committed
18.1
- "fix" autoplay on safari - allow options in gti quiz - add new GTI questions
1 parent b70d32e commit 6ea8cbb

6 files changed

Lines changed: 82 additions & 22 deletions

File tree

.eleventy.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@ module.exports = function (eleventyConfig) {
7979
</h2>
8080
`;
8181

82+
if (q.options) {
83+
template += `<div class="options">`;
84+
85+
q.options.forEach((o, j) => {
86+
template += `
87+
<h3 class="option">${j+1}. ${o}</h3>
88+
`;
89+
});
90+
91+
template += `</div>`;
92+
}
93+
8294
let shuffle = q.shuffle || true;
8395

8496
template += `<div class="answer-block" shuffle="${shuffle}">`;

package.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/content/collections/projects/gti.data.json

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,16 @@
6363
},
6464
{
6565
"title": "¿Cuáles son enfoques habituales en la entrega de proyectos?",
66+
"options": [
67+
"Traditional",
68+
"Agile",
69+
"Waterfall"
70+
],
6671
"answers": [
67-
"Traditional y Agile",
68-
"Traditional y Waterfall",
69-
"Agile y Waterfall",
70-
"Traditional, Waterfall y Agile"
72+
"1 y 2",
73+
"1 y 3",
74+
"2 y 3",
75+
"Todas"
7176
],
7277
"correct": 2
7378
},
@@ -311,6 +316,51 @@
311316
"Gestión de Niveles de Servicio"
312317
],
313318
"correct": 1
319+
},
320+
{
321+
"title": "¿Qué práctica tiene como propósito mantener y mejorar el uso eficaz, eficiente y conveniente de la información y el conocimiento a lo largo de la organización?",
322+
"answers": [
323+
"Mejora continua",
324+
"Medición e Informes",
325+
"Gestión de la información",
326+
"Gestión del conocimiento"
327+
],
328+
"correct": 3
329+
},
330+
{
331+
"title": "¿Cuáles de los siguientes roles son responsables de la identificación de oportunidades de mejora?",
332+
"options": [
333+
"Propietario del servicio",
334+
"Gestor de Mejora Continua",
335+
"Propietarios de Procesos"
336+
],
337+
"answers": [
338+
"1 y 2",
339+
"1 y 3",
340+
"2 y 3",
341+
"Todos"
342+
],
343+
"correct": 3
344+
},
345+
{
346+
"title": "¿En qué se deben basar todas las decisiones de mejora continua?",
347+
"answers": [
348+
"Información sobre cómo se miden los servicios",
349+
"Datos analizados de manera precisa y cuidadosa",
350+
"Un cuadro de mando integral actualizado",
351+
"Una evaluación de madurez reciente"
352+
],
353+
"correct": 1
354+
},
355+
{
356+
"title": "El porcentaje de gastos de TI que excede el presupuesto es:",
357+
"answers": [
358+
"No es posible exceder el prespuesto en ITIL",
359+
"Un KPI",
360+
"Un CSF",
361+
"Una métrica"
362+
],
363+
"correct": 1
314364
}
315365
],
316366
"author": "Juan Mier",

src/index.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ css: index
44
js: index
55
---
66

7-
<video id="background" autoplay loop muted></video>
7+
<video id="background" autoplay loop muted playsinline></video>
88
<div id="overlay">
99
<span id="fullscreen-background" class="button light">⛶</span>
1010
<span id="stop-background" class="button light">⨯</span>

src/static/js/app/gti.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,7 @@ window.addEventListener('load', () => { // when the page loads (the content is r
1414
checkbox.addEventListener('change', resetAll);
1515
});
1616

17-
resetAll();
18-
});
19-
20-
window.addEventListener('scroll', () => {
21-
let element = document.getElementById('results');
22-
let stickyPos = element.getBoundingClientRect().top + window.scrollY;
23-
24-
if (window.pageY >= stickyPos) {
25-
element.style.position = 'fixed';
26-
element.style.top = '0';
27-
} else {
28-
element.style.position = 'relative';
29-
element.style.top = 'initial';
30-
}
17+
resetAll(false);
3118
});
3219

3320
function recalc() {
@@ -103,7 +90,10 @@ function round(number) {
10390
return rounded;
10491
}
10592

106-
function resetAll() {
93+
function resetAll(alert = true) {
94+
if (alert && responded != 0 && !window.confirm('esta acción reinicia el progreso del quiz. pulsa OK para continuar.')) {
95+
return;
96+
}
10797
document.getElementById('questions').innerHTML = originalQuestions;
10898

10999
if (document.getElementById('shuffle-questions').checked) {

src/static/js/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,15 @@ fetch('index.data.json').then(response => response.json()).then(data => {
1515
source.src = `/assets/media/${randomize(data.videos)}`;
1616
source.type = 'video/mp4';
1717
videoElement.appendChild(source);
18-
videoElement.play();
18+
let promise = videoElement.play();
19+
20+
if (promise !== undefined) {
21+
promise.catch(error => { // autoplay prevented (safari?)
22+
console.log('autoplay was prevented by user or browser settings');
23+
console.log('use a proper browser (firefox)');
24+
console.log('autoplay can be resumed by clicking the fullscreen button in the bottom-left corner');
25+
});
26+
}
1927
});
2028

2129
const sections = [

0 commit comments

Comments
 (0)