Sindbad~EG File Manager
(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}var e=function(){function e(){}return e.extend=function(){for(var e=1;e<arguments.length;e++)for(var i in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],i)&&("object"===t(arguments[0][i])&&"object"===t(arguments[e][i])?this.extend(arguments[0][i],arguments[e][i]):arguments[0][i]=arguments[e][i]);return arguments[0]},e.htmlDecode=function(t){return(new DOMParser).parseFromString(t,"text/html").documentElement.textContent},e.waitForChild=function(i,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:200,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:50;"object"===t(i)&&"string"==typeof n&&"function"==typeof r&&(void 0===i[n]?(o=Math.max(100,o),l<0||setTimeout((function(){e.waitForChild(i,n,r,o,l-1)}),o)):r())},e}(),i=function(){function t(t,e,i,n){var r=this;this.parent=t,this.field=e,this.params=i,this.setValue=n,this.changes=[],this.passReadies=!0,this.$container=H5P.jQuery("<div>",{class:"h5peditor-info-wall"}),this.fieldInstance=new H5PEditor.widgets[this.field.type](this.parent,this.field,this.params,this.setValue),this.fieldInstance.appendTo(this.$container),this.$errors=this.$container.find(".h5p-errors"),this.parent.ready((function(){r.initialize()}))}var i=t.prototype;return i.initialize=function(){var t=this;this.propertiesList=this.findField("propertiesGroup/properties",this.fieldInstance),this.propertyFields=this.getPropertyFields(),this.propertiesList.on("addedItem",(function(e){t.handlePropertyAdded(e.data)})),this.propertiesList.on("removedItem",(function(e){t.handlePropertyRemoved(e.data)})),H5P.$window.get(0).addEventListener("mouseup",(function(){clearTimeout(t.mouseUpTimeout),t.mouseUpTimeout=setTimeout((function(){var e=t.updatePropertyOrder();void 0!==e.from&&void 0!==e.to&&t.updateEntriesOrder(e)}),100)})),this.panelsList=this.findField("panels",this.fieldInstance),this.panelsList.on("addedItem",(function(e){t.fillUpEntries(e.data),t.addPanelTitleListeners(e.data)})),this.panelsList.forEachChild((function(e){t.fillUpEntries(e),t.addPanelTitleListeners(e)})),this.propertiesList.forEachChild((function(e){t.findField("label",e).change((function(){return t.updateLabels()}))})),this.updateLabels()},i.addPanelTitleListeners=function(t){var i=this,n=this.findField("image",t);e.waitForChild(n,"metadataForm",(function(){n.metadataForm.children.filter((function(t){var e;return"title"===(null==t||null===(e=t.field)||void 0===e?void 0:e.name)})).shift().$input.get(0).addEventListener("change",(function(){i.setPanelTitle(t)}));var e=i.findField("alt",n);"function"==typeof e.change&&e.change((function(){return i.setPanelTitle(t)})),i.setPanelTitle(t)})),this.findField("entries",t).forEachChild((function(e){e.$input.on("change",(function(){i.setPanelTitle(t)}))}))},i.setPanelTitle=function(t){var e=this.findField("panelTitle",t);e.$input.val(this.determineBestPanelTitle(t)),e.$input.change()},i.determineBestPanelTitle=function(t){var i=this.findField("image",t),n=i.metadataForm.children.filter((function(t){var e;return"title"===(null==t||null===(e=t.field)||void 0===e?void 0:e.name)})).shift().value;return n&&n!==H5PEditor.t("core","untitled").replace(":libraryTitle","Image")||(n=i.$libraryWrapper.get(0).querySelector(".field-name-alt input").value)&&""!==n?n:(this.findField("entries",t).forEachChild((function(t){n||(n=e.htmlDecode(t.value||""))})),n&&""!==n?n:H5PEditor.t("core","untitled").replace(":libraryTitle",H5PEditor.t("H5PEditor.InfoWall","panel")))},i.fillUpEntries=function(t){for(var e=this.findField("entries",t),i=(e.getValue()||[""]).length;i<this.propertyFields.length;i++)e.addItem();this.updateLabels()},i.updatePropertyOrder=function(){var t=this,e=this.getPropertyFields(),i=e.map((function(e){return t.propertyFields.indexOf(e)}));return this.propertyFields=e,i.reduce((function(t,e,n){var r;e!==n&&(t.from=null!==(r=t.from)&&void 0!==r?r:n,t.to=n);if(n===i.length-1&&i[t.from]===t.to){var o=t.from;t.from=t.to,t.to=o}return t}),{})},i.updateEntriesOrder=function(t){var e=this;this.panelsList.forEachChild((function(i){var n=e.findField("entries",i);n.moveItem(t.from,t.to),n.widget.updateOrder()}))},i.getPropertyFields=function(){var t=this,e=[];return this.propertiesList.forEachChild((function(i){e.push(t.findField("label",i))})),e},i.handlePropertyAdded=function(t){var e=this;clearTimeout(this.mouseUpTimeout),this.findField("label",t).change((function(){return e.updateLabels()})),this.panelsList.forEachChild((function(t){e.findField("entries",t).addItem()})),this.updateLabels(),this.propertyFields=this.getPropertyFields()},i.handlePropertyRemoved=function(t){var e=this;clearTimeout(this.mouseUpTimeout),this.panelsList.forEachChild((function(i){e.findField("entries",i).removeItem(t)})),this.propertyFields=this.getPropertyFields()},i.updateLabels=function(){var t=this,e=[];this.propertiesList.forEachChild((function(i){e.push(t.findField("label",i).value)})),this.panelsList.forEachChild((function(i){var n=0,r=t.findField("entries",i);r.forEachChild((function(t){t.infoWallLabel=e[n],n++})),r.widget.updateLabels()}))},i.appendTo=function(t){this.$container.appendTo(t)},i.validate=function(){return this.fieldInstance.validate()},i.remove=function(){this.$container.remove()},i.findField=function(t,e){if("string"==typeof t&&(t=t.split("/")),".."===t[0])return t.splice(0,1),this.findField(t,e.parent);if(!e.children)return!1;for(var i=0;i<e.children.length;i++){if(e.children[i].field.name===t[0])return t.splice(0,1),t.length?this.findField(t,e.children[i]):e.children[i];if("function"==typeof e.children[i].getName&&e.children[i].getName()===t[0])return e.children[i]}return!1},t}();H5PEditor=H5PEditor||{},H5PEditor.widgets.infoWall=i,H5PEditor.InfoWall=i})();
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists