mirror of https://github.com/CIRCL/lookyloo
chg: some changes
parent
bef367b65c
commit
6307fd4872
|
@ -36,7 +36,7 @@
|
||||||
"stats.css": "/kY943FwWBTne4IIyf7iBROSfbGd82TeBicEXqKkRwawMVRIvM/Pk5MRa7okUyGIxaDjFQGmV/U1vy+PhN6Jbw==",
|
"stats.css": "/kY943FwWBTne4IIyf7iBROSfbGd82TeBicEXqKkRwawMVRIvM/Pk5MRa7okUyGIxaDjFQGmV/U1vy+PhN6Jbw==",
|
||||||
"stats_graph.js": "S/sMNQK1UMMLD0xQeEa7sq3ce8o6oPxwxGlyKVtaHOODjair86dbBDm7cu6pa/elMRDJT1j09jEFjWp+5GbhTw==",
|
"stats_graph.js": "S/sMNQK1UMMLD0xQeEa7sq3ce8o6oPxwxGlyKVtaHOODjair86dbBDm7cu6pa/elMRDJT1j09jEFjWp+5GbhTw==",
|
||||||
"tree.css": "xffZ5VGbH0dvaD3pJRj48PttTd29xtU45QozhHi/oJCKy8HU/NkHcGutpx9sOGMuY5tsKn8Pub6Ncsjj9f4TSg==",
|
"tree.css": "xffZ5VGbH0dvaD3pJRj48PttTd29xtU45QozhHi/oJCKy8HU/NkHcGutpx9sOGMuY5tsKn8Pub6Ncsjj9f4TSg==",
|
||||||
"tree.js": "26qV04hLcKiZB2Td5Oe/OZ2shdvGZv+xcO7VB1hcrvV3j7Urdvq/mMZ+OT5B8/iP0Ao7KvZKH3EzszXw55mkSA==",
|
"tree.js": "Z7Z83GKVauGBr/+v2OOkkWBWJ5qECr7B0JT9rRmVx37bGwSASWJDRT3B4pk57qk4XLGTAJ4ozq96P1nYLOZDFQ==",
|
||||||
"up.jpg": "d1ljZJ9f5JekyM6RLFFH2Ua44j6neiQBdUIXOenRTjGppQr3JaeglpQIH6BjPCJL177+TH52U3UIRNS5YAyKIg==",
|
"up.jpg": "d1ljZJ9f5JekyM6RLFFH2Ua44j6neiQBdUIXOenRTjGppQr3JaeglpQIH6BjPCJL177+TH52U3UIRNS5YAyKIg==",
|
||||||
"up_right.jpg": "OMmz+n+MxR34P8/fn5t4DkqKqdJRzQbXQ7fAi2lhkZIJGhVs2vIyY1f2hpYoBxDAX1OcYsSE2lqIR2vXNDGZsA==",
|
"up_right.jpg": "OMmz+n+MxR34P8/fn5t4DkqKqdJRzQbXQ7fAi2lhkZIJGhVs2vIyY1f2hpYoBxDAX1OcYsSE2lqIR2vXNDGZsA==",
|
||||||
"video.png": "gJtmkfr8I1Kw43pYEKjg6CAjgmhl1vIBKBQ3ZkxCu3wvxQm+6kf93iLrrFiY2WuiXzxEn2Leu52GJzmVN5id0g==",
|
"video.png": "gJtmkfr8I1Kw43pYEKjg6CAjgmhl1vIBKBQ3ZkxCu3wvxQm+6kf93iLrrFiY2WuiXzxEn2Leu52GJzmVN5id0g==",
|
||||||
|
|
|
@ -839,8 +839,8 @@ function update(root, computed_node_width=0) {
|
||||||
|
|
||||||
//download the tree as png file
|
//download the tree as png file
|
||||||
const downloadSvg = () => {
|
const downloadSvg = () => {
|
||||||
const svgElement = document.querySelector('svg');
|
const svg = document.querySelector('svg');
|
||||||
const svgCopy = svgElement.cloneNode(true);
|
const svgCopy = svg.cloneNode(true);
|
||||||
const images = svgCopy.querySelectorAll('image');
|
const images = svgCopy.querySelectorAll('image');
|
||||||
const promises = [];
|
const promises = [];
|
||||||
images.forEach((imageElement) => {
|
images.forEach((imageElement) => {
|
||||||
|
@ -866,21 +866,21 @@ const downloadSvg = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.all(promises).then(() => {
|
Promise.all(promises).then(() => {
|
||||||
var svgData = new XMLSerializer().serializeToString(svgCopy);
|
let svgData = new XMLSerializer().serializeToString(svgCopy);
|
||||||
var svgBlob = new Blob([svgData], { type: "image/svg+xml;charset=utf-8" });
|
let svgBlob = new Blob([svgData], { type: "image/svg+xml;charset=utf-8" });
|
||||||
var url = URL.createObjectURL(svgBlob);
|
let url = URL.createObjectURL(svgBlob);
|
||||||
var img = new Image();
|
let img = new Image();
|
||||||
img.onload = function() {
|
img.onload = function() {
|
||||||
var canvas = document.createElement('canvas');
|
let canvas = document.createElement('canvas');
|
||||||
canvas.width = svgCopy.width.baseVal.value * 2;
|
canvas.width = svgCopy.width.baseVal.value;
|
||||||
canvas.height = svgCopy.height.baseVal.value * 2;
|
canvas.height = svgCopy.height.baseVal.value;
|
||||||
var ctx = canvas.getContext('2d');
|
let ctx = canvas.getContext('2d');
|
||||||
ctx.fillStyle='white';
|
ctx.fillStyle='white';
|
||||||
ctx.fillRect(0,0,canvas.width,canvas.height)
|
ctx.fillRect(0,0,canvas.width,canvas.height)
|
||||||
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
var png = canvas.toDataURL('image/png');
|
let png = canvas.toDataURL('image/png');
|
||||||
var a = document.createElement('a');
|
let a = document.createElement('a');
|
||||||
a.download = 'tree.png';
|
a.download = 'tree.png';
|
||||||
a.href = png;
|
a.href = png;
|
||||||
a.click();
|
a.click();
|
||||||
|
|
Loading…
Reference in New Issue