Skip to content

Commit

Permalink
add auto insert when the mark disappars
Browse files Browse the repository at this point in the history
  • Loading branch information
0x24a committed Mar 2, 2024
1 parent 078c476 commit 4726279
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions plugins/catboxy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,23 @@ function uploadFile(file) {
.then(response => {
(async () => {
pushMessage({nick:"*",text:`File upload ID ${placeholder} success.`})
document.querySelector("#chatinput").value=document.querySelector("#chatinput").value.replace(`Uploading :: ${placeholder}`,CAMO_BASE+await response.text())
if(document.querySelector("#chatinput").value.includes(`Uploading :: ${placeholder}`)){
document.querySelector("#chatinput").value=document.querySelector("#chatinput").value.replace(`Uploading :: ${placeholder}`,CAMO_BASE+await response.text()+"&mime="+file.type)
}else{
document.querySelector("#chatinput").value=document.querySelector("#chatinput").value.replace(`Uploading :: ${placeholder}`,CAMO_BASE+await response.text()+"&mime="+file.type)
}
})();
})
.catch(error => {
(async () => {
pushMessage({nick:"!",text:"Failed to upload file."})
document.querySelector("#chatinput").value=document.querySelector("#chatinput").value.replace(`Uploading :: ${placeholder}`,"UPLOAD_FAILED")
})();
if(document.querySelector("#chatinput").value.includes(`Uploading :: ${placeholder}`)){
document.querySelector("#chatinput").value=document.querySelector("#chatinput").value.replace(`Uploading :: ${placeholder}`,"UPLOAD_FAILED")}
else{
//do nothing.
}
}
)();
});
}
addPluginButton("Upload Image",() => selectImage())
Expand Down

0 comments on commit 4726279

Please sign in to comment.