This commit is contained in:
Xes
2025-08-14 22:39:38 +02:00
parent 3641e93527
commit 5403f346e3
3370 changed files with 327179 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
.h5p-guess-answer {
background-color: #FFF;
text-align: center;
color: #555;
}
.h5p-guess-answer-title {
text-align: center;
margin: 1em 1em 0;
font-size: 1.25em;
}
.h5p-guess-answer-title p {
margin: 0.5em auto;
}
.h5p-guess-answer .h5p-image > img {
margin-bottom: 1em;
line-height: 0;
max-width: 100%;
height: auto;
width: auto;
margin-left: auto;
margin-right: auto;
}
.h5p-guess-answer .show-solution-button {
display: block;
line-height: 1em;
cursor: pointer;
font-size: 16px;
border: none;
background-color: #1a73d9;
color: #FFF;
border-radius: 2em;
padding: 0.5em 1em;
margin: 1em auto;
box-sizing: border-box;
max-width: 90%;
}
.h5p-guess-answer .show-solution-button:hover,
.h5p-guess-answer .show-solution-button:focus {
background: #1356a3;
}
.h5p-guess-answer .show-solution-button:active {
background: #104888;
-webkit-box-shadow: inset 0 4px 0 #0e407a;
-moz-box-shadow: inset 0 4px 0 #0e407a;
box-shadow: inset 0 4px 0 #0e407a;
}
.h5p-guess-answer .show-solution-button:before {
content: "\F06E";
font-family: 'H5PFontAwesome4';
padding-right: 0.5em;
}
.h5p-guess-answer .solution-text {
cursor: auto;
padding: 0.5em 0;
margin: 1em;
line-height: 1em;
color: #1a73d9;
font-weight: bold;
}
.h5p-guess-answer .solution-text:focus {
outline: none;
}
.h5p-guess-answer .empty-text-for-nvda {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
}
.h5p-guess-answer .hidden {
display: none;
}

View File

@@ -0,0 +1,149 @@
var H5P = H5P || {};
/**
* Guess the answer module
*/
H5P.GuessTheAnswer = (function () {
/**
* Triggers 'resize' event on an instance. Stops infinite loops
* by not re-triggering the event, when it comes from a sibling
*
* @param {object} siblingInstance
* @return {Function}
*/
function triggerResize(siblingInstance) {
return function (event) {
var fromSibling = event.data && (event.data.fromSibling === true);
if (!fromSibling) {
siblingInstance.trigger('resize', { fromSibling: true });
}
};
}
/**
* Create the media element
*
* @param {object} params
* @param {number} contentId
* @param {object} instance
* @return {Element}
*/
function createMediaElement(params, contentId, instance) {
var element = document.createElement('div');
var mediaInstance = H5P.newRunnable(params, contentId, H5P.jQuery(element), true);
// Resize this instance, on video resize, and vise versa
instance.on('resize', triggerResize(mediaInstance));
mediaInstance.on('resize', triggerResize(instance));
return element;
}
/**
* Initializes the image
*
* @param {Element} imageElement
* @param {object} instance
*/
function initImage(imageElement, instance) {
// if has image, resize on load
if (imageElement) {
imageElement.style.width = null;
imageElement.style.height = null;
imageElement.addEventListener('load', function () {
instance.trigger('resize');
}, false);
}
}
/**
* Simple recusive function the helps set default values without
* destroying object references.
*
* Note: Can be removed if 'babel-plugin-transform-object-assign' is added
*
* @param {object} params values
* @param {object} values default values
*/
var setDefaults = function (params, values) {
for (var prop in values) {
if (values.hasOwnProperty(prop)) {
if (params[prop] === undefined) {
params[prop] = values[prop];
}
else if (params[prop] instanceof Object && !(params[prop] instanceof Array)) {
setDefaults(params[prop], values[prop]);
}
}
}
};
/**
* Initialize module.
*
* @class
* @alias H5P.GuessTheAnswer
* @param {object} params
* @param {number} contentId
*/
function C(params, contentId) {
// Set default behavior.
setDefaults(params, {
taskDescription: '',
solutionLabel: 'Click to see the answer.',
solutionText: ''
});
// get element references
var rootElement = this.rootElement = this.createRootElement(params);
var mediaElement = rootElement.querySelector('.media');
var buttonElement = rootElement.querySelector('.show-solution-button');
var solutionElement = rootElement.querySelector('.solution-text');
// add media
if (params.media) {
var el = createMediaElement(params.media, contentId, this);
initImage(el.querySelector('img'), this);
mediaElement.appendChild(el);
}
// add show solution text on button click
buttonElement.addEventListener('click', function() {
buttonElement.classList.add('hidden');
solutionElement.classList.remove('hidden');
solutionElement.focus();
});
}
/**
* Creates the root element with the markup for the content type
*
* @param {object} params
* @return {Element}
*/
C.prototype.createRootElement = function (params) {
var element = document.createElement('div');
element.classList.add('h5p-guess-answer');
element.innerHTML = '<div class="h5p-guess-answer-title">' + params.taskDescription +'</div>' +
'<div class="media"></div>' +
'<button class="show-solution-button">' + params.solutionLabel + '</button>' +
'<span class="empty-text-for-nvda">&nbsp;</span>' +
'<div class="solution-text hidden" tabindex="-1">' + params.solutionText + '</div>';
return element;
};
/**
* Attach function called by H5P framework to insert H5P content into page.
*
* @param {jQuery} $container The container which will be appended to.
*/
C.prototype.attach = function ($container) {
this.setActivityStarted();
$container.get(0).appendChild(this.rootElement);
};
return C;
})();

