MCPcopy Create free account
hub / github.com/Threadfin/Threadfin / uploadLogo

Function uploadLogo

ts/base_ts.ts:700–753  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

698}
699
700function uploadLogo() {
701
702 if (document.getElementById('upload')) {
703 document.getElementById('upload').remove()
704 }
705
706 var upload = document.createElement("INPUT");
707 upload.setAttribute("type", "file");
708 upload.setAttribute("class", "notVisible");
709 upload.setAttribute("name", "");
710 upload.id = "upload";
711
712 document.body.appendChild(upload);
713 upload.click();
714
715 upload.onblur = function () {
716 alert()
717 }
718
719 upload.onchange = function () {
720
721 var filename = (upload as HTMLInputElement).files[0].name
722
723 var reader = new FileReader();
724 var file = (document.querySelector('input[type=file]') as HTMLInputElement).files[0];
725
726 if (file) {
727
728 reader.readAsDataURL(file);
729 reader.onload = function () {
730 console.log(reader.result);
731 var data = new Object();
732 var cmd = "uploadLogo"
733 data["base64"] = reader.result
734 data["filename"] = file.name
735
736 var server: Server = new Server(cmd)
737 server.request(data)
738
739 var updateLogo = (document.getElementById('update-icon') as HTMLInputElement)
740 updateLogo.checked = false
741 updateLogo.className = "changed"
742
743 };
744
745 } else {
746 alert("File could not be loaded")
747 }
748
749 upload.remove()
750 return
751 }
752
753}
754
755function probeChannel(url: string) {
756

Callers

nothing calls this directly

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected