diff --git a/capsule-prototype/js/PopupPanelWidget.js b/capsule-prototype/js/PopupPanelWidget.js index f3ac7a0325266b4bddde7423172a6eecb91f9f4a..dd85103902c08470d2ebe8c26416c1527c735bae 100644 --- a/capsule-prototype/js/PopupPanelWidget.js +++ b/capsule-prototype/js/PopupPanelWidget.js @@ -6,7 +6,7 @@ function convertToTime(seconds) { return minutes + ":" + remainingSeconds; } -function PanelInputEditor(data) { +function PanelEdition(data) { this.tag = data.tag; this.readonlyDiv = undefined; this.editDiv = undefined; @@ -14,14 +14,14 @@ function PanelInputEditor(data) { this.popupPanelWidget = data.popupPanelWidget; } // eslint-disable-next-line no-unused-vars -PanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { +PanelEdition.prototype.appendInputEditorDiv = function (parentDiv) { } -PanelInputEditor.prototype.closeEdition = function () { +PanelEdition.prototype.closeEdition = function () { this.popupPanelWidget.setCurrentOpenedInput(undefined); this.editDiv?.hide(); this.readonlyDiv?.show(); } -PanelInputEditor.prototype.openEdition = function () { +PanelEdition.prototype.openEdition = function () { this.popupPanelWidget.ensureLastOpenedEditionClosed(); if (this.canEdit) { this.popupPanelWidget.setCurrentOpenedInput(this); @@ -32,11 +32,11 @@ PanelInputEditor.prototype.openEdition = function () { } } -function AnnotationNamePanelInputEditor(data) { - PanelInputEditor.call(this, data); +function AnnotationNamePanelEdition(data) { + PanelEdition.call(this, data); } -AnnotationNamePanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); -AnnotationNamePanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { +AnnotationNamePanelEdition.prototype = Object.create(PanelEdition.prototype); +AnnotationNamePanelEdition.prototype.appendInputEditorDiv = function (parentDiv) { let that = this; this.readonlyDiv = $('<div>'); this.readonlyDiv @@ -82,7 +82,7 @@ AnnotationNamePanelInputEditor.prototype.appendInputEditorDiv = function (parent parentDiv.append(this.editDiv); } } -AnnotationNamePanelInputEditor.prototype.closeEdition = function () { +AnnotationNamePanelEdition.prototype.closeEdition = function () { if (this.canEdit) { let newValue = this.editDiv.val(); this.editDiv.val(newValue); @@ -100,14 +100,14 @@ AnnotationNamePanelInputEditor.prototype.closeEdition = function () { $('#popupNom').html('+ Add a name').addClass("empty"); } } - PanelInputEditor.prototype.closeEdition.call(this); + PanelEdition.prototype.closeEdition.call(this); } -function AuthorPanelInputEditor(data) { - PanelInputEditor.call(this, data); +function AnnotationAuthorPanelEdition(data) { + PanelEdition.call(this, data); } -AuthorPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); -AuthorPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { +AnnotationAuthorPanelEdition.prototype = Object.create(PanelEdition.prototype); +AnnotationAuthorPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) { let that = this; this.readonlyDiv = $('<div>'); this.readonlyDiv.addClass('popupRightItem') @@ -152,7 +152,7 @@ AuthorPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { parentDiv.append(this.editDiv); } } -AuthorPanelInputEditor.prototype.closeEdition = function () { +AnnotationAuthorPanelEdition.prototype.closeEdition = function () { if (this.canEdit) { let newValue = this.editDiv.val(); this.editDiv.val(newValue); @@ -170,14 +170,14 @@ AuthorPanelInputEditor.prototype.closeEdition = function () { this.readonlyDiv.html('+ Add an author').addClass("empty"); } } - PanelInputEditor.prototype.closeEdition.call(this); + PanelEdition.prototype.closeEdition.call(this); } -function TCPanelInputEditor(data) { - PanelInputEditor.call(this, data); +function AnnotationTCPanelEdition(data) { + PanelEdition.call(this, data); } -TCPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); -TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { +AnnotationTCPanelEdition.prototype = Object.create(PanelEdition.prototype); +AnnotationTCPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) { function onlyNumber(event) { $(this).val($(this).val().replace(/[^0-9]/g, '')); @@ -293,7 +293,7 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { parentDiv.append(this.editDiv); } } -TCPanelInputEditor.prototype.closeEdition = function () { +AnnotationTCPanelEdition.prototype.closeEdition = function () { if (this.canEdit) { let isNaN = (maybeNaN) => maybeNaN!=maybeNaN; let ensureNotNaN = (text, defaultValue = 0) => { @@ -336,14 +336,14 @@ TCPanelInputEditor.prototype.closeEdition = function () { window.app.rekall.Rekall('pubSub').publish('tag.tc.updated', {tag: this.tag}); } } - PanelInputEditor.prototype.closeEdition.call(this); + PanelEdition.prototype.closeEdition.call(this); } -function CommentPanelInputEditor(data) { - PanelInputEditor.call(this, data); +function AnnotationCommentPanelEdition(data) { + PanelEdition.call(this, data); } -CommentPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); -CommentPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { +AnnotationCommentPanelEdition.prototype = Object.create(PanelEdition.prototype); +AnnotationCommentPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) { let that = this; this.readonlyDiv = $('<div>'); this.readonlyDiv.addClass('popupRightItem') @@ -381,7 +381,7 @@ CommentPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { parentDiv.append(this.editDiv); } } -CommentPanelInputEditor.prototype.closeEdition = function () { +AnnotationCommentPanelEdition.prototype.closeEdition = function () { if (this.canEdit) { let newValue = this.editDiv.val(); this.editDiv.val(newValue); @@ -400,14 +400,14 @@ CommentPanelInputEditor.prototype.closeEdition = function () { this.readonlyDiv.html('+ Add an author').addClass("empty"); } } - PanelInputEditor.prototype.closeEdition.call(this); + PanelEdition.prototype.closeEdition.call(this); } -function LinkPanelInputEditor(data) { - PanelInputEditor.call(this, data); +function AnnotationLinkPanelEdition(data) { + PanelEdition.call(this, data); } -LinkPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); -LinkPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { +AnnotationLinkPanelEdition.prototype = Object.create(PanelEdition.prototype); +AnnotationLinkPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) { let that = this; this.readonlyDiv = $('<div>'); this.readonlyDiv.addClass('popupRightItem') @@ -457,7 +457,7 @@ LinkPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { parentDiv.append(this.editDiv); } } -LinkPanelInputEditor.prototype.closeEdition = function () { +AnnotationLinkPanelEdition.prototype.closeEdition = function () { if (this.canEdit) { let newValue = this.editDiv.val(); newValue = newValue.trim(); @@ -480,14 +480,14 @@ LinkPanelInputEditor.prototype.closeEdition = function () { this.readonlyDiv.html('+ Add a Link').addClass("empty"); } } - PanelInputEditor.prototype.closeEdition.call(this); + PanelEdition.prototype.closeEdition.call(this); } -function SpeedPanelInputEditor(data) { - PanelInputEditor.call(this, data); +function AnnotationSpeedPanelEdition(data) { + PanelEdition.call(this, data); } -SpeedPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); -SpeedPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { +AnnotationSpeedPanelEdition.prototype = Object.create(PanelEdition.prototype); +AnnotationSpeedPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) { let that = this; this.readonlyDiv = $('<form>'); this.readonlyDiv.addClass('popupRightItem') @@ -625,7 +625,7 @@ SpeedPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { parentDiv.append(this.readonlyDiv); } -SpeedPanelInputEditor.prototype.closeEdition = function () { +AnnotationSpeedPanelEdition.prototype.closeEdition = function () { if (this.canEdit) { let newValue = this.readonlyDiv.children('input:checked').val(); if (this.tag.getMetadata('Rekall->Speed') !== newValue) { @@ -637,20 +637,20 @@ SpeedPanelInputEditor.prototype.closeEdition = function () { } } } -SpeedPanelInputEditor.prototype.openEdition = function () { +AnnotationSpeedPanelEdition.prototype.openEdition = function () { this.popupPanelWidget.ensureLastOpenedEditionClosed(); if (this.canEdit) { this.popupPanelWidget.setCurrentOpenedInput(this); } } -function TagPanelInputEditor(data) { - PanelInputEditor.call(this, data); +function AnnotationTagPanelEdition(data) { + PanelEdition.call(this, data); this.annotationInputTemplate = $('<input class="" type="checkbox" id="" value="">') this.annotationLabelTemplate = $('<label class="" for=""></label>') } -TagPanelInputEditor.prototype = Object.create(PanelInputEditor.prototype); -TagPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { +AnnotationTagPanelEdition.prototype = Object.create(PanelEdition.prototype); +AnnotationTagPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) { let that = this; function getLabelArray(tag) { @@ -738,7 +738,7 @@ TagPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { } parentDiv.append(this.readonlyDiv); } -TagPanelInputEditor.prototype.save = function () { +AnnotationTagPanelEdition.prototype.save = function () { if (this.canEdit) { let newValue = ''; this.readonlyDiv @@ -759,12 +759,12 @@ TagPanelInputEditor.prototype.save = function () { } } } -TagPanelInputEditor.prototype.closeEdition = function () { +AnnotationTagPanelEdition.prototype.closeEdition = function () { if (this !== this.popupPanelWidget.getCurrentOpenedInput()) this.popupPanelWidget.ensureLastOpenedEditionClosed(); this.save(); } -TagPanelInputEditor.prototype.openEdition = function () { +AnnotationTagPanelEdition.prototype.openEdition = function () { if (this !== this.popupPanelWidget.getCurrentOpenedInput()) { this.popupPanelWidget.ensureLastOpenedEditionClosed(); if (this.canEdit) { @@ -946,25 +946,25 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { }) popupRightTd.append(closePopupDiv); - let projectNameInput = new AnnotationNamePanelInputEditor(commonDataForPanels) + let projectNameInput = new AnnotationNamePanelEdition(commonDataForPanels) projectNameInput.appendInputEditorDiv(popupRightTd); - let projectAuthorInput = new AuthorPanelInputEditor(commonDataForPanels); + let projectAuthorInput = new AnnotationAuthorPanelEdition(commonDataForPanels); projectAuthorInput.appendInputEditorDiv(popupRightTd); - let tcInput = new TCPanelInputEditor(commonDataForPanels); + let tcInput = new AnnotationTCPanelEdition(commonDataForPanels); tcInput.appendInputEditorDiv(popupRightTd); - let commentPanel = new CommentPanelInputEditor(commonDataForPanels); + let commentPanel = new AnnotationCommentPanelEdition(commonDataForPanels); commentPanel.appendInputEditorDiv(popupRightTd); - let linkPanel = new LinkPanelInputEditor(commonDataForPanels); + let linkPanel = new AnnotationLinkPanelEdition(commonDataForPanels); linkPanel.appendInputEditorDiv(popupRightTd); - let speedPanel = new SpeedPanelInputEditor(commonDataForPanels); + let speedPanel = new AnnotationSpeedPanelEdition(commonDataForPanels); speedPanel.appendInputEditorDiv(popupRightTd); - let tagPanel = new TagPanelInputEditor(commonDataForPanels); + let tagPanel = new AnnotationTagPanelEdition(commonDataForPanels); tagPanel.appendInputEditorDiv(popupRightTd); }