diff --git a/capsule-prototype/js/online-rekall/Tag.js b/capsule-prototype/js/online-rekall/Tag.js index 5d0ac8cc30b2abc7162b49663b2458c76ddde113..830b653a5a2f3a9e9fd9b5781bd06f32df316fb7 100644 --- a/capsule-prototype/js/online-rekall/Tag.js +++ b/capsule-prototype/js/online-rekall/Tag.js @@ -143,6 +143,29 @@ Tag.prototype.update = function (color, strong) { this.color = "#000000"; } Tag.prototype.createTimelineDiv = function () { + if(this.getMetadata("Rekall->Highlight")){ + return CreateHighlightedTimeLineDiv.call(this); + } + + return CreateTimeLineDiv.call(this) +} +Tag.prototype.getLabels = function () { + let labels = this.getMetadata('Rekall->Labels'); + if (!labels) + return []; + + let isStringNullOrWhitspace = function (s) { + if (typeof s !== "string" || !s) { + return false; + } + + return !s.trim(); + } + + return labels.split(';').filter(s => !isStringNullOrWhitspace(s)); +} + +const CreateTimeLineDiv = function(){ let that = this; let styleColor = "background-color: " + this.color + ";"; let textColor2 = "color: rgba(255,255,255,.8)"; @@ -185,30 +208,9 @@ Tag.prototype.createTimelineDiv = function () { }); return this.flattenTimelineDom; - -} -Tag.prototype.getLabels = function () { - let labels = this.getMetadata('Rekall->Labels'); - if (!labels) - return []; - - let isStringNullOrWhitspace = function (s) { - if (typeof s !== "string" || !s) { - return false; - } - - return !s.trim(); - } - - return labels.split(';').filter(s => !isStringNullOrWhitspace(s)); -} - -function HighLightedTag(data) { - Tag.call(this, data.Document); } -HighLightedTag.prototype = Object.create(Tag.prototype); -HighLightedTag.prototype.createTimelineDiv = function () { +const CreateHighlightedTimeLineDiv = function () { let that = this; let styleColor = "background-color: " + this.color + ";"; let textColor = "color: " + this.color + ";"; @@ -270,13 +272,3 @@ HighLightedTag.prototype.createTimelineDiv = function () { return this.flattenTimelineDom; } - - -const TagFactory = function (document) { - - if (document.getMetadata("Rekall->Highlight", document.currentVersion)) { - return new HighLightedTag({document: document}) - } - - return new Tag(document); -} \ No newline at end of file diff --git a/capsule-prototype/js/rekall/Document.js b/capsule-prototype/js/rekall/Document.js index cb4a3d73cf87af6d07efa22660cd078f05ac9a3b..3e2b872b3d3c4751209e4b6f83e1ba07f38bcde4 100644 --- a/capsule-prototype/js/rekall/Document.js +++ b/capsule-prototype/js/rekall/Document.js @@ -167,7 +167,7 @@ Document.prototype.addVersion = function(document) { for (var index in this.tags) { var tag = this.tags[index]; if(tag.version == thisVersion) { - var newTag = TagFactory(this); + var newTag = new Tag(document); newTag.timeStart = tag.getTimeStart(); newTag.timeEnd = tag.getTimeEnd(); this.addTag(newTag); diff --git a/capsule-prototype/js/rekall/Source.js b/capsule-prototype/js/rekall/Source.js index 58080ed262002951a4cff5f97f867416f6d5b4a3..7a1e631cb3b436f6ec9c31372231c814c2b96bcc 100644 --- a/capsule-prototype/js/rekall/Source.js +++ b/capsule-prototype/js/rekall/Source.js @@ -35,7 +35,7 @@ Source.prototype.addDocument = function(document) { if(this.documents[document.key] == undefined) { if(document.tags.length == 0) { - var tag = TagFactory(document); + var tag = new Tag(document); document.addTag(tag); } document.metadatas[-1] = document.cloneMetadatas();