-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddIcons.js
30 lines (27 loc) · 1.14 KB
/
addIcons.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
document.addEventListener('DOMContentLoaded', function () {
// Define the base URL for fetching the icons
const baseURL = 'https://raw.githubusercontent.com/skunkworksza/www/dc3276070f277756eceb712d3027dd8ba85ecccb/assets/icons/';
// Define the icons to be used and their corresponding classes or ids
const icons = {
'accelerated-computing.svg': 'icon-computing',
'ai--transparency.svg': 'icon-ai',
'analyze.svg': 'icon-analyze',
'blockchain.svg': 'icon-blockchain',
// Add more mappings here as needed
};
// Function to add icons to the page
function addIcons() {
for (const [filename, className] of Object.entries(icons)) {
const elements = document.querySelectorAll(`.${className}`);
elements.forEach(element => {
const img = document.createElement('img');
img.src = `${baseURL}${filename}`;
img.alt = className;
img.classList.add('icon');
element.appendChild(img);
});
}
}
// Call the function to add icons
addIcons();
});