X7ROOT File Manager
Current Path:
/home/cbholdings/pasukulu/h5p/h5plib/v124/joubel/editor/scripts
home
/
cbholdings
/
pasukulu
/
h5p
/
h5plib
/
v124
/
joubel
/
editor
/
scripts
/
📁
..
📄
h5p-hub-client.js
(331.61 KB)
📄
h5peditor-av.js
(21.38 KB)
📄
h5peditor-boolean.js
(1.99 KB)
📄
h5peditor-coordinates.js
(5.1 KB)
📄
h5peditor-dimensions.js
(4.26 KB)
📄
h5peditor-editor.js
(18.25 KB)
📄
h5peditor-file-uploader.js
(3.69 KB)
📄
h5peditor-file.js
(8.54 KB)
📄
h5peditor-form.js
(14 KB)
📄
h5peditor-fullscreen-bar.js
(2.7 KB)
📄
h5peditor-group.js
(10.39 KB)
📄
h5peditor-html.js
(17.01 KB)
📄
h5peditor-image-popup.js
(12.1 KB)
📄
h5peditor-image.js
(8.09 KB)
📄
h5peditor-init.js
(3.72 KB)
📄
h5peditor-library-list-cache.js
(3.38 KB)
📄
h5peditor-library-selector.js
(9.97 KB)
📄
h5peditor-library.js
(16.98 KB)
📄
h5peditor-list-editor.js
(10.4 KB)
📄
h5peditor-list.js
(9.08 KB)
📄
h5peditor-metadata-author-widget.js
(3.91 KB)
📄
h5peditor-metadata-changelog-widget.js
(7.5 KB)
📄
h5peditor-metadata.js
(14.66 KB)
📄
h5peditor-none.js
(918 B)
📄
h5peditor-number.js
(4.79 KB)
📄
h5peditor-pre-save.js
(3.62 KB)
📄
h5peditor-select.js
(3.24 KB)
📄
h5peditor-selector-hub.js
(7.76 KB)
📄
h5peditor-selector-legacy.js
(3.11 KB)
📄
h5peditor-semantic-structure.js
(7.39 KB)
📄
h5peditor-text.js
(3.15 KB)
📄
h5peditor-textarea.js
(2.68 KB)
📄
h5peditor.js
(53.53 KB)
Editing: h5peditor-metadata-author-widget.js
/** * Creates a widget to add author information to a form * * @param {object} semantics * @param {object} params * @param {object} group * @param {mixed} parent used in processSemanticsChunk() * @returns {ns.Coordinates} */ H5PEditor.metadataAuthorWidget = function (semantics, params, $wrapper, parent) { if (!params.authors) { params.authors = []; } const $ = H5PEditor.$; const widget = $('<div class="field h5p-metadata-author-widget"></div>'); var $authorData = $('<div class="h5p-author-data"></div>'); widget.append($authorData); H5PEditor.processSemanticsChunk(semantics, {}, $authorData, parent); // Get references to the fields var nameField = H5PEditor.findField('name', parent); var roleField = H5PEditor.findField('role', parent); var $button = $('<div class="field authorList">' + '<button type="button" class="h5p-metadata-button inverted h5p-save-author">' + H5PEditor.t('core', 'addAuthor') + '</button>' + '</div>').children('button').click(function (event) { // Temporarily set name as mandatory to get the error messages only when // clicking the Add Author button nameField.field.optional = false; var name = nameField.validate(); nameField.field.optional = true; var role = roleField.validate(); if (!name) { return; } // Don't add author if already in list with the same role const authorDuplicate = params.authors.some(function (author) { return author.name === name && author.role === role; }); if (authorDuplicate) { resetForm(); return; } addAuthor(name, role); }).end(); $authorData.append($button); var authorListWrapper = $('<div class="h5p-author-list-wrapper"><ul class="h5p-author-list"></ul></div>'); widget.append(authorListWrapper); renderAuthorList(); widget.appendTo($wrapper); /** * Add an author to the list of authors * @param {string} [name] * @param {string} [role] */ function addAuthor(name, role) { params.authors.push({ name: name, role: role }); renderAuthorList(); resetForm(); } /** * Add default/current author to list of authors * * @param {string} fallbackName Name to fallback to if there is no valid name chosen already * @param {string} fallbackRole Role to fallback to if there is no valid role chosen already */ function addDefaultAuthor(fallbackName, fallbackRole) { var name = nameField.validate(); if (!name) { name = fallbackName; } var role = roleField.validate(); if (!role) { role = fallbackRole; } addAuthor(name, role); } /** * Resets the form */ function resetForm() { nameField.$input.val(''); } /** * Remove author from list. * * @param {object} author - Author to be removed. * @param {string} author.name - Author name. * @param {string} author.role - Author role. */ function removeAuthor(author) { params.authors = params.authors.filter(function (e) { return (e !== author); }); renderAuthorList(); } function renderAuthorList() { var wrapper = widget.find('.h5p-author-list-wrapper'); wrapper.empty(); const authorList = $('<ul></ul>'); params.authors.forEach(function (author) { // Name and role var listItem = $('<li>', { html: H5PEditor.htmlspecialchars(author.name), append: $('<span>', { 'class': 'h5p-metadata-role', html: author.role }) }); // The delete-button $('<button>', { type: 'button', 'class': 'h5p-metadata-icon-button', click: function () { if (confirm(H5PEditor.t('core', 'confirmRemoveAuthor'))) { removeAuthor(author); } } }).appendTo(listItem); authorList.append(listItem); }); wrapper.append(authorList); } return { addAuthor: addAuthor, addDefaultAuthor: addDefaultAuthor }; };
Upload File
Create Folder