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

Fix timeline div factory in accordance to rekall initialization

parent d2d7b2fa
Branches base-webtop
No related tags found
1 merge request!101Fix timeline div factory in accordance to rekall initialization
Pipeline #1119 passed
......@@ -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
......@@ -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);
......
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment