mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
Handle more download types
This commit is contained in:
parent
8eacb0fdb0
commit
19762bef52
1 changed files with 4 additions and 2 deletions
|
|
@ -65,6 +65,8 @@ window.onhashchange = window.onload = function() {
|
|||
preamble = HEAD_TAGS;
|
||||
} else if (hash.indexOf("data:text/plain;") == 0) {
|
||||
preamble = HEAD_TAGS_EXTENDED;
|
||||
} else if (hash.indexOf("data:text/") == 0) {
|
||||
} else if (hash.indexOf("data:image/") == 0) {
|
||||
} else {
|
||||
let match = hash.match(dataRE);
|
||||
let type = match?.groups.type;
|
||||
|
|
@ -100,13 +102,13 @@ window.onhashchange = window.onload = function() {
|
|||
if (isWatch) {
|
||||
renderMode = "rewrite";
|
||||
}
|
||||
console.log("rendermode", renderMode)
|
||||
console.log("Rendering via", renderMode)
|
||||
dataURL = dataURL.replace("application/ld+json", "text/plain");
|
||||
if (renderMode == "download") {
|
||||
try {
|
||||
let dl = document.querySelector("#download");
|
||||
dl.href = dataURL;
|
||||
dl.title = title;
|
||||
dl.download = title;
|
||||
dl.click();
|
||||
document.body.classList.add("download");
|
||||
} catch (e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue