|
|
@ -5,7 +5,7 @@ |
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
|
|
<script src="/static/js/FileSaver.js"></script> |
|
|
|
<style> |
|
|
|
#save-svg{ |
|
|
|
#save-buttons{ |
|
|
|
position: fixed; |
|
|
|
top: 0.5em; |
|
|
|
right: 0.5em; |
|
|
@ -28,7 +28,10 @@ |
|
|
|
|
|
|
|
{{ svg|safe }} |
|
|
|
|
|
|
|
<button id="save-svg">> SVG</button> |
|
|
|
<div id="save-buttons"> |
|
|
|
<button id="save-svg">> SVG</button> |
|
|
|
<button id="save-hpgl">> HPGL</button> |
|
|
|
</div> |
|
|
|
|
|
|
|
<script> |
|
|
|
function get2bodyclass(){ |
|
|
@ -58,6 +61,25 @@ |
|
|
|
let blob = new Blob([source], {type: "text/plain;charset=utf-8"}); |
|
|
|
saveAs(blob, 'cobbled-paths.svg'); |
|
|
|
}); |
|
|
|
|
|
|
|
let save_button_hpgl = document.getElementById('save-hpgl'); |
|
|
|
save_button_hpgl.addEventListener('click', function () { |
|
|
|
let url = document.URL, |
|
|
|
parts = url.split('/'), |
|
|
|
name = parts[parts.length-1], |
|
|
|
hpgl_url = '/hpgl/' + name, |
|
|
|
a = document.createElement('a'); |
|
|
|
a.href = hpgl_url; |
|
|
|
a.setAttribute('download', 'download'); |
|
|
|
if (document.createEvent) { |
|
|
|
const event = document.createEvent('MouseEvents'); |
|
|
|
event.initEvent('click', true, true); |
|
|
|
a.dispatchEvent(event); |
|
|
|
} |
|
|
|
else { |
|
|
|
a.click(); |
|
|
|
} |
|
|
|
}); |
|
|
|
</script> |
|
|
|
|
|
|
|
</body> |
|
|
|