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-pre-save.js
var H5PEditor = H5PEditor || {}; var H5PPresave = H5PPresave || {}; H5PEditor.Presave = (function (Editor) { "use strict"; /** * Presave structure * * @class */ function Presave() { this.maxScore = 0; } /** * Process the given library and calculate the max score * * @public * @param {string} library * @param {object} content * @returns {H5PEditor.Presave} */ Presave.prototype.process = function (library, content) { var self = this; library = Presave.sanitizeLibrary(library); if (Presave.libraryExists(library) === true) { H5PPresave[library](content, function (serverSideData) { if (typeof serverSideData !== 'object') { return; } if (serverSideData.hasOwnProperty('maxScore') && Presave.isInt(serverSideData.maxScore)) { self.maxScore += serverSideData.maxScore; } }); } return this; }; /** * Check if the score is valid or throw exception if not * * @static * @param score * @returns {boolean} * @throws {Presave.exceptions.InvalidMaxScoreException} If score is not valid */ Presave.validateScore = function (score) { if (!Presave.isInt(score) || score < 0) { throw new this.exceptions.InvalidMaxScoreException(); } return true; }; /** * Check if a object has the given properties. * * @static * @param {object} content * @param {string|[]} requirements * @returns {boolean} */ Presave.checkNestedRequirements = function (content, requirements) { if (typeof content === 'undefined') { return false; } if (typeof requirements === 'string') { requirements = requirements.split('.'); } for (var i = 1; i < requirements.length; i++) { if (!content.hasOwnProperty(requirements[i])) { return false; } content = content[requirements[i]]; } return true; }; /** * Check if value is a integer * * @static * @param {*} value * @returns {boolean} */ Presave.isInt = function (value) { return !isNaN(value) && (function (x) { return (x | 0) === x; })(parseFloat(value)); }; /** * Checks if given library exists as a presave function * * @static * @param {string} library * @returns {boolean} */ Presave.libraryExists = function (library) { return typeof H5PPresave[library] !== 'undefined'; }; /** * Remove potential version number from library * * @param {string} library * @returns {*} */ Presave.sanitizeLibrary = function (library) { return Editor.libraryFromString(library).machineName || library; }; /** * Collection of common exceptions related to the logic handled in this file * * @type {{InvalidMaxScoreException: H5PEditor.Presave.exceptions.InvalidMaxScoreException, InvalidContentSemanticsException: H5PEditor.Presave.exceptions.InvalidContentSemanticsException}} */ Presave.exceptions = { InvalidMaxScoreException: function (message) { this.message = typeof message === 'string' ? message : Editor.t('core', 'errorCalculatingMaxScore'); this.name = 'InvalidMaxScoreError'; this.code = 'H5P-P400'; }, InvalidContentSemanticsException: function (name, message) { this.message = typeof message === 'string' ? message : Editor.t('core', 'semanticsError', {':error': Editor.t('core', 'maxScoreSemanticsMissing')}); this.name = typeof name === 'string' ? name : 'Invalid Content Semantics Error'; this.code = 'H5P-P500'; } }; /** * C * @constructor * @type {Presave} */ Presave.prototype.constructor = Presave; return Presave; })(H5PEditor);
Upload File
Create Folder