Skip to content

Commit

Permalink
kirilllive
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirilllive committed Jul 6, 2024
1 parent 892ad65 commit 2f04cfb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.DS_Store
.vscode/settings.json
.DS_Store
33 changes: 28 additions & 5 deletions ascii_paint.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
--bh:#efefff;
--font:Arial;
}
*::-webkit-scrollbar {
width: 6px;
height: 6px;
background-color:var(--cw);
display:none;
}
*::-webkit-scrollbar-thumb {
background: var(--cb);
border-radius:3px;
display:none;
}
hr{border-top:1px solid var(--cb);margin:4px 0px;}
option{color:#000;}
.cls-2 {stroke:#000;stroke-width: 8px;}
Expand Down Expand Up @@ -810,7 +821,7 @@
if(selected[1]>selected[3]){y1=selected[3];y2=selected[1]}else{y1=selected[1];y2=selected[3];}
}return se;
}
function save_art(c){
async function save_art(c){
var text="";
tr=canvas.getElementsByTagName('tr');
if(!get_selected()){x1=0;x2=tr[0].getElementsByTagName('td').length-1;y1=0;y2=tr.length;}else{y2++;}
Expand All @@ -820,10 +831,22 @@
if(y<y2-1){text.trim();text+="\n";}
}
if(c){
var a=document.getElementById("get_file");
a.setAttribute("href","data:text/json;charset=utf-8,"+encodeURIComponent(text));
a.setAttribute("download","text_art.txt");
a.click();
if("showSaveFilePicker" in window&&window.self===window.top) {
const opt={
suggestedName:"text_art.txt",
id:'ASCIIart',
types:[{description:'Text Files',accept:{'text/plain':['.txt']}}],
};
const file = await window.showSaveFilePicker(opt);
const content = await file.createWritable();
await content.write(text);
await content.close();
} else {
var a=document.getElementById("get_file");
a.setAttribute("href","data:text/json;charset=utf-8,"+encodeURIComponent(text));
a.setAttribute("download","text_art.txt");
a.click();
}
}else if(window_zone.style.display=="grid"){
state_save();window_zone.getElementsByClassName('edittext')[0].value=text;
}else{
Expand Down

0 comments on commit 2f04cfb

Please sign in to comment.