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-dimensions.js
/* global ns */ /** * Adds a dimensions field to the form. * * TODO: Make it possible to lock width/height ratio. * * @param {mixed} parent * @param {object} field * @param {mixed} params * @param {function} setValue * @returns {ns.Dimensions} */ ns.Dimensions = function (parent, field, params, setValue) { var that = this; this.parent = parent; this.field = field; this.changes = []; // Find image field to get max size from. H5PEditor.followField(parent, field.max, function (file) { that.setMax(file); }); // Find image field to get default size from. H5PEditor.followField(parent, field['default'], function (file) { // Make sure we don't set size if we have one in the default params. if (params.width === undefined) { that.setSize(file); } }); this.params = params; this.setValue = setValue; // Remove default field from params to avoid saving it. if (this.params.field) { this.params.field = undefined; } }; /** * Set max dimensions. * * @param {Object} file * @returns {unresolved} */ ns.Dimensions.prototype.setMax = function (file) { if (file === undefined) { return; } this.max = { width: parseInt(file.width), height: parseInt(file.height) }; }; /** * Set current dimensions. * * @param {string} width * @param {string} height * @returns {undefined} */ ns.Dimensions.prototype.setSize = function (file) { if (file === undefined) { return; } this.params = { width: parseInt(file.width), height: parseInt(file.height) }; this.setValue(this.field, this.params); this.$inputs.filter(':eq(0)').val(file.width).next().val(file.height); for (var i = 0; i < this.changes.length; i++) { this.changes[i](file.width, file.height); } }; /** * Append the field to the given wrapper. * * @param {jQuery} $wrapper * @returns {undefined} */ ns.Dimensions.prototype.appendTo = function ($wrapper) { var that = this; this.$item = ns.$(this.createHtml()).appendTo($wrapper); this.$inputs = this.$item.find('input'); this.$errors = this.$item.children('.h5p-errors'); this.$inputs.change(function () { // Validate var value = that.validate(); if (value) { // Set param that.params = value; that.setValue(that.field, value); for (var i = 0; i < that.changes.length; i++) { that.changes[i](value.width, value.height); } } }).click(function () { return false; }); }; /** * Create HTML for the field. */ ns.Dimensions.prototype.createHtml = function () { const id = ns.getNextFieldId(this.field); const descriptionId = (this.field.description !== undefined ? ns.getDescriptionId(id) : undefined) var input = ns.createText(this.params !== undefined ? this.params.width : undefined, 15, ns.t('core', 'width'), id, descriptionId) + ' x ' + ns.createText(this.params !== undefined ? this.params.height : undefined, 15, ns.t('core', 'height'), undefined, descriptionId); return ns.createFieldMarkup(this.field, input, id); }; /** * Validate the current text field. */ ns.Dimensions.prototype.validate = function () { var that = this; var size = {}; this.$errors.html(''); this.$inputs.each(function (i) { var $input = ns.$(this); var value = H5P.trim($input.val()); var property = i ? 'height' : 'width'; var propertyTranslated = ns.t('core', property); if ((that.field.optional === undefined || !that.field.optional) && !value.length) { that.$errors.append(ns.createError(ns.t('core', 'requiredProperty', {':property': propertyTranslated}))); return false; } else if (!value.match(new RegExp('^[0-9]+$'))) { that.$errors.append(ns.createError(ns.t('core', 'onlyNumbers', {':property': propertyTranslated}))); return false; } value = parseInt(value); if (that.max !== undefined && value > that.max[property]) { that.$errors.append(ns.createError(ns.t('core', 'exceedsMax', {':property': propertyTranslated, ':max': that.max[property]}))); return false; } size[property] = value; }); return ns.checkErrors(this.$errors, this.$inputs, size); }; /** * Remove this item. */ ns.Dimensions.prototype.remove = function () { this.$item.remove(); }; // Tell the editor what widget we are. ns.widgets.dimensions = ns.Dimensions;
Upload File
Create Folder