diff --git a/capsule-prototype/js/PopupPanelWidget.js b/capsule-prototype/js/PopupPanelWidget.js index 8420d6130cf907871e42930c2e63fbc228411681..1fc13c7556bb996011c086f7f779e2a710049fc9 100644 --- a/capsule-prototype/js/PopupPanelWidget.js +++ b/capsule-prototype/js/PopupPanelWidget.js @@ -13,6 +13,7 @@ function PanelInputEditor(data) { this.canEdit = data.canEdit; this.popupPanelWidget = data.popupPanelWidget; } +// eslint-disable-next-line no-unused-vars PanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { } PanelInputEditor.prototype.closeEdition = function () { @@ -223,10 +224,10 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { event.stopPropagation(); }); this.editDiv.append(this.popupTCeditDivSecStart); - let popupTCeditStartDivNow = $('<div className="nowTCbtn" id="nowTCin">now</div>'); + let popupTCeditStartDivNow = $('<div class="nowTCbtn" id="nowTCin">now</div>'); popupTCeditStartDivNow.click(function (event) { event.stopPropagation(); - let timeCurrent = convertToTime(Math.round(rekall.timeline.timeCurrent)); + let timeCurrent = convertToTime(Math.round(window.app.rekall.Rekall().timeline.timeCurrent)); that.popupTCeditDivMinStart.val(timeCurrent.split(":")[0]); that.popupTCeditDivSecStart.val(timeCurrent.split(":")[1]); }); @@ -257,10 +258,10 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { event.stopPropagation(); }); this.editDiv.append(this.popupTCeditDivSecEnd); - let popupTCeditEndDivNow = $('<div className="nowTCbtn" id="nowTCin">now</div>'); + let popupTCeditEndDivNow = $('<div class="nowTCbtn" id="nowTCin">now</div>'); popupTCeditEndDivNow.click(function (event) { event.stopPropagation(); - let timeCurrent = convertToTime(Math.round(rekall.timeline.timeCurrent)); + let timeCurrent = convertToTime(Math.round(window.app.rekall.Rekall().timeline.timeCurrent)); that.popupTCeditDivMinEnd.val(timeCurrent.split(":")[0]); that.popupTCeditDivSecEnd.val(timeCurrent.split(":")[1]); }); @@ -269,7 +270,7 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { let popupTcEditEndDivEndVideo = $('<div class="nowTCbtn" id="eovTCout">end of video</div>'); popupTcEditEndDivEndVideo.click(function (event) { event.stopPropagation(); - let endVideo = rekall.videoPlayer.duration(); + let endVideo = window.app.rekall.Rekall().videoPlayer.duration(); let timeEnd = convertToTime(Math.round(endVideo)); that.popupTCeditDivMinEnd.val(timeEnd.split(":")[0]); that.popupTCeditDivSecEnd.val(timeEnd.split(":")[1]); @@ -287,7 +288,7 @@ TCPanelInputEditor.prototype.closeEdition = function () { let tcIn = (60 * tcInMin) + tcInSec; let tcOut = (60 * tcOutMin) + tcOutSec; - let endVideo = Math.ceil(rekall.videoPlayer.duration()); + let endVideo = Math.ceil(window.app.rekall.Rekall().videoPlayer.duration()); if ((tcInMin >= 120) || (tcInSec >= 60) || (tcOutMin >= 120) || (tcOutSec >= 60) || (tcInMin < 0) || (tcInSec < 0) || (tcOutMin < 0) || (tcOutSec < 0)) { window.app.rekall.Rekall('pubSub').publish('alert', {message: 'Invalid time code', buttons: "ok"}); @@ -420,7 +421,7 @@ LinkPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { }) .keyup(function (event) { event.stopPropagation(); - if (event.which == 13) { + if (13 === event.which) { that.closeEdition(); } }) @@ -433,7 +434,7 @@ LinkPanelInputEditor.prototype.closeEdition = function () { if (this.canEdit) { let newValue = this.editDiv.val(); newValue = newValue.trim(); - if (newValue && newValue.length && newValue.indexOf("http") != 0) { + if (newValue && newValue.length && 0 !== newValue.indexOf("http")) { newValue = "http://" + newValue; } this.editDiv.val(newValue); @@ -587,7 +588,7 @@ SpeedPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { this.readonlyDiv.append(inputLabel); let speed = this.tag.getMetadata("Rekall->Speed"); - if (!speed || speed == '') + if (!speed || !speed.trim().length) speed = 1; this.readonlyDiv.children('input[value="' + speed + '"]').attr('checked', true); this.readonlyDiv.children('input[name=playback_rate]').change(function (event) { @@ -664,7 +665,7 @@ TagPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { this.tagCreationDiv.keypress(function (event) { that.openEdition.call(that); let keycode = (event.keyCode ? event.keyCode : event.which); - if (keycode != 13) { + if (13 !== keycode) { return; } @@ -752,10 +753,12 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { function createLeftPopup(popupPanelWidget) { let that = this; - $('#popupLeft').empty(); + let popupLeftDiv = $('#popupLeft'); let bgColorLeft = this.getTagGradientColor(); - $("#popupLeft").css("background", bgColorLeft); - $("#popupLet").attr('keydoc', this.document.key) + popupLeftDiv + .empty() + .css("background", bgColorLeft) + .attr('keydoc', this.document.key) let highlightDiv = $('<div>') .attr('id', 'popupSetHighlight') @@ -763,7 +766,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { .attr("ishighlight", this.getMetadata("Rekall->Highlight")?.length ? "true" : "false") .click(function (event) { event.stopPropagation(); - let isHL = that.getMetadata("Rekall->Highlight") ? true : false; + let isHL = !!that.getMetadata("Rekall->Highlight"); if (isHL) { that.setMetadata("Rekall->Highlight", ""); @@ -786,13 +789,13 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { .addClass('selected'); } - $('#popupLeft').append(highlightDiv); + popupLeftDiv.append(highlightDiv); let imageBoxDiv = $('<div>'); imageBoxDiv.addClass('popupLeftItem') .attr('id', 'popupImgBox'); - let image = $('<img>'); + let image = $('<img src="" alt="">'); if (this.isMarker()) { image.attr('src', "../shared/css/images/img-note.png"); } else { @@ -815,7 +818,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { .click(function (event) { event.stopPropagation(); if (that.isLink()) { - if (this.getMetadata("Rekall->Link")) window.open(this.getMetadata("Rekall->Link"), '_blank') + if (that.getMetadata("Rekall->Link")) window.open(that.getMetadata("Rekall->Link"), '_blank') } else { window.open(image.attr('src'), '_blank'); } @@ -854,7 +857,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { }); imageBoxDiv.append(displayOriginalImage); } - $('#popupLeft').append(imageBoxDiv); + popupLeftDiv.append(imageBoxDiv); if (popupPanelWidget.canEdit()) { let deleteElement = $('<div>'); @@ -872,7 +875,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { }) .addClass('popupLeftItem') .attr('id', 'popupEditSupprimer'); - $('#popupLeft').append(deleteElement); + popupLeftDiv.append(deleteElement); } } @@ -909,8 +912,9 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { createRightPopup.call(tag, this); createLeftPopup.call(tag, this); - $('#popupEdit').unbind('click'); - $('#popupEdit').click(function (event) { + $('#popupEdit') + .unbind('click') + .click(function (event) { event.stopPropagation(); that.ensureLastOpenedEditionClosed(); });