Skip to content

Commit 7cbd9f2

Browse files
save file
1 parent d807568 commit 7cbd9f2

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

code/html/page-html/v1.0/page-html-v1.0.html

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,24 @@ <h3>
241241
//:
242242

243243

244+
btn.download = function(){
245+
246+
var {txt,error} = get(base+path+filename);
247+
if(error){
248+
log.red(error);
249+
return;
250+
}
251+
var blob = new Blob([txt]);
252+
var url = window.URL.createObjectURL(blob);
253+
254+
var a = document.createElement('a');
255+
a.download = filename;
256+
a.href = url;
257+
a.click();
258+
259+
}//download
260+
261+
244262
btn.tabs = function(e){
245263

246264
var tab = e.target;
@@ -260,7 +278,7 @@ <h3>
260278
tab.classList.add('active');
261279
$(`#view #${tab.id}`).style.display = '';
262280

263-
}//tabss
281+
}//tabs
264282

265283
//:
266284

@@ -344,7 +362,7 @@ <h3>
344362
}
345363
if(!res.ok){
346364
error = `( ${res.status} ) ${res.statusText}`;
347-
cache[url] = error;
365+
//cache[url] = error;
348366
//var error = await res.text();
349367
//log.red(error);
350368
return {error};

0 commit comments

Comments
 (0)