From d7dbe7fee362d587dfc334135d9581b6216a4295 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 23 Nov 2025 04:13:56 +0000
Subject: [PATCH] =Timeline block, and feed block updated. DataStore.js refactored to not block rendering

---
 assets/js/dash/UtilityFunctions.js |   35 +++++++++++++++++------------------
 1 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/assets/js/dash/UtilityFunctions.js b/assets/js/dash/UtilityFunctions.js
index 23f0737..596d6f4 100644
--- a/assets/js/dash/UtilityFunctions.js
+++ b/assets/js/dash/UtilityFunctions.js
@@ -127,7 +127,7 @@
  */
 window.getTemplate = function (template){
 	if (window.templates.size === 0) {
-		loadTemplates();
+		window.loadTemplates();
 	}
 	if(window.templates.has(template)){
 		return window.templates.get(template).cloneNode(true);
@@ -189,29 +189,25 @@
  * @param icon
  * @returns {Node | ActiveX.IXMLDOMNode}
  */
-window.icon = document.querySelector('.icon').cloneNode(true);
-window.icon.className = 'icon';
-window.getIcon = function getIcon(icon){
+window.icon = null;
+window.getIcon = function getIcon(icon, style = ''){
 	if (typeof icon === 'undefined') {
 		return '';
 	}
-	console.log('Getting icon: '+icon);
 
+	if (!window.icon) {
+		window.icon = document.createElement('i');
+		window.icon.className = 'icon';
+		window.icon.ariaHidden = true;
+	}
 	let theIcon = window.icon.cloneNode(true);
-	theIcon.classList.add('icon-'+icon);
+	if (style !== '' && ['regular', 'bold', 'duotone', 'fill', 'light', 'thin' ].includes('style')) {
+		style = `-${style.slice(0, 2)}`;
+	} else {
+		style = '';
+	}
+	theIcon.classList.add(`icon-${icon}${style}`);
 	return theIcon;
-
-
-	if(!window.jvbIcons){
-		window.jvbIcons = new Map();
-	}
-	if(!window.jvbIcons.has(icon) && jvbSettings.icons[icon]){
-		let temp = document.createElement('div');
-		temp.innerHTML = jvbSettings.icons[icon];
-		window.jvbIcons.set(icon, temp.firstElementChild.cloneNode(true));
-		temp.remove();
-	}
-	return window.jvbIcons.get(icon)?.cloneNode(true);
 }
 
 /**
@@ -535,6 +531,9 @@
 }
 
 window.targetCheck = function (e, selector) {
+	if (Array.isArray(selector)) {
+		selector = selector.join(',');
+	}
 	if (typeof selector !== 'string') {
 		return false;
 	}

--
Gitblit v1.10.0