${key3} : ${el}
` 155 | ); 156 | } 157 | } 158 | } 159 | } 160 | 161 | async function newFile(){ 162 | const input = document.createElement('input'); 163 | input.style.visibility = 'hidden'; 164 | input.type = 'file'; 165 | input.onchange = e => { 166 | // getting a hold of the file reference 167 | const file = e.target.files[0]; 168 | // setting up the reader 169 | const reader = new FileReader(); 170 | reader.readAsText(file,'UTF-8'); 171 | // here we tell the reader what to do when it's done reading... 172 | reader.onload = readerEvent => { 173 | let content = readerEvent.target.result; // this is the content! 174 | document.getElementById('json_input').value = content; 175 | try { 176 | JSON.parse(content); 177 | } catch (error) { 178 | validJson.classList.add("hidden"); 179 | invalidJson.classList.remove("hidden"); 180 | return; 181 | } 182 | const tree = JSONCracker(JSON.parse(content)); 183 | treeTOhtml(tree); 184 | invalidJson.classList.add("hidden"); 185 | validJson.classList.remove("hidden"); 186 | } 187 | 188 | } 189 | input.click(); 190 | } 191 | 192 | function deleteJsonContent() 193 | { 194 | document.getElementById('json_input').value = ''; 195 | invalidJson.classList.add("hidden"); 196 | validJson.classList.remove("hidden"); 197 | } 198 | -------------------------------------------------------------------------------- /public/map.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |