1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_ynh.git synced 2024-09-03 20:26:22 +02:00
snserver_ynh/sources/extra_files/app/public/extensions/js.js

24 lines
638 B
JavaScript
Raw Normal View History

2021-01-11 22:23:08 +01:00
loadJSON("extensions/index.json");
function loadJSON(file){
2021-01-11 22:33:16 +01:00
fetch(file)
.then(function (response) {
return response.json();
})
.then(function (data) {
appendData(data);
})
.catch(function (err) {
console.log('error: ' + err);
});
2021-01-11 22:23:08 +01:00
}
function appendData(data) {
2021-01-11 22:33:16 +01:00
for (var i = 0; i < data.length; i++) {
var mainContainer = document.getElementById(data[i].extension + "sData");
var tr = document.createElement("tr");
tr.innerHTML =
"<td id='name'>" + data[i].name + "</td>" +
"<td id='url'><a href=" + data[i].url + ">" + data[i].url + "</a></td>"
mainContainer.appendChild(tr);
}
2021-01-11 22:23:08 +01:00
}