Merge pull request #13 from tborychowski/master

Bug fixes
This commit is contained in:
Jeroen 2020-11-06 21:29:08 +01:00 committed by GitHub
commit db5353914d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 49 deletions

View file

@ -228,6 +228,8 @@ table a{
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
flex: 1;
overflow: hidden;
} }
.apps_text a{ .apps_text a{
@ -553,4 +555,4 @@ table a{
#app-address { #app-address {
display: none; display: none;
} }
} }

View file

@ -1,50 +1,16 @@
var data_links = "links.json"; function fetchAndRender (name) {
var bookmarks = JSON.parse(localStorage.getItem("links")); fetch(name + '.json')
.then(response => response.json())
function handleLinks(data) { .then(data => {
var mysource = document.getElementById("links-template").innerHTML; const mysource = document.getElementById(name + '-template').innerHTML;
var mytemplate = Handlebars.compile(mysource); const mytemplate = Handlebars.compile(mysource);
var myresult = mytemplate(data) const myresult = mytemplate(data);
document.getElementById("links").innerHTML = myresult; document.getElementById(name).innerHTML = myresult;
});
} }
document.addEventListener("DOMContentLoaded", function () { document.addEventListener('DOMContentLoaded', () => {
if (!bookmarks) { fetchAndRender('apps');
fetch(data_links) fetchAndRender('links');
.then(response => response.json()) fetchAndRender('providers');
.then(function (data) {
handleLinks(data);
localStorage.setItem("links", JSON.stringify(data));
});
} else {
handleLinks(bookmarks);
}
}); });
var data_apps = "apps.json";
document.addEventListener("DOMContentLoaded", function () {
fetch(data_apps)
.then( response => response.json())
.then(
function (data) {
var mysource = document.getElementById("apps-template").innerHTML;
var mytemplate = Handlebars.compile(mysource);
var myresult = mytemplate(data)
document.getElementById("apps").innerHTML = myresult;
});
});
var data_providers = "providers.json";
document.addEventListener("DOMContentLoaded", function () {
fetch(data_providers)
.then( response => response.json())
.then(
function (data) {
var mysource = document.getElementById("providers-template").innerHTML;
var mytemplate = Handlebars.compile(mysource);
var myresult = mytemplate(data)
document.getElementById("providers").innerHTML = myresult;
});
});

View file

@ -14,7 +14,7 @@ services:
ports: ports:
- 4000:80 - 4000:80
volumes: volumes:
- ./:/usr/share/nginx/html - ./:/opt/html
networks: networks:
nginx-proxy: nginx-proxy: