From 52b768452217264386ab76eb37c4d121dea9c0ee Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Mon, 23 Jan 2023 16:16:24 +0000
Subject: [PATCH] refactor script
---
assets/js/functions.js | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/assets/js/functions.js b/assets/js/functions.js
index 43acbb9..ae849b5 100644
--- a/assets/js/functions.js
+++ b/assets/js/functions.js
@@ -17,8 +17,7 @@
}
function elems(selector, parent = document) {
- let elems = isObj(parent) ? parent.querySelectorAll(selector) : [];
- return elems.length ? elems : false;
+ return isObj(parent) ? parent.querySelectorAll(selector) : [];
}
function pushClass(el, targetClass) {
@@ -174,13 +173,13 @@
}
function loadSvg(file, parent, path = iconsPath) {
- const link = new URL(`${path}${file}.svg`, rootURL).href;
+ const link = new URL(`${path}${file}.svg`, root_url).href;
fetch(link)
.then((response) => {
return response.text();
})
- .then((data) => {
- parent.innerHTML = data;
+ .then((svg_data) => {
+ parent.innerHTML = svg_data;
});
}
--
Gitblit v1.10.0