View File

@@ -0,0 +1,77 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 225">
<defs>
<style>
.cls-1 {
isolation: isolate;
}
.cls-2 {
fill: #97baf6;
}
.cls-3 {
fill: #34495e;
}
.cls-4 {
fill: #ddd;
}
.cls-5 {
fill: #2882d3;
}
.cls-6 {
opacity: 0.15;
mix-blend-mode: multiply;
}
.cls-7 {
fill: #f1912b;
}
.cls-8 {
fill: #fbc362;
}
.cls-9 {
fill: none;
}
</style>
</defs>
<title>guess the answer</title>
<g class="cls-1">
<g id="Layer_2" data-name="Layer 2">
<g id="guess_the_answer" data-name="guess the answer">
<g>
<polygon class="cls-2" points="278 51.5 140.81 51.5 141.13 151.5 278 151.5 278 51.5"/>
<polygon class="cls-3" points="270.91 98.97 279 107.35 279 153.5 139 153.5 139 132.82 171.09 100.98 187.12 116.9 199.74 104.35 238.1 65.89 270.91 98.97"/>
<circle class="cls-3" cx="163.09" cy="73.07" r="14.58"/>
<path class="cls-4" d="M278.14,51.56V150.4H140.94V51.56h137.2m10.4-10.4h-158V185.84h158V41.16Z"/>
<rect class="cls-5" x="178" y="160.5" width="65" height="18" rx="6.98" ry="6.98"/>
<g id="_Group_" data-name="&lt;Group&gt;">
<g class="cls-6">
<rect x="112.98" y="118.21" width="60.15" height="26.34" rx="7.48" ry="7.48"/>
<path d="M141.92,159.88a56.19,56.19,0,0,1-9.83-.84,40.26,40.26,0,0,1-20.26,10.66c-1.26.24-2.61.47-4,.6a1.52,1.52,0,0,1-1.63-1.11c-.19-.75.37-1.21.93-1.73,2.93-2.75,6.43-4.94,7.64-14.77-8.9-5.45-14.58-13.56-14.58-22.64,0-16.49,18.68-29.82,41.74-29.82s41.74,13.33,41.74,29.82S165,159.88,141.92,159.88ZM124,124.1a6,6,0,1,0,6,6A5.95,5.95,0,0,0,124,124.1Zm17.89,0a6,6,0,1,0,6,6A5.95,5.95,0,0,0,141.92,124.1Zm17.89,0a6,6,0,1,0,6,6A5.95,5.95,0,0,0,159.81,124.1Z"/>
</g>
<g>
<rect class="cls-7" x="110.7" y="115.94" width="60.15" height="26.34" rx="7.48" ry="7.48"/>
<path class="cls-8" d="M139.64,157.61a56.19,56.19,0,0,1-9.83-.84,40.26,40.26,0,0,1-20.26,10.66c-1.26.24-2.61.47-4,.6a1.52,1.52,0,0,1-1.63-1.11c-.19-.75.37-1.21.93-1.73,2.93-2.75,6.43-4.94,7.64-14.77-8.9-5.45-14.58-13.56-14.58-22.64C97.9,111.3,116.58,98,139.64,98s41.74,13.33,41.74,29.82S162.7,157.61,139.64,157.61Zm-17.89-35.78a6,6,0,1,0,6,6A5.95,5.95,0,0,0,121.75,121.83Zm17.89,0a6,6,0,1,0,6,6A5.95,5.95,0,0,0,139.64,121.83Zm17.89,0a6,6,0,1,0,6,6A5.95,5.95,0,0,0,157.53,121.83Z"/>
</g>
</g>
<g id="_Group_2" data-name="&lt;Group&gt;">
<g class="cls-6">
<rect x="254.08" y="118.86" width="48.12" height="22.43" rx="7.48" ry="7.48"/>
<path d="M243.83,130.22c0-13.09,14.83-23.67,33.14-23.67s33.14,10.58,33.14,23.67c0,7.21-4.51,13.65-11.58,18,1,7.8,3.74,9.54,6.07,11.72.44.41.89.78.74,1.37a1.21,1.21,0,0,1-1.29.88c-1.11-.11-2.18-.29-3.18-.48a32,32,0,0,1-16.09-8.47,44.6,44.6,0,0,1-7.8.66C258.66,153.89,243.83,143.31,243.83,130.22Zm42.61,0a4.73,4.73,0,1,0,4.73-4.73A4.72,4.72,0,0,0,286.43,130.22Zm-14.2,0a4.73,4.73,0,1,0,4.73-4.73A4.72,4.72,0,0,0,272.23,130.22Zm-14.2,0a4.73,4.73,0,1,0,4.73-4.73A4.72,4.72,0,0,0,258,130.22Z"/>
</g>
<g>
<rect class="cls-8" x="251.81" y="116.59" width="48.12" height="22.43" rx="7.48" ry="7.48"/>
<path class="cls-7" d="M241.55,127.94c0-13.09,14.83-23.67,33.14-23.67s33.14,10.58,33.14,23.67c0,7.21-4.51,13.65-11.58,18,1,7.8,3.74,9.54,6.07,11.72.44.41.89.78.74,1.37a1.21,1.21,0,0,1-1.29.88c-1.11-.11-2.18-.29-3.18-.48a32,32,0,0,1-16.09-8.47,44.6,44.6,0,0,1-7.8.66C256.38,151.61,241.55,141,241.55,127.94Zm42.61,0a4.73,4.73,0,1,0,4.73-4.73A4.72,4.72,0,0,0,284.16,127.94Zm-14.2,0a4.73,4.73,0,1,0,4.73-4.73A4.72,4.72,0,0,0,270,127.94Zm-14.2,0a4.73,4.73,0,1,0,4.73-4.73A4.72,4.72,0,0,0,255.75,127.94Z"/>
</g>
</g>
</g>
<rect class="cls-9" width="400" height="225"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Описание на задачата",
"description": "Опишете как потребителят трябва да реши задачата."
},
{
"label": "Медия",
"fields": [
{
"label": "Тип",
"description": "Незадължителна медия, която ще се показва над въпроса."
}
]
},
{
"label": "Описателен етикет за решение",
"default": "Кликнете, за да видите отговора.",
"description": "Текстова област с възможност за кликване, където ще се показва решението."
},
{
"label": "Текст на решението",
"description": "Решение за изображението."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Opis zadatka",
"description": "Opišite kako će korinik riješiti zadatak."
},
{
"label": "Media",
"fields": [
{
"label": "Type",
"description": "Optional media to display above the question."
}
]
},
{
"label": "Opisna oznaka za rješenje",
"default": "Kliknite da vitite odgovor",
"description": "Tekstualno područje za klikanje je ono područje gdje će biti prikazano rješenje."
},
{
"label": "Tekst rješenja",
"description": "Rješenje za sliku."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Popis úlohy",
"description": "Popište, jak by měl uživatel úlohu vyřešit."
},
{
"label": "Média",
"fields": [
{
"label": "Typ",
"description": "Volitelná média k zobrazení nad otázkou."
}
]
},
{
"label": "Popisek popisu řešení",
"default": "Kliknutím zobrazte odpověď.",
"description": "Klikatelná textová oblast, kde se zobrazí řešení."
},
{
"label": "Text řešení",
"description": "Řešení pro obrázek."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Aufgabenbeschreibung",
"description": "Beschreibung, wie die Lernenden die Aufgabe lösen sollten. Wird über dem Medium angezeigt."
},
{
"label": "Medium",
"fields": [
{
"label": "Medienart",
"description": "Medium, das wahlweise oberhalb der Aufgabe angezeigt wird."
}
]
},
{
"label": "Beschriftung des \"Lösung anzeigen\"-Buttons",
"default": "Klicken, um die Antwort zu sehen.",
"description": "Klickbarer Text, an dessen Stelle die Lösung erscheinen wird."
},
{
"label": "Lösungstext",
"description": "Die Lösung für die Aufgabe bzw. das Medium."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Περιγραφή άσκησης",
"description": "Περιγράψτε πώς πρέπει ο χρήστης να λύσει την άσκηση."
},
{
"label": "Στοιχείο πολυμέσων",
"fields": [
{
"label": "Τύπος",
"description": "Προσθήκη στοιχείου πολυμέσων προς εμφάνιση πάνω από την ερώτηση (προαιρετικό)."
}
]
},
{
"label": "Ετικέτα περιγραφής λύσης",
"default": "Κάντε κλικ για να δείτε την απάντηση",
"description": "Περιοχή κειμένου, όπου θα εμφανιστεί η λύση με κλικ."
},
{
"label": "Κείμενο λύσης",
"description": "Η λύση για την εικόνα."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Descripción del trabajo",
"description": "Describa como debe resolver el trabajo el usuario."
},
{
"label": "Medio",
"fields": [
{
"label": "Tipo",
"description": "Medio opcional para mostrar arriba de la pregunta."
}
]
},
{
"label": "Etiqueta descriptiva de solución",
"default": "Clic para ver la respuesta.",
"description": "Área de texto elegible en donde será mostrada la solución."
},
{
"label": "Texto de solución",
"description": "La solución para la imagen."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Descripción del trabajo",
"description": "Describa como debe resolver el trabajo el usuario."
},
{
"label": "Medio",
"fields": [
{
"label": "Tipo",
"description": "Medio opcional para mostrar arriba de la pregunta."
}
]
},
{
"label": "Etiqueta descriptiva de solución",
"default": "Clic para ver la respuesta.",
"description": "Área de texto elegible en donde será mostrada la solución."
},
{
"label": "Texto de solución",
"description": "La solución para la imagen."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Ülesande kirjeldus",
"description": "Kirjelda, kuidas kasutaja peaks ülesande lahendama."
},
{
"label": "Meedia",
"fields": [
{
"label": "Tüüp",
"description": "Valikuline meedia küsimusest üleval näitamiseks."
}
]
},
{
"label": "Lahendust kirjeldav silt",
"default": "Vastuse nägemiseks kliki siin.",
"description": "Klikitav tekstiala, kus näidatakse lahendust."
},
{
"label": "Lahenduse tekst",
"description": "Lahendus pildile."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Zereginaren deskribapena",
"description": "Deskribatu zereginaren irtenbidea aurkitzeko modua."
},
{
"label": "Multimedia",
"fields": [
{
"label": "Mota",
"description": "Galderaren azpiko aukerako multimedia."
}
]
},
{
"label": "Emaitza deskriptiboa etiketa",
"default": "Klikatu emaitza ikusteko.",
"description": "Testu area klikagarria non erakutsikoda emaitza."
},
{
"label": "Soluzioaren testua",
"description": "Irudiaren emaitza."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Tehtävänkuvaus",
"description": "Kirjoita miten opiskelijoiden tulisi ratkaista tehtävä"
},
{
"label": "Media",
"fields": [
{
"label": "Tyyppi",
"description": "Vapaaehtoinen media joka näytetään kysymyksen yläpuolella"
}
]
},
{
"label": "Kuvailevan vastauksen teksti",
"default": "Klikkaa nähdäksesi vastauksen",
"description": "Klikattava tekstialue joka näyttää vastauksen."
},
{
"label": "Ratkaisuteksti",
"description": "Kuvan ratkaisu"
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Description de l'activité",
"description": "Décrire comment l'utilisateur devrait réaliser l'activité."
},
{
"label": "Media",
"fields": [
{
"label": "Type",
"description": "Média à afficher en option au dessus de la question."
}
]
},
{
"label": "Intitulé de la description de la solution",
"default": "Cliquer pour voir la réponse.",
"description": "Zone de texte cliquable pour afficher la solution."
},
{
"label": "Texte de la Solution",
"description": "Un texte utilisable comme exemple de solution pour cette activité."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Descrizione del compito",
"description": "Descrivi come l'apprendente deve risolvere il compito"
},
{
"label": "Media",
"fields": [
{
"label": "Tipo",
"description": "Media facoltativo da mostrare sopra la domanda"
}
]
},
{
"label": "Etichetta che descrive la soluzione",
"default": "Clicca per vedere la risposta",
"description": "Area di testo cliccabile dove la soluzione sarà mostrata"
},
{
"label": "Testo della soluzione",
"description": "Soluzione per l'immagine"
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Beskrivelse av oppgaven",
"description": "Beskriv hva brukeren må gjøre for å løse oppgaven."
},
{
"label": "Media",
"fields": [
{
"label": "Type",
"description": "Valgfrit media-element som vises over spørsmålet."
}
]
},
{
"label": "Etikett for løsningsknapp",
"default": "Klikk for å se svar",
"description": "Knapp som vil vise løsningen."
},
{
"label": "Løsningstekst",
"description": "Løsningen på oppgaven gitt av beskrivelse og bildet."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Taakomschrijving",
"description": "Beschrijf hoe de gebruiker de taak dient op te lossen."
},
{
"label": "Media",
"fields": [
{
"label": "Type",
"description": "Optionele media die boven de vraag wordt getoond."
}
]
},
{
"label": "Label voor de beschrijving van de oplossing",
"default": "Klik om het antwoord te zien",
"description": "Het klikbare tekstgebied waar de oplossing zal worden getoond."
},
{
"label": "Tekst voor de oplossing",
"description": "De oplossing voor de afbeelding."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Описание задания",
"description": "Опишите, как пользователь должен решить задачу."
},
{
"label": "Медиа",
"fields": [
{
"label": "Тип",
"description": "Необязательный медиа контент, отображающийся над вопросом."
}
]
},
{
"label": "Кнопка, описывающее решение",
"default": "Для просмотра ответа нажми сюда.",
"description": "Текст для просмотра решения, на который можно кликнуть."
},
{
"label": "Текст решения",
"description": "Решение для изображения."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Task description",
"description": "Describe how the user should solve the task."
},
{
"label": "Media",
"fields": [
{
"label": "Type",
"description": "Optional media to display above the question."
}
]
},
{
"label": "Descriptive solution label",
"default": "Click to see the answer.",
"description": "Clickable text area where the solution will be displayed."
},
{
"label": "Solution text",
"description": "The solution for the picture."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Task description",
"description": "Describe how the user should solve the task."
},
{
"label": "Media",
"fields": [
{
"label": "Type",
"description": "Optional media to display above the question."
}
]
},
{
"label": "Descriptive solution label",
"default": "Click to see the answer.",
"description": "Clickable text area where the solution will be displayed."
},
{
"label": "Solution text",
"description": "The solution for the picture."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Task description",
"description": "Describe how the user should solve the task."
},
{
"label": "Media",
"fields": [
{
"label": "Type",
"description": "Optional media to display above the question."
}
]
},
{
"label": "Descriptive solution label",
"default": "Click to see the answer.",
"description": "Clickable text area where the solution will be displayed."
},
{
"label": "Solution text",
"description": "The solution for the picture."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "Beskrivning av uppgift",
"description": "Beskriv hur användaren ska lösa uppgiften."
},
{
"label": "Media",
"fields": [
{
"label": "Typ",
"description": "Valfri media att visa ovanför frågan."
}
]
},
{
"label": "Etrikett för lösningsbeskrivning",
"default": "Klicka för att se svaret.",
"description": "Klickbart textområde där lösningen visas."
},
{
"label": "Löstningtext",
"description": "Lösningen för bilden."
}
]
}

View File

@@ -0,0 +1,26 @@
{
"semantics": [
{
"label": "任务描述",
"description": "描述用户应该如何解决任务."
},
{
"label": "媒体",
"fields": [
{
"label": "类型",
"description": "可选媒体显示在问题上方."
}
]
},
{
"label": "描述性解决方案标签",
"default": "点击并查看答案.",
"description": "可单击的文本区域将显示解决方案."
},
{
"label": "解决方案文本",
"description": "图片的解决方案."
}
]
}

View File

@@ -0,0 +1,35 @@
{
"title": "Guess the Answer",
"description": "Set up a task where the user will just click to see the answer. No input.",
"majorVersion": 1,
"minorVersion": 4,
"patchVersion": 8,
"runnable": 1,
"coreApi": {
"majorVersion": 1,
"minorVersion": 19
},
"embedTypes": [
"iframe"
],
"author": "Joubel",
"license": "MIT",
"machineName": "H5P.GuessTheAnswer",
"preloadedCss": [
{
"path": "guess-the-answer.css"
}
],
"preloadedJs": [
{
"path": "guess-the-answer.js"
}
],
"preloadedDependencies": [
{
"machineName": "FontAwesome",
"majorVersion": 4,
"minorVersion": 5
}
]
}

View File

@@ -0,0 +1,63 @@
[
{
"label": "Task description",
"importance": "medium",
"name": "taskDescription",
"type": "text",
"widget": "html",
"description": "Describe how the user should solve the task.",
"enterMode": "p",
"tags": [
"strong",
"em",
"u",
"a",
"ul",
"ol",
"h2",
"h3",
"hr",
"pre",
"code"
],
"optional": true
},
{
"name": "media",
"type": "group",
"label": "Media",
"importance": "medium",
"fields": [
{
"name": "type",
"type": "library",
"label": "Type",
"importance": "medium",
"options": [
"H5P.Image 1.1",
"H5P.Video 1.5"
],
"optional": true,
"description": "Optional media to display above the question."
}
]
},
{
"label": "Descriptive solution label",
"importance": "low",
"name": "solutionLabel",
"type": "text",
"widget": "textarea",
"default": "Click to see the answer.",
"description": "Clickable text area where the solution will be displayed.",
"optional": true
},
{
"label": "Solution text",
"importance": "high",
"name": "solutionText",
"type": "text",
"widget": "textarea",
"description": "The solution for the picture."
}
]

View File

@@ -0,0 +1,48 @@
/** @namespace H5PUpgrades */
var H5PUpgrades = H5PUpgrades || {};
H5PUpgrades['H5P.GuessTheAnswer'] = (function () {
/**
* Generates a new UUID
*
* @return {string}
*/
var generateUUID = function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(char) {
var random = Math.random()*16|0, newChar = char === 'x' ? random : (random&0x3|0x8);
return newChar.toString(16);
});
};
return {
1: {
/**
* Asynchronous content upgrade hook.
* Upgrades content parameters to support Guess the Answer 1.2.
*
* Replace the image with optional media (both image and video)
*
* @params {Object} parameters
* @params {function} finished
*/
2: function (parameters, finished) {
if (parameters.solutionImage) {
parameters.media = {
library: 'H5P.Image 1.0',
subContentId: generateUUID(),
params: {
contentName: 'Image',
file: parameters.solutionImage,
alt:'',
title: ''
}
};
delete parameters.solutionImage
}
finished(null, parameters);
}
}
};
})();