From f2388f1afbe8b0323f9185c3f1229c8d8890b211 Mon Sep 17 00:00:00 2001 From: Jonas Leder Date: Mon, 12 Apr 2021 18:29:11 +0200 Subject: [PATCH] moved svgs in extra files and load them with a custom element --- js/script.js | 3 ++- js/svgLoader.js | 17 ++++++++++++++ public/img/svg/3d_model.svg | 3 +++ public/img/svg/instagram.svg | 8 +++++++ public/img/svg/matrix.svg | 3 +++ public/img/svg/paypal.svg | 3 +++ public/img/svg/twitter.svg | 14 ++++++++++++ public/internal/footer.php | 44 ++++++++---------------------------- 8 files changed, 59 insertions(+), 36 deletions(-) create mode 100644 js/svgLoader.js create mode 100644 public/img/svg/3d_model.svg create mode 100644 public/img/svg/instagram.svg create mode 100644 public/img/svg/matrix.svg create mode 100644 public/img/svg/paypal.svg create mode 100644 public/img/svg/twitter.svg diff --git a/js/script.js b/js/script.js index 7ca5a4a..6e71853 100644 --- a/js/script.js +++ b/js/script.js @@ -4,4 +4,5 @@ require("./error"); require("./imgPreview"); require("./includeHTML"); require("./ntpGraph"); -require("./ntpMenu"); \ No newline at end of file +require("./ntpMenu"); +require("./svgLoader"); \ No newline at end of file diff --git a/js/svgLoader.js b/js/svgLoader.js new file mode 100644 index 0000000..6f28da8 --- /dev/null +++ b/js/svgLoader.js @@ -0,0 +1,17 @@ +class svgLoad extends HTMLElement { + constructor(){ + super(); + let svgName = this.getAttribute("data-name"); + let xhr = new XMLHttpRequest(); + xhr.onreadystatechange = () => { + if(xhr.readyState === 4 && xhr.status === 200){ + this.innerHTML = xhr.responseText; + } + } + + xhr.open("GET", "/img/svg/" + svgName + ".svg"); + xhr.send(); + } +} + +customElements.define("jl-svg", svgLoad); \ No newline at end of file diff --git a/public/img/svg/3d_model.svg b/public/img/svg/3d_model.svg new file mode 100644 index 0000000..e41292a --- /dev/null +++ b/public/img/svg/3d_model.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/img/svg/instagram.svg b/public/img/svg/instagram.svg new file mode 100644 index 0000000..fb61b86 --- /dev/null +++ b/public/img/svg/instagram.svg @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/public/img/svg/matrix.svg b/public/img/svg/matrix.svg new file mode 100644 index 0000000..bb40b00 --- /dev/null +++ b/public/img/svg/matrix.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/img/svg/paypal.svg b/public/img/svg/paypal.svg new file mode 100644 index 0000000..d384178 --- /dev/null +++ b/public/img/svg/paypal.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/img/svg/twitter.svg b/public/img/svg/twitter.svg new file mode 100644 index 0000000..7dcc5a8 --- /dev/null +++ b/public/img/svg/twitter.svg @@ -0,0 +1,14 @@ + + + \ No newline at end of file diff --git a/public/internal/footer.php b/public/internal/footer.php index 6943e29..173d808 100644 --- a/public/internal/footer.php +++ b/public/internal/footer.php @@ -34,49 +34,23 @@ function getFooter(){

- - - - - - + + - - - - - + + + - - - - + + - - - + - - - +