From f0be1d4485228edbe096dde4fa82a5d5ab1f5176 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 22 Dec 2024 04:45:45 +0200 Subject: New utility function to offer data for downloading --- src/css/akn.css | 1 + src/js/utils.js | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/css/akn.css b/src/css/akn.css index e034628..a3e2da1 100644 --- a/src/css/akn.css +++ b/src/css/akn.css @@ -204,6 +204,7 @@ select { } article { + font-family: monospace; border: none; border-radius: 40px; border-left: 2px dashed #672178; diff --git a/src/js/utils.js b/src/js/utils.js index 74f3cfa..a952328 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -26,4 +26,13 @@ export function debugLog(message) { if (showDebug) console.log(message); } + +export function offerDownloadableData(data) +{ + var link = document.createElement('a'); + link.download = 'data'; + var blob = new Blob([data]); // , {type: 'text/plain'} + link.href = window.URL.createObjectURL(blob); + link.click(); +} // @license-end -- cgit v1.2.3