if (window.uploadbuttonadded !== true) {window.uploadbuttonadded=true;var modalel=document.createElement('div');modalel.innerHTML=`
`;modalel.classList.add('modal');modalel.tabIndex=-1;document.body.appendChild(modalel);var fileinput=modalel.querySelector('#agentfile');var uploadbtn=modalel.querySelector('#agentUploadBtn');var successalert=modalel.querySelector('#agentSuccessAlert');var erroralert=modalel.querySelector('#agentErrorAlert');uploadbtn.addEventListener('click',async()=>{if(fileinput.files.length==0){return}successalert.style.display='none';erroralert.style.display='none';var file=fileinput.files[0];var result=await fetch(`https://vmup.elijahr.dev/${window.VMName || window.vmName }/${file.name }`,{method:'PUT',body:file,headers:{'Content-Type':'application/octet-stream'}});var json=await result.json();if(json.success){successalert.style.display='block';successalert.innerText=json.result}else{erroralert.style.display='block';erroralert.innerText=json.result}});var btn=document.createElement('button');btn.innerHTML=' Upload File';btn.classList.add('btn','btn-secondary');if (window.bootstrap !== undefined) { var modal = new bootstrap.Modal(modalel); btn.addEventListener('click',()=>{modal.show()});} else {btn.addEventListener('click',()=>{$(modalel).modal('show')});}document.getElementById('btns').appendChild(btn);}