diff options
author | tomsmeding <tom.smeding@gmail.com> | 2019-05-08 15:08:44 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2019-05-08 15:08:44 +0200 |
commit | 3b5d11ed921f8f6cc4ecbdb0f5988f4ca588cb60 (patch) | |
tree | a70cd973394a7f7bb3227ec43b646e33d3489a5b | |
parent | 14051a59c923b640fb6b840b198584dc2a6a1a76 (diff) |
save: Fix deleting non-last file
-rw-r--r-- | modules/save/read.html | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/save/read.html b/modules/save/read.html index c359dd5..8ed703b 100644 --- a/modules/save/read.html +++ b/modules/save/read.html @@ -21,23 +21,23 @@ function populateList(arr){ var a=document.createElement("a"); a.appendChild(document.createTextNode(arr[i])); a.href="javascript:void 0"; - a.addEventListener("click",(function(i,li){return function(){ + a.addEventListener("click",(function(fname,li){return function(){ var xhr=new XMLHttpRequest(); xhr.onreadystatechange=function(){ if(xhr.readyState==4){ if(xhr.status!=200){ - alert("Error reading save '"+arr[i]+"'\n"+xhr.responseText); + alert("Error reading save '"+fname+"'\n"+xhr.responseText); } else { var l=ul.getElementsByClassName("selected"); for(var i=0;i<l.length;i++)l[i].classList.remove("selected"); li.classList.add("selected"); - displaySave(arr[i],xhr.responseText); + displaySave(fname,xhr.responseText); } } }; - xhr.open("GET","/save/read/file/"+encodeURIComponent(arr[i])); + xhr.open("GET","/save/read/file/"+encodeURIComponent(fname)); xhr.send(); - };})(i,li)); + };})(arr[i],li)); li.appendChild(a); ul.appendChild(li); } |