MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / ThreadfinRestore

Function ThreadfinRestore

html/js/base.js:268–301  ·  view source on GitHub ↗
(elm)

Source from the content-addressed store, hash-verified

266}
267
268function ThreadfinRestore(elm) {
269 var restore = document.createElement("INPUT");
270 restore.setAttribute("type", "file");
271 restore.setAttribute("class", "notVisible");
272 restore.setAttribute("name", "");
273 restore.id = "upload";
274
275 document.body.appendChild(restore);
276 restore.click();
277
278 restore.onchange = function () {
279 var filename = restore.files[0].name
280 //console.log(restore.srcElement.files[0]);
281 var check = confirm("File: " + filename + "\nAll data will be replaced with those from the backup.\nShould the files be restored?");
282 if (check == true) {
283 var reader = new FileReader();
284 var file = document.querySelector('input[type=file]').files[0];
285 if (file) {
286 reader.readAsDataURL(file);
287 reader.onload = function () {
288 console.log(reader.result);
289 var data = new Object();
290 data["cmd"] = "ThreadfinRestore"
291 data["base64"] = reader.result
292
293 Threadfin(data);
294 return
295 };
296 } else {
297 alert("File could not be loaded")
298 }
299 }
300 };
301}
302
303function getBase64(file) {
304 var reader = new FileReader();

Callers

nothing calls this directly

Calls 1

ThreadfinFunction · 0.70

Tested by

no test coverage detected