Invalid library
-
Hello,
Since 2 updates, I can no longer create new activities but old activities still work.
If I click on “Add an activity” then, on “Fill in the blanks” then on “Use” I see “Loading, please wait” and it never stops.
If I click on “Create”, at the top of the page I see “Invalid library”.
I tried with other libraries, it’s the same.
I even installed new libraries that I do not need and it’s the same.
I went to “Libraries” and my library is up to date …Thank you for helping me.
The page I need help with: [log in to see the link]
-
Could you open your browser’s console (Ctrl+Shift+J in Chrome) and look for any error messages when pressing use?
Sounds like it could be some AJAX issue.
Thank you for responding so quick !
Yes, “Ajax request failed”
SyntaxError: Unexpected token h in JSON at position 0
at JSON.parse (<anonymous>)
at parseJSON (jquery.js?ver=1.9.4:2)
at Fn (jquery.js?ver=1.9.4:4)
at k (jquery.js?ver=1.9.4:4)
at XMLHttpRequest.r (jquery.js?ver=1.9.4:4)I don’t know ajax… what can I do ?
(sorry for my very bad english).
You’re going to have to go into the network tab of the console and look at the request and what it returns.
Also, you should check the web server’s error_log file to see if that contains any clues as to what may be breaking the JSON.Hello, here is the response from my webhost :
In the network tab, when I click on admin-ajax.php=token=8ed5…
I see :
[{"name":"H5P.Column","title":"Column","majorVersion":"1","minorVersion":"4","tutorialUrl":"","restricted":false},{"name":"H5P.DragQuestion","title":"Drag and Drop","majorVersion":"1","minorVersion":"9","tutorialUrl":"","restricted":false,"isOld":true},{"name":"H5P.DragQuestion","title":"Drag and Drop","majorVersion":"1","minorVersion":"10","tutorialUrl":"","restricted":false},{"name":"H5P.DragText","title":"Drag Text","majorVersion":"1","minorVersion":"5","tutorialUrl":"","restricted":false,"isOld":true},{"name":"H5P.DragText","title":"Drag Text","majorVersion":"1","minorVersion":"6","tutorialUrl":"","restricted":false},{"name":"H5P.Blanks","title":"Fill in the Blanks","majorVersion":"1","minorVersion":"8","tutorialUrl":"","restricted":false},{"name":"H5P.MultiChoice","title":"Multiple Choice","majorVersion":"1","minorVersion":"9","tutorialUrl":"","restricted":false},{"name":"H5P.TrueFalse","title":"True\/False Question","majorVersion":"1","minorVersion":"1","tutorialUrl":"","restricted":false}]
However, when I click on “Fill in the Blanks”, there is an ajax call with the following response :
https://cours.celtiweb.com/wp-content/themes/responsive{"semantics":[{"name":"media","type":"group","label":"Media","importance":"medium","fields":[{"name":"type","type":"library","label":"Type","options":["H5P.Image 1.0","H5P.Video 1.3"],"optional":true,"description":"Optional media to display above the question."}]},{"label":"Task description","importance":"high","name":"text","type":"text","widget":"html","default":"Fill in the missing words","description":"A guide telling the user how to answer this task.","enterMode":"p","tags":["strong","em","u","a","ul","ol","h2","h3","hr"]},{"name":"questions","type":"list","label":"Text blocks","importance":"high","entity":"text block","min":1,"max":31,"field":{"name":"question","type":"text","widget":"html","label":"Line of text","importance":"high","placeholder":"Oslo is the capital of *Norway*.","description":"","important":{"description":"<ul><li>Blanks are added with an asterisk (*) in front and behind the correct word\/phrase.<\/li><li>Alternative answers are separated with a forward slash (\/).<\/li><li>You may add a textual tip, using a colon (:) in front of the tip.<\/li><\/ul>","example":"H5P content may be edited using a *browser\/web-browser:Something you use every day*."},"enterMode":"p","tags":["strong","em","del","u"]}},{"name":"overallFeedback","type":"group","label":"Overall Feedback","importance":"low","expanded":true,"fields":[{"name":"overallFeedback","type":"list","widgets":[{"name":"RangeList","label":"Default"}],"importance":"high","label":"Define custom feedback for any score range","description":"Click the \"Add range\" button to add as many ranges as you need. Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!","entity":"range","min":1,"defaultNum":1,"optional":true,"field":{"name":"overallFeedback","type":"group","importance":"low","fields":[{"name":"from","type":"number","label":"Score Range","min":0,"max":100,"default":0,"unit":"%"},{"name":"to","type":"number","min":0,"max":100,"default":100,"unit":"%"},{"name":"feedback","type":"text","label":"Feedback for defined score range","importance":"low","placeholder":"Fill in the feedback","optional":true}]}}]},{"label":"Text for \"Show solutions\" button","name":"showSolutions","type":"text","default":"Show solution","common":true},{"label":"Text for \"Retry\" button","importance":"low","name":"tryAgain","type":"text","default":"Retry","common":true,"optional":true},{"label":"Text for \"Check\" button","importance":"low","name":"checkAnswer","type":"text","default":"Check","common":true,"optional":true},{"label":"Text for \"Not filled out\" message","importance":"low","name":"notFilledOut","type":"text","default":"Please fill in all blanks to view solution","common":true,"optional":true},{"label":"Text for \"':ans' is correct\" message","importance":"low","name":"answerIsCorrect","type":"text","default":"':ans' is correct","common":true,"optional":true},{"label":"Text for \"':ans' is wrong\" message","importance":"low","name":"answerIsWrong","type":"text","default":"':ans' is wrong","common":true,"optional":true},{"label":"Text for \"Answered correctly\" message","importance":"low","name":"answeredCorrectly","type":"text","default":"Answered correctly","common":true,"optional":true},{"label":"Text for \"Answered incorrectly\" message","importance":"low","name":"answeredIncorrectly","type":"text","default":"Answered incorrectly","common":true,"optional":true},{"label":"Assistive technology label for solution","importance":"low","name":"solutionLabel","type":"text","default":"Correct answer:","common":true,"optional":true},{"label":"Assistive technology label for input field","importance":"low","name":"inputLabel","type":"text","description":"Use @num and @total to replace current cloze number and total cloze number","default":"Blank input @num of @total","common":true,"optional":true},{"label":"Assistive technology label for saying an input has a tip tied to it","importance":"low","name":"inputHasTipLabel","type":"text","default":"Tip available","common":true,"optional":true},{"label":"Tip icon label","importance":"low","name":"tipLabel","type":"text","default":"Tip","common":true,"optional":true},{"name":"behaviour","type":"group","label":"Behavioural settings.","importance":"low","description":"These options will let you control how the task behaves.","optional":true,"fields":[{"label":"Enable \"Retry\"","importance":"low","name":"enableRetry","type":"boolean","default":true,"optional":true},{"label":"Enable \"Show solutions\" button","importance":"low","name":"enableSolutionsButton","type":"boolean","default":true,"optional":true},{"label":"Automatically check answers after input","importance":"low","name":"autoCheck","type":"boolean","default":false,"optional":true},{"name":"caseSensitive","importance":"low","type":"boolean","default":true,"label":"Case sensitive","description":"Makes sure the user input has to be exactly the same as the answer."},{"label":"Require all fields to be answered before the solution can be viewed","importance":"low","name":"showSolutionsRequiresInput","type":"boolean","default":true,"optional":true},{"label":"Put input fields on separate lines","importance":"low","name":"separateLines","type":"boolean","default":false,"optional":true},{"label":"Disable image zooming for question image","importance":"low","name":"disableImageZooming","type":"boolean","default":false,"optional":true},{"label":"Show confirmation dialog on \"Check\"","importance":"low","name":"confirmCheckDialog","type":"boolean","description":"This options is not compatible with the \"Automatically check answers after input\" option","default":false},{"label":"Show confirmation dialog on \"Retry\"","importance":"low","name":"confirmRetryDialog","type":"boolean","default":false},{"name":"acceptSpellingErrors","type":"boolean","label":"Accept minor spelling errors","importance":"low","description":"If activated, an answer will also count as correct with minor spelling errors","default":false,"optional":true}]},{"label":"Check confirmation dialog","importance":"low","name":"confirmCheck","type":"group","common":true,"fields":[{"label":"Header text","importance":"low","name":"header","type":"text","default":"Finish ?"},{"label":"Body text","importance":"low","name":"body","type":"text","default":"Are you sure you wish to finish ?","widget":"html","enterMode":"p","tags":["strong","em","del","u"]},{"label":"Cancel button label","importance":"low","name":"cancelLabel","type":"text","default":"Cancel"},{"label":"Confirm button label","importance":"low","name":"confirmLabel","type":"text","default":"Finish"}]},{"label":"Retry confirmation dialog","importance":"low","name":"confirmRetry","type":"group","common":true,"fields":[{"label":"Header text","importance":"low","name":"header","type":"text","default":"Retry ?"},{"label":"Body text","importance":"low","name":"body","type":"text","default":"Are you sure you wish to retry ?","widget":"html","enterMode":"p","tags":["strong","em","del","u"]},{"label":"Cancel button label","importance":"low","name":"cancelLabel","type":"text","default":"Cancel"},{"label":"Confirm button label","importance":"low","name":"confirmLabel","type":"text","default":"Confirm"}]},{"name":"scoreBarLabel","type":"text","label":"Textual representation of the score bar for those using a readspeaker","default":"You got :num out of :total points","importance":"low","common":true}],"language":"{\n \"semantics\": [\n {\n \"label\": \"Fichier m\u00e9dia\",\n \"fields\": [\n {\n \"label\": \"Type de m\u00e9dia\",\n \"description\": \"Fichier m\u00e9dia \u00e0 afficher en option au-dessus de la question.\"\n }\n ]\n },\n {\n \"label\": \"Consigne\",\n \"default\": \"Compl\u00e9tez les blancs.\",\n \"description\": \"La consigne indique \u00e0 l'utilisateur comment faire l'exercice.\"\n },\n {\n \"label\": \"Blocs de texte\",\n \"entity\": \"bloc de texte\",\n \"field\": {\n \"label\": \"Ligne de texte\",\n \"placeholder\": \"Paris est la capitale de la *France*.\",\n \"description\": \"\",\n \"important\": {\n \"description\": \"<ul><li>Blanks are added with an asterisk (*) in front and behind the correct word\/phrase.<\/li><li>Alternative answers are separated with a forward slash (\/).<\/li><li>You may add a textual tip, using a colon (:) in front of the tip.<\/li><\/ul>\"\n }\n }\n },\n {\n \"label\": \"Overall Feedback\",\n \"fields\": [\n {\n \"widgets\": [\n {\n \"label\": \"Default\"\n }\n ],\n \"label\": \"Define custom feedback for any score range\",\n \"description\": \"Click the \\\"Add range\\\" button to add as many ranges as you need. Example: 0-20% Bad score, 21-91% Average Score, 91-100% Great Score!\",\n \"entity\": \"range\",\n \"field\": {\n \"fields\": [\n {\n \"label\": \"Score Range\"\n },\n {},\n {\n \"label\": \"Feedback for defined score range\",\n \"placeholder\": \"Fill in the feedback\"\n }\n ]\n }\n }\n ]\n },\n {\n \"label\": \"Texte du bouton \\\"Voir la correction\\\"\",\n \"default\": \"Voir la correction\"\n },\n {\n \"label\": \"Texte du bouton \\\"Recommencer\\\"\",\n \"default\": \"Recommencer\"\n },\n {\n \"label\": \"Texte du bouton \\\"V\u00e9rifier\\\"\",\n \"default\": \"V\u00e9rifier\"\n },\n {\n \"label\": \"Texte pour le message \\\"Tout n'est pas compl\u00e9t\u00e9\\\"\",\n \"default\": \"Vous devez avoir rempli tous les blancs avant de voir la correction\"\n },\n {\n \"label\": \"Texte du message \\\"':ans' est une r\u00e9ponse exacte\\\"\",\n \"default\": \"':ans' est une r\u00e9ponse exacte\"\n },\n {\n \"label\": \"Texte du message \\\"':ans' est une r\u00e9ponse incorrecte\\\"\",\n \"default\": \"':ans' est une r\u00e9ponse incorrecte\"\n },\n {\n \"label\": \"Texte du message \\\"R\u00e9ponse exacte\\\"\",\n \"default\": \"R\u00e9ponse exacte\"\n },\n {\n \"label\": \"Texte du message \\\"Mauvaise r\u00e9ponse\\\"\",\n \"default\": \"Mauvaise r\u00e9ponse\"\n },\n {\n \"label\": \"Texte de la correction (technologie d'assistance)\",\n \"default\": \"R\u00e9ponse correcte :\"\n },\n {\n \"label\": \"Texte du blanc (technologie d'assistance)\",\n \"description\": \"Utilisez @num et @total pour d\u00e9signer respectivement le blanc courant et le nombre total de blancs\",\n \"default\": \"Blanc @num sur @total\"\n },\n {\n \"label\": \"Texte qui indique qu'un blanc dispose d'un indice (technologie d'assistance)\",\n \"default\": \"Indice disponible\"\n },\n {\n \"label\": \"Intitul\u00e9 de l'ic\u00f4ne de l'indice\",\n \"default\": \"Indice\"\n },\n {\n \"label\": \"Options g\u00e9n\u00e9rales.\",\n \"description\": \"Ces options vous permettent de param\u00e9trer le d\u00e9roulement de l'exercice.\",\n \"fields\": [\n {\n \"label\": \"Activer le bouton \\\"Recommencer\\\"\"\n },\n {\n \"label\": \"Activer le bouton \\\"Voir la correction\\\"\"\n },\n {\n \"label\": \"V\u00e9rifier les r\u00e9ponses instantan\u00e9ment d\u00e8s la saisie.\"\n },\n {\n \"label\": \"Sensible \u00e0 la casse\",\n \"description\": \"La saisie de l'utilisateur devra \u00eatre exactement identique \u00e0 la r\u00e9ponse attendue.\"\n },\n {\n \"label\": \"Obliger l'utilisateur \u00e0 remplir tous les blancs avant de voir la correction.\"\n },\n {\n \"label\": \"Afficher les blancs sur des lignes s\u00e9par\u00e9es.\"\n },\n {\n \"label\": \"D\u00e9sactiver l'agrandissement de l'image de la question.\"\n },\n {\n \"label\": \"Afficher la fen\u00eatre de confirmation pour \\\"V\u00e9rifier\\\"\",\n \"description\": \"Cette option n'est pas compatible avec l'option \\\"V\u00e9rifier les r\u00e9ponses instantan\u00e9ment d\u00e8s la saisie.\\\"\"\n },\n {\n \"label\": \"Afficher la fen\u00eatre de confirmation pour \\\"Recommencer\\\"\"\n },\n {\n \"label\": \"Accept minor spelling errors\",\n \"description\": \"If activated, an answer will also count as correct with minor spelling errors\"\n }\n ]\n },\n {\n \"label\": \"Fen\u00eatre de confirmation pour \\\"V\u00e9rifier\\\"\",\n \"fields\": [\n {\n \"label\": \"Titre\",\n \"default\": \"Terminer ?\"\n },\n {\n \"label\": \"Contenu\",\n \"default\": \"\u00cates-vous s\u00fbr de vouloir terminer ?\"\n },\n {\n \"label\": \"Intitul\u00e9 du bouton d'annulation\",\n \"default\": \"Annuler\"\n },\n {\n \"label\": \"Intitul\u00e9 du bouton de confirmation\",\n \"default\": \"Terminer\"\n }\n ]\n },\n {\n \"label\": \"Fen\u00eatre de confirmation pour \\\"Recommencer\\\"\",\n \"fields\": [\n {\n \"label\": \"Titre\",\n \"default\": \"Recommencer ?\"\n },\n {\n \"label\": \"Contenu\",\n \"default\": \"\u00cates-vous s\u00fbr de vouloir recommencer ?\"\n },\n {\n \"label\": \"Intitul\u00e9 du bouton d'annulation\",\n \"default\": \"Annuler\"\n },\n {\n \"label\": \"Intitul\u00e9 du bouton de confirmation\",\n \"default\": \"Confirmer\"\n }\n ]\n },\n {\n \"label\": \"Textual representation of the score bar for those using a readspeaker\",\n \"default\": \"You got :num out of :total points\"\n }\n ]\n}","javascript":{"\/wp-content\/uploads\/h5p\/libraries\/H5PEditor.TableList-1.0\/h5p-editor-table-list.js?ver=1.0.2":"\nH5PEditor.TableList = (function ($, EventDispatcher) {\n\n \/**\n * Renders UI for the table list.\n *\n * @class\n * @extends H5P.EventDispatcher\n * @param {List} list\n * @param {string} [extraClass]\n *\/\n function TableList(list, extraClass) {\n var self = this;\n\n \/\/ Initialize inheritance\n EventDispatcher.call(self);\n\n \/\/ Grab entity and make first letter upper case\n var entity = list.getEntity();\n entity = entity.substr(0,1).toLocaleUpperCase() + entity.substr(1);\n\n \/\/ Create DOM structure elements for the table\n var $wrapper = $('<table\/>', {\n 'class': 'h5p-editor-table-list' + (extraClass ? ' ' + extraClass : '')\n });\n var $thead = $('<thead\/>', {\n appendTo: $wrapper\n });\n var $headRow;\n var $tbody = $('<tbody\/>', {\n appendTo: $wrapper\n });\n var $tfoot = $('<tfoot\/>', {\n appendTo: $wrapper\n });\n\n \/**\n * Adds UI items to the widget.\n *\n * @public\n * @param {Object} item\n *\/\n self.addItem = function (item) {\n if (!(item instanceof H5PEditor.Group)) {\n return; \/\/ Only support multiple fields\n }\n\n if (!$headRow) {\n var group = list.getField();\n addHeader(group.fields);\n addFooter(group.fields.length);\n\n self.trigger('tableprepared', {\n thead: $thead[0],\n tfoot: $tfoot[0],\n tbody: $tbody[0],\n fields: group.fields\n });\n }\n\n \/\/ Set default params in case item has no params\n if (item.params === undefined) {\n item.params = {};\n item.setValue(item.field, item.params);\n }\n\n addRow(item);\n };\n\n \/**\n * Add table headers\n *\n *\u00a0@private\n * @param {Array} fields\n *\/\n var addHeader = function (fields) {\n $headRow = $('<tr\/>', {\n appendTo: $thead\n });\n for (var i = 0; i < fields.length; i++) {\n var $th = $('<th\/>', {\n 'class': 'h5peditor-type-' + fields[i].type,\n html: (fields[i].label ? fields[i].label : ''),\n appendTo: $headRow\n });\n fields[i].label = 0; \/\/ No labels inside table rows\n }\n $('<th\/>', {\n 'class': 'h5peditor-remove-header',\n appendTo: $headRow\n });\n\n self.trigger('headeradd', {\n element: $headRow[0],\n fields: fields\n });\n };\n\n \/**\n * Add table footer\n *\n *\u00a0@private\n * @param {number} length\n *\/\n var addFooter = function (length) {\n var $footRow = $('<tr\/>', {\n appendTo: $tfoot\n });\n var $footCell = $('<td\/>', {\n colspan: length,\n appendTo: $footRow\n });\n H5PEditor.createButton(list.getImportance(), H5PEditor.t('core', 'addEntity', {':entity': entity}), function () {\n list.addItem();\n }, true).appendTo($footCell);\n\n self.trigger('footeradd', {\n footerCell: $footCell[0],\n fields: list.getField().fields,\n tbody: $tbody[0]\n });\n };\n\n \/**\n * Add a new table row with data using the given group as source\n *\n *\u00a0@private\n * @param {H5PEditor.Group} item\n *\/\n var addRow = function (item) {\n \/\/ Keep track of field instances\n item.children = [];\n\n \/\/ Create row element\n var $tableRow = $('<tr\/>', {\n appendTo: $tbody\n });\n\n \/\/ Process semantics to create row fields\n var fields = item.getFields();\n for (var i = 0; i < fields.length; i++) {\n fields[i].label = 0;\n var $cell = $('<td\/>', {\n appendTo: $tableRow\n });\n\n var fieldInstance = processSemanticsField(item, fields[i]);\n fieldInstance.appendTo($cell);\n\n item.children.push(fieldInstance);\n }\n\n \/\/ Add remove button\n var $removeButtonCell = $('<td\/>', {\n 'class': 'h5peditor-remove-button',\n appendTo: $tableRow\n });\n\n H5PEditor.createButton('remove', H5PEditor.t('core', 'removeItem'), function () {\n if (this.getAttribute('aria-disabled') !== 'true') {\n confirmRemovalDialog.show($(this).offset().top);\n }\n }).appendTo($removeButtonCell);\n\n \/\/ Create confirmation dialog for removing list item\n var confirmRemovalDialog = new H5P.ConfirmationDialog({\n dialogText: H5PEditor.t('core', 'confirmRemoval', {':type': entity.toLocaleLowerCase()})\n }).appendTo(document.body);\n confirmRemovalDialog.on('confirmed', function () {\n \/\/ Remove him!\n self.trigger('rowremove', {\n element: $tableRow[0],\n fields: fields\n });\n var index = $tableRow.index();\n list.removeItem(index);\n $tableRow.remove(); \/\/ Bye, bye\n self.trigger('rowremoved');\n });\n\n \/\/ Allow overriding \/ customization\n self.trigger('rowadd', {\n element: $tableRow[0],\n fields: fields,\n instances: item.children\n });\n };\n\n \/**\n * Convert semantics into widgets.\n *\n *\u00a0@private\n * @param {H5PEditor.Group} parent\n * @param {Object} field\n *\/\n var processSemanticsField = function (parent, field) {\n \/\/ Check required field properties\n if (field.name === undefined || field.type === undefined) {\n throw ns.t('core', 'missingProperty', {':index': i, ':property': 'name\/type'});\n }\n\n \/\/ Set default value\n if (parent.params[field.name] === undefined && field['default'] !== undefined) {\n parent.params[field.name] = field['default'];\n }\n\n \/\/ Locate widget\n var widget = ns.getWidgetName(field);\n\n \/\/ Create new field instance\n return new ns.widgets[widget](parent, field, parent.params[field.name], function (field, value) {\n if (value === undefined) {\n delete parent.params[field.name];\n }\n else {\n parent.params[field.name] = value;\n }\n });\n };\n\n \/**\n * Puts this widget at the end of the given container.\n *\n * @public\n * @param {jQuery} $container\n *\/\n self.appendTo = function ($container) {\n $wrapper.appendTo($container);\n };\n\n \/**\n * Remove this widget from the editor DOM.\n *\n * @public\n *\/\n self.remove = function () {\n $wrapper.remove();\n };\n }\n\n \/\/ Extend the prototype\n TableList.prototype = Object.create(EventDispatcher.prototype);\n TableList.prototype.constructor = TableList;\n\n return TableList;\n})(H5P.jQuery, H5P.EventDispatcher);\n","\/wp-content\/uploads\/h5p\/libraries\/H5PEditor.RangeList-1.0\/h5p-editor-range-list.js?ver=1.0.2":"\nH5PEditor.RangeList = (function ($, TableList) {\n\n \/**\n * Renders UI for the table list.\n *\n * @class\n * @extends H5PEditor.TableList\n * @param {List} list\n *\/\n function RangeList(list) {\n var self = this;\n\n \/\/ Initialize inheritance\n TableList.call(self, list, 'h5p-editor-range-list');\n\n \/\/ Keep track of the widget state\n var initialized = false;\n list.once('changeWidget', function () {\n initialized = true;\n validateSequence();\n });\n\n \/\/ Global elements\n var distributeButton;\n var tbody;\n\n \/\/ Customize table header and footer\n self.once('tableprepared', function (event) {\n var headRow = event.data.thead.firstElementChild;\n var footCell = event.data.tfoot.firstElementChild.firstElementChild;\n tbody = event.data.tbody;\n var fields = event.data.fields;\n\n \/\/ Add dash between 'from' and 'to' values\n addDashCol(headRow, 'th');\n\n \/\/ Mark score range label as required\n headRow.children[0].classList.add('h5peditor-required');\n\n \/\/ Create button to evenly distribute ranges\n distributeButton = createDistributeButton(\n H5PEditor.t('H5PEditor.RangeList', 'distributeButtonLabel'),\n H5PEditor.t('H5PEditor.RangeList', 'distributeButtonWarning'),\n 'h5peditor-range-distribute',\n distributeEvenlyHandler(fields[0].min, fields[1].max)\n );\n\n \/\/ Increase footer size and insert button\n footCell.colSpan += 2;\n footCell.appendChild(distributeButton);\n\n \/\/ Create message area and insert before buttons\n self.messageArea = document.createElement('div');\n self.messageArea.className = 'h5p-editor-range-list-message-area';\n footCell.insertBefore(self.messageArea, footCell.firstElementChild);\n });\n\n \/\/ Customize rows as they're added\n self.on('rowadd', function (event) {\n var row = event.data.element;\n var fields = event.data.fields;\n var instances = event.data.instances;\n\n \/\/ Customize the 'from' input part\n var fromInput = getFirst('input', row);\n makeReadOnly(fromInput);\n\n \/\/ Customize each row by adding a separation dash between 'from' and 'to'\n addDashCol(row, 'td', '\u2013');\n\n \/\/ Customize the 'to' input part\n var toInput = getSecond('input', row);\n\n \/\/ Create textual representation to display if this is the last row\n addInputText(toInput);\n\n \/\/ Set min value of 'to' field to equal the 'from' field value\n linkPropertyValue('min', instances[1], fromInput);\n\n \/\/ Update the next row's 'from' input when this row's 'to' input changes\n toInput.addEventListener('change', updateInputHandler(fields[0]));\n\n var isFirstRow = !row.previousElementSibling;\n if (isFirstRow) {\n \/\/ This is the first row, disable buttons\n toggleButtons(false, row);\n }\n else {\n \/\/ Show the preivous field's second input when adding a new row\n makeEditable(row.previousElementSibling);\n\n \/\/ More than one row, enable buttons\n toggleButtons(true, row.previousElementSibling);\n }\n\n if (initialized) {\n validateSequence();\n }\n });\n\n \/\/ Handle row being removed from the table\n self.on('rowremove', function (event) {\n var row = event.data.element;\n var fields = event.data.fields;\n\n if (!row.nextElementSibling) {\n \/\/ This was the last row\n if (row.previousElementSibling) {\n getSecond('.h5peditor-input-text', row.previousElementSibling).style.display = '';\n var prevToInput = getSecond('input', row.previousElementSibling);\n prevToInput.style.display = 'none';\n setValue(prevToInput, fields[1].max);\n\n if (!row.previousElementSibling.previousElementSibling) {\n \/\/ Only one row left, disable buttons\n toggleButtons(false, row.previousElementSibling);\n }\n }\n }\n else if (!row.previousElementSibling) {\n \/\/ This was the first row\n setValue(getFirst('input', row.nextElementSibling), fields[0].min);\n if (!row.nextElementSibling.nextElementSibling) {\n \/\/ Only one row left, disable buttons\n toggleButtons(false, row.nextElementSibling);\n }\n }\n else {\n \/\/ Set first input of next row to match the second input of previous row.\n setValue(getFirst('input', row.nextElementSibling), getSecond('input', row.previousElementSibling).value);\n }\n });\n\n \/\/ When row is removed we check for overlapping sequences\n self.on('rowremoved', function (event) {\n validateSequence();\n });\n\n \/**\n * Convert the given input field into a read-only type field that is\n * updated programmatically.\n *\n * @private\n * @param {HTMLInputElement} input\n *\/\n var makeReadOnly = function (input) {\n \/\/ Default value for newly added row is set to blank when this\n \/\/ is a row added by the user\n var isFirstRow = !input.parentElement.parentElement.parentElement.previousElementSibling;\n if (!isFirstRow && initialized) {\n setValue(input, '');\n }\n\n \/\/ Add textual representation of input\n addInputText(input);\n\n \/\/ Hide all errors since the input is updated programmatically\n input.parentElement.querySelector('.h5p-errors').style.display = 'none';\n };\n\n \/**\n * The given row is no longer the last row and the 'to' input should\n * now be editable.\n *\n * @private\n * @param {HTMLTableRowElement} row\n *\/\n var makeEditable = function (row) {\n getSecond('.h5peditor-input-text', row).style.display = 'none';\n var prevToInput = getSecond('input', row);\n prevToInput.style.display = '';\n\n if (initialized) {\n \/\/ User action, use no value as default\n setValue(prevToInput, '');\n\n \/\/ Override \/ clear 'field is mandatory' error messages\n prevToInput.parentNode.querySelector('.h5p-errors').innerHTML = '';\n prevToInput.classList.remove('error');\n }\n };\n\n \/**\n * Set the given field property to equal the value the given input field\n *\n * @private\n * @param {string} property\n * @param {Object} fieldInstance\n * @param {HTMLInputElement} input\n *\/\n var linkPropertyValue = function (property, fieldInstance, input) {\n \/\/ Update the current value to equal that of the input\n fieldInstance.field[property] = parseInt(input.value);\n\n \/\/ Update the value if the value of the field changes\n input.addEventListener('change', function () {\n fieldInstance.field[property] = parseInt(input.value);\n fieldInstance.$input[0].dispatchEvent(createNewEvent('change'));\n });\n };\n\n \/**\n * Update the next row's 'from' input when this 'to' input change.\n *\n * @private\n * @param {Object} field\n * @return {function} Event handler\n *\/\n var updateInputHandler = function (field) {\n return function () {\n var nextRow = this.parentElement.parentElement.parentElement.nextElementSibling;\n if (!nextRow) {\n \/\/ This is the last row, nothing to update\n return;\n }\n\n var targetInput = getFirst('input', nextRow);\n if (this.value === '') {\n \/\/ No value has been set\n setValue(targetInput, '');\n return;\n }\n\n var value = parseInt(this.value);\n if (!isNaN(value)) {\n \/\/ Increment next from value\n value += 1;\n if (field.max && value >= field.max) {\n value = field.max; \/\/ Respect max limit\n }\n setValue(targetInput, value);\n }\n\n validateSequence();\n };\n };\n\n \/**\n * Add dash column to the given row.\n *\n * @private\n * @param {HTMLTableRowElement} row\n * @param {string} type 'td' or 'th'\n * @param {string} [symbol] The 'text' to display\n *\/\n var addDashCol = function (row, type, symbol) {\n var dash = document.createElement(type);\n dash.classList.add('h5peditor-dash');\n if (symbol) {\n dash.innerText = '\u2013';\n }\n row.insertBefore(dash, row.children[1]);\n };\n\n \/**\n * Add text element displaying input value and hide input.\n *\n * @private\n * @param {HTMLInputElement} input\n *\/\n var addInputText = function (input) {\n \/\/ Add static text\n var text = document.createElement('div');\n text.classList.add('h5peditor-input-text');\n text.innerHTML = input.value;\n input.parentElement.insertBefore(text, input);\n\n \/\/ Hide input\n input.style.display = 'none';\n\n \/\/ Update static on changes\n input.addEventListener('change', function () {\n text.innerHTML = input.value;\n });\n };\n\n \/**\n * Look for the given selector\/type in the first cell of the given row.\n *\n * @private\n * @param {string} type selector\n * @param {HTMLTableRowElement} row to look in\n *\/\n var getFirst = function (type, row) {\n return row.children[0].querySelector(type);\n };\n\n \/**\n * Look for the given selector\/type in the second cell of the given row.\n *\n * @private\n * @param {string} type selector\n * @param {HTMLTableRowElement} row to look in\n *\/\n var getSecond = function (type, row) {\n return row.children[2].querySelector(type);\n };\n\n \/**\n * Set the given value for the given input and trigger the change event.\n *\n * @private\n * @param {HTMLInputElement} input\n * @param {string} value\n *\/\n var setValue = function (input, value) {\n input.value = value;\n input.dispatchEvent(createNewEvent('change'));\n };\n\n \/**\n * Create a new event, using a fallback for older browsers (IE11)\n *\n * @param {string} type\n * @return {Event}\n *\/\n var createNewEvent = function (type) {\n if (typeof Event !== 'function') {\n var event = document.createEvent('Event');\n event.initEvent(type, true, true);\n return event;\n }\n else {\n return new Event(type)\n }\n };\n\n \/**\n * Identify any overlapping ranges and provide an error message.\n *\n * @private\n *\/\n var validateSequence = function () {\n var prevTo, error;\n for (var i = 0; i < tbody.children.length; i++) {\n var row = tbody.children[i];\n var to = parseInt(getSecond('input', row).value);\n\n if (prevTo !== undefined && !isNaN(to) && to <= prevTo) {\n error = true;\n row.classList.add('h5p-error-range-overlap');\n }\n else {\n row.classList.remove('h5p-error-range-overlap');\n }\n prevTo = to;\n }\n\n \/\/ Display a message\n self.messageArea.innerText = error ? H5PEditor.t('H5PEditor.RangeList', 'rangeOutOfSequenceWarning') : '';\n self.messageArea.classList[error ? 'add' : 'remove']('problem-found');\n };\n\n \/**\n * Create distribute button\n *\n * @private\n * @param {string} label\n * @param {string} warning\n * @param {string} classname\n * @param {function} action\n * @return {HTMLElement}\n *\/\n var createDistributeButton = function (label, warning, classname, action) {\n\n \/\/ Create confirmation dialog\n var confirmDialog = new H5P.ConfirmationDialog({\n dialogText: warning\n }).appendTo(document.body);\n\n confirmDialog.on('confirmed', action);\n\n \/\/ Create and return button element\n return H5PEditor.createButton(classname, label, function () {\n if (this.getAttribute('aria-disabled') !== 'true') {\n \/\/ The button has been clicked, activate confirmation dialog if\n \/\/ the author has defined any ranges\n if (authorHasDefinedRanges()) {\n confirmDialog.show(this.getBoundingClientRect().top);\n }\n else {\n action();\n }\n }\n }, true)[0];\n };\n\n \/**\n * Check if any input fields have gotten values by the author\n *\n * @private\n * @return {boolean}\n *\/\n var authorHasDefinedRanges = function () {\n for (var i = 0; i < tbody.children.length - 1; i++) {\n var to = parseInt(getSecond('input', tbody.children[i]).value);\n if (!isNaN(to)) {\n return true;\n }\n }\n return false;\n };\n\n \/**\n * Generate an event handler for distributing ranges equally.\n *\n * @private\n * @param {number} start The minimum value\n * @param {number} end The maximum value\n * @return {function} Event handler\n *\/\n var distributeEvenlyHandler = function (start, end) {\n return function () {\n \/\/ Distribute percentages evenly\n var rowRange = (end - start) \/ tbody.children.length;\n\n \/\/ Go though all the rows\n for (var i = 0; i < tbody.children.length; i++) {\n var row = tbody.children[i];\n var from = start + (rowRange * i);\n setValue(getFirst('input', row), Math.floor(from) + (i === 0 ? 0 : 1));\n var secondInput = getSecond('input', row);\n setValue(secondInput, Math.floor(from + rowRange));\n secondInput.dispatchEvent(createNewEvent('keyup')); \/\/ Workaround to remove error messages\n }\n\n validateSequence();\n };\n };\n\n \/**\n * Toggle buttons disabled \/ enabled\n *\n * @private\n * @param {boolean} state true to enable buttons, false to disable\n * @param {HTMLTableRowElement} row to look in\n *\/\n var toggleButtons = function (state, row) {\n var removeButton = row.children[row.children.length - 1].children[0];\n if (state) {\n enableButton(distributeButton);\n enableButton(removeButton);\n }\n else {\n disableButton(distributeButton);\n disableButton(removeButton);\n }\n };\n\n \/**\n * Disables the given button\n *\n * @private\n * @param {HTMLElement} button to look in\n *\/\n var disableButton = function (button) {\n button.setAttribute('aria-disabled', 'true');\n button.removeAttribute('tabindex');\n };\n\n \/**\n * Enables the given button\n *\n * @private\n * @param {HTMLElement} button to look in\n *\/\n var enableButton = function (button) {\n button.removeAttribute('aria-disabled');\n button.setAttribute('tabindex', '0');\n };\n }\n\n \/\/ Extend TableList prototype\n RangeList.prototype = Object.create(TableList.prototype);\n RangeList.prototype.constructor = RangeList;\n\n return RangeList;\n})(H5P.jQuery, H5PEditor.TableList);\n\n\/\/ Add translations\nH5PEditor.language['H5PEditor.RangeList'] = {\n 'libraryStrings': {\n 'distributeButtonLabel': 'Distribute Evenly',\n 'distributeButtonWarning': 'Values will be changed for all of the ranges. Do you wish to proceed?',\n 'rangeOutOfSequenceWarning': 'The score ranges are out of sequence'\n }\n};\n"},"css":{"\/wp-content\/uploads\/h5p\/libraries\/H5PEditor.TableList-1.0\/h5p-editor-table-list.css?ver=1.0.2":".h5p-editor-table-list {\n width: 100%;\n table-layout: fixed;\n border-spacing: 0 5px;\n empty-cells: show;\n}\n.h5p-editor-table-list thead th,\n.h5p-editor-table-list tbody td {\n text-align: left;\n padding: 10px 5px;\n}\n.h5p-editor-table-list thead th:first-child,\n.h5p-editor-table-list tbody td:first-child {\n padding-left: 10px;\n}\n.h5p-editor-table-list thead th:last-child,\n.h5p-editor-table-list tbody td:last-child {\n padding-right: 10px;\n}\n.h5p-editor-table-list thead th.h5peditor-type-number {\n width: 75px;\n}\n.h5p-editor-table-list thead th.h5peditor-remove-header {\n width: 32px;\n}\n.h5p-editor-table-list tbody td {\n background: #f5f5f5;\n border-top: 1px solid #d0d0d1;\n border-bottom: 1px solid #d0d0d1;\n vertical-align: top;\n}\n.h5p-editor-table-list tbody td:first-child {\n border-left: 1px solid #d0d0d1;\n border-radius: .25em 0 0 .25em;\n}\n.h5p-editor-table-list tbody td:last-child {\n border-right: 1px solid #d0d0d1;\n border-radius: 0 .25em .25em 0;\n}\n.h5p-editor-table-list tfoot .h5peditor-button {\n margin-top: 0;\n}\n.h5p-editor-table-list td.h5peditor-remove-button {\n position: relative;\n}\n.h5p-editor-table-list td.h5peditor-remove-button .h5peditor-button {\n cursor: pointer;\n width: 32px;\n display: inline-block;\n height: 38px;\n font-size: 1.75em;\n}\n.h5p-editor-table-list td.h5peditor-remove-button .h5peditor-button:after {\n font-family: \"H5P\";\n content: \"\\e890\";\n opacity: 0.7;\n display: inline-block;\n line-height: 38px;\n}\n.h5p-editor-table-list td.h5peditor-remove-button .h5peditor-button:hover:after {\n opacity: 1;\n}\n.h5p-editor-table-list td.h5peditor-remove-button .h5peditor-button[aria-label]:before {\n top: 85%;\n right: 10%;\n}\n.h5p-editor-table-list td.h5peditor-remove-button .h5peditor-button[aria-disabled=\"true\"] {\n cursor: default;\n}\n.h5p-editor-table-list td.h5peditor-remove-button .h5peditor-button[aria-disabled=\"true\"]:after {\n opacity: 0.3;\n}\n.h5p-editor-table-list tbody .h5p-errors > p {\n white-space: nowrap;\n margin: 6px 0 0 6px;\n font-size: 14px;\n}\n","\/wp-content\/uploads\/h5p\/libraries\/H5PEditor.RangeList-1.0\/h5p-editor-range-list.css?ver=1.0.2":".h5p-editor-range-list thead th.h5peditor-type-number {\n white-space: nowrap;\n width: 65px;\n}\n.h5p-editor-range-list thead th.h5peditor-dash {\n width: 6px;\n}\n.h5p-editor-range-list tbody td.h5peditor-dash {\n line-height: 37px;\n}\n.h5p-editor-range-list .h5peditor-input-text {\n line-height: 38px;\n height: 38px;\n text-align: center;\n}\n.h5p-editor-range-list .number input {\n text-align: center;\n width: 65px;\n}\n.h5p-editor-range-list thead th.h5peditor-remove-header {\n position: relative;\n}\n.h5peditor-range-distribute {\n white-space: nowrap;\n font-weight: normal;\n font-size: 14px;\n padding: 0 20px;\n margin-left: 1em;\n height: 42px;\n line-height: 42px;\n\n color: #2579c6;\n font-weight: bold;\n background: #fff;\n border: 2px solid #2579c6;\n}\n.h5peditor-button-textual.h5peditor-range-distribute:hover {\n color: #1f67a8;\n border-color: #1f67a8;\n background: #fff;\n}\n.h5peditor-range-distribute[aria-disabled=\"true\"],\n.h5peditor-button-textual.h5peditor-range-distribute[aria-disabled=\"true\"]:hover {\n cursor: default;\n color: #8fb3d3;\n border-color: #8fb3d3;\n background: #fff;\n}\n.h5p-editor-table-list tbody .h5p-error-range-overlap td {\n border-color: #da0001;\n}\n.h5p-editor-range-list-message-area {\n display: none;\n background: #f4ecec;\n border-left: 2px solid #ad5b52;\n padding: 1em;\n margin-bottom: 0.5em;\n}\n.h5p-editor-range-list-message-area.problem-found {\n display: block;\n}\n","\/wp-content\/uploads\/h5p\/custom-h5p.css?ver=0.1":"\/** css persos du plulgin d'exercices h5p\nfonctionne grace \u00e0 wp-content\/theme\/responsive-child\/functions.php\nfonctionne grace \u00e0 wp-content\/plugin\/h5pmods\/phpmods.php\n*********************************************************************************\/\n\n\/* TOUS LES EXERCICES \n************************************************\/\n.h5p-question-introduction > p {\n font-family: Arial, Helvetica, sans-serif;\n\tfont-size: 14px;\n\tfont-weight: bold;\n\tcolor: #4bacc6;\n}\n\n\/* GLISSER ETIQUETTES DANS LES BONNES CASES \n************************************************\/\n.h5p-drag-text .h5p-drag-draggable.h5p-drag-dropped {\n background: #cae0e8 none repeat scroll 0 0;\n border: 0.1em solid #a9c3d0;\n\n margin: -0.1em 0 0;\n padding: 0.1em 0.825em;\n white-space: nowrap;\n width: 100%;\n}\n.h5p-drag-text .h5p-drag-dropzone {\n background-color: #e5edb6;\n}\n\/*boite dans laquelle se trouvent les propositions avec cases vides*\/\n.h5p-drag-text .h5p-drag-droppable-words{\n font-size: 14px;\n}\n\/*cases de r\u00e9ponses draggables*\/\n.h5p-drag-text .h5p-drag-draggable {\n\tfont-size: 14px;\n\tbackground-color: #c6c6c6;\n}\n\/*bouton \"v\u00e9rifier\" \"voir la correction\"*\/\n.h5peditor .ui-dialog .h5p-joubelui-button, .h5peditor .h5p-joubelui-button, .h5p-joubelui-button {\n background: #879c10 none repeat scroll 0 0;\n}\n.h5p-joubelui-button:hover, .h5p-joubelui-button:focus, .h5p-joubelui-button:active\n{\n background: #64740c none repeat scroll 0 0;\n}\n.h5p-question-feedback {\n color: #64740c;\n}\n\n.h5p-drag-text .h5p-drag-draggable.h5p-drag-dropped {\n background: none;\n}\n.h5p-drag-text .h5p-drag-dropped.h5p-drag-draggable-wrong {\n color: #ff0080;\n\tbackground: #ffc9e4;\n\tborder: none;\n}\n.h5p-drag-text .h5p-drag-dropped.h5p-drag-draggable-correct {\n\tbackground: #d3dfad none repeat scroll 0 0;\n border: 2px solid #aac514;\n color: #526100;\n}\n.h5p-joubelui-score-bar-progress { \/*couleur barre de score *\/\n background: #64740c none repeat scroll 0 0;\n}\n.h5p-joubelui-score-bar-full-score-star { \/* point avec \u00e9toile barre de score *\/\n backface-visibility: hidden;\n background: #aac514 none repeat scroll 0 0;\n transition: transform 0.3s ease-in-out 0s;\n}\n\n\n\/* EXERCICES A TROUS \/ COMPLETER LES BLANCS\n************************************************\/\n\n\/* couleur du texte dans une boite vide au moment de remplir *\/\n.contact_right select, input[type=\"text\"], input[type=\"password\"], input[type=\"email\"] {\n background-color: transparent;\n box-shadow: none;\n color: grey;\n}\n\/* couleur du texte dans une boite vide *\/\n.h5p-blanks .h5p-wrong .h5p-text-input { \/* r\u00e9ponse fausse *\/\n background-color: #ffc9e4;\n border: 1px solid #ffc9e4;\n color: #ff0080;\n text-decoration: line-through;\n}\n.h5p-blanks .h5p-wrong::after { \/* r\u00e9ponse fausse - couleur de la croix *\/\n color: #ff0080;\n}\n.h5p-blanks .h5p-correct .h5p-text-input { \/* r\u00e9ponse correcte *\/\n background: #aac514 none repeat scroll 0 0;\n border: 1px solid #aac514;\n color: #526100;\n}\n.h5p-blanks .h5p-correct::after { \/* r\u00e9ponse correcte - couleur de la croix *\/\n color: #526100;\n\n\n"}}
As you can see there is a URL added to the response before the JSON part.
Hello again,
I’ve found and fixed the problem, it was a line in my themes functions.php file.
Thank you!Ah, that’s good to hear!
- The topic ‘Invalid library’ is closed to new replies.