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-select.js
/* global ns*/ H5PEditor.widgets.select = H5PEditor.Select = (function (E) { /** * Initialize a new widget. * * @param {object} parent * @param {object} field * @param {object} params * @param {function} setValue * @returns {_L3.C} */ function C(parent, field, params, setValue) { this.field = field; this.value = params; this.setValue = setValue; // Setup event dispatching on change this.changes = []; this.triggerListeners = function (value) { // Run callbacks for (var i = 0; i < this.changes.length; i++) { this.changes[i](value); } }; } /** * Append widget to the DOM. * * @param {jQuery} $wrapper * @returns {undefined} */ C.prototype.appendTo = function ($wrapper) { var that = this; this.$item = E.$(this.createHtml()).appendTo($wrapper); this.$select = this.$item.find('select'); this.$errors = this.$item.children('.h5p-errors'); this.$select.change(function () { var val = that.validate(); if (val !== false) { that.value = val; that.setValue(that.field, val); that.triggerListeners(val); } }); }; /** * Generate HTML for the widget. * * @returns {String} HTML. */ C.prototype.createHtml = function () { const id = ns.getNextFieldId(this.field); let options = ''; if (this.field.optional === true || this.field.default === undefined) { options = E.createOption('-', '-'); } options += C.createOptionsHtml(this.field.options, this.value); let select = '<select id="' + id + '"'; if (this.field.description !== undefined) { select += ' aria-describedby="' + ns.getDescriptionId(id) + '"'; } select += ' class="h5peditor-select">' + options + '</select>'; return E.createFieldMarkup(this.field, select, id); }; /** * Generate HTML for select options. * * @param {Array} options * @param {string} selected value * @return {string} */ C.createOptionsHtml = function (options, selected) { var html = ''; for (var i = 0; i < options.length; i++) { if (options[i].type === 'optgroup') { html += '<optgroup label="' + options[i].label + '" >'; html += C.createOptionsHtml(options[i].options, selected); html += '</optgroup>'; } else { html += E.createOption(options[i].value, options[i].label, options[i].value === selected); } } return html; }; /** * Validate this field. * * @returns {Boolean} */ C.prototype.validate = function () { var value = this.$select.val(); if (value === '-') { value = undefined; // No value selected } if (this.field.optional !== true && value === undefined) { // Not optional and no value selected, print required error this.$errors.append(ns.createError(ns.t('core', 'requiredProperty', {':property': ns.t('core', 'textField')}))); return false; } // All valid. Remove old errors var $errors = this.$errors.children(); if ($errors.length) { $errors.remove(); } return value; }; /** * Remove widget from DOM. * * @returns {undefined} */ C.prototype.remove = function () { this.$item.remove(); }; return C; })(H5PEditor);
Upload File
Create Folder