document.getElementById("uploadButton").addEventListener("click",() => { let ask = prompt("Input a URL to clone.") if (ask) { let opt = getOptionsForUploading() updateBtnTxt("Requesting clone. Please wait.") let xmlhttp = new XMLHttpRequest() xmlhttp.addEventListener("error",function(e) { updateBtnTxt(`Upload failed.
${e.toString()}`) console.error(e) }) xmlhttp.addEventListener("load",function() { if (xmlhttp.status == 200) { document.getElementById("CopyTB").value = `https://${location.hostname}/download/${xmlhttp.responseText}` updateBtnTxt(`Upload complete.
Copy URL View URL`) } else { updateBtnTxt(`Upload failed.
${xmlhttp.responseText}`) } }) xmlhttp.open("POST","/clone") xmlhttp.send(JSON.stringify({ url: ask, ...opt })) } })