Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function linkifyURLs(element: Element): void {
if (element.textContent!.length < 15) { // Must be long enough for a URL
return;
}
const linkified = linkifyURLsCore(element.textContent!, {
type: 'dom' as const,
attributes: {
rel: 'noreferrer noopener',
class: linkifiedURLClass // Necessary to avoid also shortening the links
}
});
if (linkified.children.length === 0) { // Children are <a>
return;
}
zipTextNodes(element, linkified);
}
</a>
/***********************************************************************
This creates an eventlistener for each time element.
Fine for current average log size(8-15-17), but memory usuage will spike
for really big logs.
***********************************************************************/
this.highLightDiv(time);
const timer = new Date(logDataResults.timeStamp[j]);
const timeMil = timer.getTime();
//Multiple by 60000 to convert offset to milliseconds
const offset = timer.getTimezoneOffset() * 60000;
const timezone = timeMil - offset;
const newDate = new Date(timezone);
div.innerHTML = ansi_up.ansi_to_html(
linkifyUrls(lineItem[j][k], {
attributes: {
target: '_blank',
rel: 'noreferrer noopener',
},
})
);
time.innerHTML = format(newDate, 'h:mm:ss aa');
div.appendChild(time);
frag.appendChild(div);
}
}
this.refs.log.appendChild(frag);
this.centerHighlightedDiv();