Created
March 16, 2021 20:30
-
-
Save michael-land/32172a1540f1b48037fdf12342e6aadd to your computer and use it in GitHub Desktop.
twinportspool.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const e=document.createElement("button");e.id="uploader",e.innerText="upload logo to JTD 220",document.body.append(e),e.addEventListener("click",(async()=>{const e=document.querySelector("#coreBoardForm"),o=new FormData(e);o.set("GenerateScoreboardButton","Download+Scoreboard");const t=await fetch("https://www.twinportspool.com/sb.aspx",{body:new URLSearchParams(o),method:"POST",mode:"cors",credentials:"include"}),n=await t.blob(),a=new FormData;a.append("myFile",n,"image.png");try{const e=await fetch("https://4d7de8574216.ngrok.io/upload",{method:"POST",body:a});if(console.log(e.ok),e.ok){const e=document.createElement("div");e.innerHTML="Your image uploaded successfully",document.body.append(e),setTimeout((()=>{e.parentNode.removeChild(e)}),1e3)}else alert("Opps, something wrong while uploading your image")}catch(r){console.log(r),alert("Opps, something wrong while uploading your image")}})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment