From 3c63e2d00ea7ab6671b3156b1ef064eb81f2fcf0 Mon Sep 17 00:00:00 2001 From: Tionis Nagir Date: Wed, 13 May 2020 16:24:14 +0200 Subject: [PATCH] Removed jQuery Dependency --- assets/js/data.js | 42 ++++++++++++++++++++++++------------------ index.html | 1 - 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/assets/js/data.js b/assets/js/data.js index e89b2de..14f0413 100755 --- a/assets/js/data.js +++ b/assets/js/data.js @@ -1,35 +1,41 @@ var data_links = "links.json"; - -$(document).ready(function(){ - $.getJSON(data_links, + +document.addEventListener("DOMContentLoaded", function () { + fetch(data_links) + .then( response => response.json()) + .then( function (data) { - var mysource = $('#links-template').html(); + var mysource = document.getElementById("links-template").innerHTML; var mytemplate = Handlebars.compile(mysource); var myresult = mytemplate(data) - $('#links').html(myresult); - }); + document.getElementById("links").innerHTML = myresult; + }); }); var data_apps = "apps.json"; - -$(document).ready(function(){ - $.getJSON(data_apps, + +document.addEventListener("DOMContentLoaded", function () { + fetch(data_apps) + .then( response => response.json()) + .then( function (data) { - var mysource = $('#apps-template').html(); + var mysource = document.getElementById("apps-template").innerHTML; var mytemplate = Handlebars.compile(mysource); var myresult = mytemplate(data) - $('#apps').html(myresult); - }); + document.getElementById("apps").innerHTML = myresult; + }); }); var data_providers = "providers.json"; - -$(document).ready(function(){ - $.getJSON(data_providers, + +document.addEventListener("DOMContentLoaded", function () { + fetch(data_providers) + .then( response => response.json()) + .then( function (data) { - var mysource = $('#providers-template').html(); + var mysource = document.getElementById("providers-template").innerHTML; var mytemplate = Handlebars.compile(mysource); var myresult = mytemplate(data) - $('#providers').html(myresult); - }); + document.getElementById("providers").innerHTML = myresult; + }); }); \ No newline at end of file diff --git a/index.html b/index.html index bfb8568..e1a1499 100755 --- a/index.html +++ b/index.html @@ -7,7 +7,6 @@ -