Skip to content
Snippets Groups Projects
Commit ba542b37 authored by Sebastien's avatar Sebastien
Browse files

Fix warnings on popupPanelWidget.js

parent 7051d619
No related branches found
No related tags found
1 merge request!98refresh the mosaic on annotation modification
...@@ -13,6 +13,7 @@ function PanelInputEditor(data) { ...@@ -13,6 +13,7 @@ function PanelInputEditor(data) {
this.canEdit = data.canEdit; this.canEdit = data.canEdit;
this.popupPanelWidget = data.popupPanelWidget; this.popupPanelWidget = data.popupPanelWidget;
} }
// eslint-disable-next-line no-unused-vars
PanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { PanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
} }
PanelInputEditor.prototype.closeEdition = function () { PanelInputEditor.prototype.closeEdition = function () {
...@@ -223,10 +224,10 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -223,10 +224,10 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
event.stopPropagation(); event.stopPropagation();
}); });
this.editDiv.append(this.popupTCeditDivSecStart); 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) { popupTCeditStartDivNow.click(function (event) {
event.stopPropagation(); 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.popupTCeditDivMinStart.val(timeCurrent.split(":")[0]);
that.popupTCeditDivSecStart.val(timeCurrent.split(":")[1]); that.popupTCeditDivSecStart.val(timeCurrent.split(":")[1]);
}); });
...@@ -257,10 +258,10 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -257,10 +258,10 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
event.stopPropagation(); event.stopPropagation();
}); });
this.editDiv.append(this.popupTCeditDivSecEnd); 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) { popupTCeditEndDivNow.click(function (event) {
event.stopPropagation(); 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.popupTCeditDivMinEnd.val(timeCurrent.split(":")[0]);
that.popupTCeditDivSecEnd.val(timeCurrent.split(":")[1]); that.popupTCeditDivSecEnd.val(timeCurrent.split(":")[1]);
}); });
...@@ -269,7 +270,7 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -269,7 +270,7 @@ TCPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
let popupTcEditEndDivEndVideo = $('<div class="nowTCbtn" id="eovTCout">end of video</div>'); let popupTcEditEndDivEndVideo = $('<div class="nowTCbtn" id="eovTCout">end of video</div>');
popupTcEditEndDivEndVideo.click(function (event) { popupTcEditEndDivEndVideo.click(function (event) {
event.stopPropagation(); event.stopPropagation();
let endVideo = rekall.videoPlayer.duration(); let endVideo = window.app.rekall.Rekall().videoPlayer.duration();
let timeEnd = convertToTime(Math.round(endVideo)); let timeEnd = convertToTime(Math.round(endVideo));
that.popupTCeditDivMinEnd.val(timeEnd.split(":")[0]); that.popupTCeditDivMinEnd.val(timeEnd.split(":")[0]);
that.popupTCeditDivSecEnd.val(timeEnd.split(":")[1]); that.popupTCeditDivSecEnd.val(timeEnd.split(":")[1]);
...@@ -287,7 +288,7 @@ TCPanelInputEditor.prototype.closeEdition = function () { ...@@ -287,7 +288,7 @@ TCPanelInputEditor.prototype.closeEdition = function () {
let tcIn = (60 * tcInMin) + tcInSec; let tcIn = (60 * tcInMin) + tcInSec;
let tcOut = (60 * tcOutMin) + tcOutSec; 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)) { 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"}); window.app.rekall.Rekall('pubSub').publish('alert', {message: 'Invalid time code', buttons: "ok"});
...@@ -420,7 +421,7 @@ LinkPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -420,7 +421,7 @@ LinkPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
}) })
.keyup(function (event) { .keyup(function (event) {
event.stopPropagation(); event.stopPropagation();
if (event.which == 13) { if (13 === event.which) {
that.closeEdition(); that.closeEdition();
} }
}) })
...@@ -433,7 +434,7 @@ LinkPanelInputEditor.prototype.closeEdition = function () { ...@@ -433,7 +434,7 @@ LinkPanelInputEditor.prototype.closeEdition = function () {
if (this.canEdit) { if (this.canEdit) {
let newValue = this.editDiv.val(); let newValue = this.editDiv.val();
newValue = newValue.trim(); newValue = newValue.trim();
if (newValue && newValue.length && newValue.indexOf("http") != 0) { if (newValue && newValue.length && 0 !== newValue.indexOf("http")) {
newValue = "http://" + newValue; newValue = "http://" + newValue;
} }
this.editDiv.val(newValue); this.editDiv.val(newValue);
...@@ -587,7 +588,7 @@ SpeedPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -587,7 +588,7 @@ SpeedPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
this.readonlyDiv.append(inputLabel); this.readonlyDiv.append(inputLabel);
let speed = this.tag.getMetadata("Rekall->Speed"); let speed = this.tag.getMetadata("Rekall->Speed");
if (!speed || speed == '') if (!speed || !speed.trim().length)
speed = 1; speed = 1;
this.readonlyDiv.children('input[value="' + speed + '"]').attr('checked', true); this.readonlyDiv.children('input[value="' + speed + '"]').attr('checked', true);
this.readonlyDiv.children('input[name=playback_rate]').change(function (event) { this.readonlyDiv.children('input[name=playback_rate]').change(function (event) {
...@@ -664,7 +665,7 @@ TagPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) { ...@@ -664,7 +665,7 @@ TagPanelInputEditor.prototype.appendInputEditorDiv = function (parentDiv) {
this.tagCreationDiv.keypress(function (event) { this.tagCreationDiv.keypress(function (event) {
that.openEdition.call(that); that.openEdition.call(that);
let keycode = (event.keyCode ? event.keyCode : event.which); let keycode = (event.keyCode ? event.keyCode : event.which);
if (keycode != 13) { if (13 !== keycode) {
return; return;
} }
...@@ -752,10 +753,12 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { ...@@ -752,10 +753,12 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
function createLeftPopup(popupPanelWidget) { function createLeftPopup(popupPanelWidget) {
let that = this; let that = this;
$('#popupLeft').empty(); let popupLeftDiv = $('#popupLeft');
let bgColorLeft = this.getTagGradientColor(); let bgColorLeft = this.getTagGradientColor();
$("#popupLeft").css("background", bgColorLeft); popupLeftDiv
$("#popupLet").attr('keydoc', this.document.key) .empty()
.css("background", bgColorLeft)
.attr('keydoc', this.document.key)
let highlightDiv = $('<div>') let highlightDiv = $('<div>')
.attr('id', 'popupSetHighlight') .attr('id', 'popupSetHighlight')
...@@ -763,7 +766,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { ...@@ -763,7 +766,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
.attr("ishighlight", this.getMetadata("Rekall->Highlight")?.length ? "true" : "false") .attr("ishighlight", this.getMetadata("Rekall->Highlight")?.length ? "true" : "false")
.click(function (event) { .click(function (event) {
event.stopPropagation(); event.stopPropagation();
let isHL = that.getMetadata("Rekall->Highlight") ? true : false; let isHL = !!that.getMetadata("Rekall->Highlight");
if (isHL) { if (isHL) {
that.setMetadata("Rekall->Highlight", ""); that.setMetadata("Rekall->Highlight", "");
...@@ -786,13 +789,13 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { ...@@ -786,13 +789,13 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
.addClass('selected'); .addClass('selected');
} }
$('#popupLeft').append(highlightDiv); popupLeftDiv.append(highlightDiv);
let imageBoxDiv = $('<div>'); let imageBoxDiv = $('<div>');
imageBoxDiv.addClass('popupLeftItem') imageBoxDiv.addClass('popupLeftItem')
.attr('id', 'popupImgBox'); .attr('id', 'popupImgBox');
let image = $('<img>'); let image = $('<img src="" alt="">');
if (this.isMarker()) { if (this.isMarker()) {
image.attr('src', "../shared/css/images/img-note.png"); image.attr('src', "../shared/css/images/img-note.png");
} else { } else {
...@@ -815,7 +818,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { ...@@ -815,7 +818,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
.click(function (event) { .click(function (event) {
event.stopPropagation(); event.stopPropagation();
if (that.isLink()) { 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 { } else {
window.open(image.attr('src'), '_blank'); window.open(image.attr('src'), '_blank');
} }
...@@ -854,7 +857,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { ...@@ -854,7 +857,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
}); });
imageBoxDiv.append(displayOriginalImage); imageBoxDiv.append(displayOriginalImage);
} }
$('#popupLeft').append(imageBoxDiv); popupLeftDiv.append(imageBoxDiv);
if (popupPanelWidget.canEdit()) { if (popupPanelWidget.canEdit()) {
let deleteElement = $('<div>'); let deleteElement = $('<div>');
...@@ -872,7 +875,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { ...@@ -872,7 +875,7 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
}) })
.addClass('popupLeftItem') .addClass('popupLeftItem')
.attr('id', 'popupEditSupprimer'); .attr('id', 'popupEditSupprimer');
$('#popupLeft').append(deleteElement); popupLeftDiv.append(deleteElement);
} }
} }
...@@ -909,8 +912,9 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) { ...@@ -909,8 +912,9 @@ PopupPanelWidget.prototype.createPopupContent = function (tag) {
createRightPopup.call(tag, this); createRightPopup.call(tag, this);
createLeftPopup.call(tag, this); createLeftPopup.call(tag, this);
$('#popupEdit').unbind('click'); $('#popupEdit')
$('#popupEdit').click(function (event) { .unbind('click')
.click(function (event) {
event.stopPropagation(); event.stopPropagation();
that.ensureLastOpenedEditionClosed(); that.ensureLastOpenedEditionClosed();
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment