From 6307fd48726b96301977c321280dad1b8d87ffcf Mon Sep 17 00:00:00 2001 From: Adrian Maraj Date: Tue, 14 May 2024 13:58:47 +0200 Subject: [PATCH] chg: some changes --- website/web/sri.txt | 2 +- website/web/static/tree.js | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/website/web/sri.txt b/website/web/sri.txt index 99196672..44d32565 100644 --- a/website/web/sri.txt +++ b/website/web/sri.txt @@ -36,7 +36,7 @@ "stats.css": "/kY943FwWBTne4IIyf7iBROSfbGd82TeBicEXqKkRwawMVRIvM/Pk5MRa7okUyGIxaDjFQGmV/U1vy+PhN6Jbw==", "stats_graph.js": "S/sMNQK1UMMLD0xQeEa7sq3ce8o6oPxwxGlyKVtaHOODjair86dbBDm7cu6pa/elMRDJT1j09jEFjWp+5GbhTw==", "tree.css": "xffZ5VGbH0dvaD3pJRj48PttTd29xtU45QozhHi/oJCKy8HU/NkHcGutpx9sOGMuY5tsKn8Pub6Ncsjj9f4TSg==", - "tree.js": "26qV04hLcKiZB2Td5Oe/OZ2shdvGZv+xcO7VB1hcrvV3j7Urdvq/mMZ+OT5B8/iP0Ao7KvZKH3EzszXw55mkSA==", + "tree.js": "Z7Z83GKVauGBr/+v2OOkkWBWJ5qECr7B0JT9rRmVx37bGwSASWJDRT3B4pk57qk4XLGTAJ4ozq96P1nYLOZDFQ==", "up.jpg": "d1ljZJ9f5JekyM6RLFFH2Ua44j6neiQBdUIXOenRTjGppQr3JaeglpQIH6BjPCJL177+TH52U3UIRNS5YAyKIg==", "up_right.jpg": "OMmz+n+MxR34P8/fn5t4DkqKqdJRzQbXQ7fAi2lhkZIJGhVs2vIyY1f2hpYoBxDAX1OcYsSE2lqIR2vXNDGZsA==", "video.png": "gJtmkfr8I1Kw43pYEKjg6CAjgmhl1vIBKBQ3ZkxCu3wvxQm+6kf93iLrrFiY2WuiXzxEn2Leu52GJzmVN5id0g==", diff --git a/website/web/static/tree.js b/website/web/static/tree.js index dffd204c..2b99a2ff 100644 --- a/website/web/static/tree.js +++ b/website/web/static/tree.js @@ -839,8 +839,8 @@ function update(root, computed_node_width=0) { //download the tree as png file const downloadSvg = () => { - const svgElement = document.querySelector('svg'); - const svgCopy = svgElement.cloneNode(true); + const svg = document.querySelector('svg'); + const svgCopy = svg.cloneNode(true); const images = svgCopy.querySelectorAll('image'); const promises = []; images.forEach((imageElement) => { @@ -866,21 +866,21 @@ const downloadSvg = () => { }); Promise.all(promises).then(() => { - var svgData = new XMLSerializer().serializeToString(svgCopy); - var svgBlob = new Blob([svgData], { type: "image/svg+xml;charset=utf-8" }); - var url = URL.createObjectURL(svgBlob); - var img = new Image(); + let svgData = new XMLSerializer().serializeToString(svgCopy); + let svgBlob = new Blob([svgData], { type: "image/svg+xml;charset=utf-8" }); + let url = URL.createObjectURL(svgBlob); + let img = new Image(); img.onload = function() { - var canvas = document.createElement('canvas'); - canvas.width = svgCopy.width.baseVal.value * 2; - canvas.height = svgCopy.height.baseVal.value * 2; - var ctx = canvas.getContext('2d'); + let canvas = document.createElement('canvas'); + canvas.width = svgCopy.width.baseVal.value; + canvas.height = svgCopy.height.baseVal.value; + let ctx = canvas.getContext('2d'); ctx.fillStyle='white'; ctx.fillRect(0,0,canvas.width,canvas.height) ctx.drawImage(img, 0, 0, canvas.width, canvas.height); - var png = canvas.toDataURL('image/png'); - var a = document.createElement('a'); + let png = canvas.toDataURL('image/png'); + let a = document.createElement('a'); a.download = 'tree.png'; a.href = png; a.click();