Web Dev Solutions

Catalin Mititiuc

From 71724cc97967a876224d1a4b711843b17256cb0d Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Tue, 2 Jul 2024 15:19:17 -0700 Subject: WIP: counters --- src/modules/record_sheet.js | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'src/modules/record_sheet.js') diff --git a/src/modules/record_sheet.js b/src/modules/record_sheet.js index 092870a..0f279d5 100644 --- a/src/modules/record_sheet.js +++ b/src/modules/record_sheet.js @@ -1,17 +1,5 @@ import { Observable } from "./observable"; -// import counters from '../../public/assets/images/counters.svg'; -// console.log('counters', counters); - -// import svg from '../../public/assets/images/counters.svg'; - -// const doc = new DOMParser().parseFromString(svg, 'image/svg+xml'); -// const rifle = document.importNode(doc.querySelector('#rifle'), true); -// const smg = document.importNode(doc.querySelector('#smg'), true); - -// console.log('svg', counters); -// console.log('doc', doc); -// console.log('imported svg', rifle); -// console.log('imported svg', smg); +import counters from './assets/images/counters.svg'; const weapons = { rifle: { @@ -42,9 +30,7 @@ function createIcon(number) { icon.setAttributeNS(null, 'viewBox', '-6 -6 12 12'); icon.setAttribute('xmlns', svgns); - // use.setAttributeNS(null, 'href', `assets/images/counters.svg?v=${cacheBuster}#counter-base`); - use.setAttributeNS(null, 'href', `assets/images/counters.svg#counter-base`); - // use.setAttributeNS(null, 'href', `${counters}#counter-base`); + use.setAttributeNS(null, 'href', `./${counters}#counter-base`); text.textContent = number; @@ -68,12 +54,9 @@ function createWeaponIcon(type) { icon.setAttribute('xmlns', svgns); icon.classList.add('weapon-icon'); - // use.setAttributeNS(null, 'href', `assets/images/counters.svg?v=${cacheBuster}#${type}`); - // use.setAttributeNS(null, 'href', `${counters}#${type}`); - use.setAttributeNS(null, 'href', `assets/images/counters.svg#${type}`); + use.setAttributeNS(null, 'href', `${counters}#${type}`); icon.appendChild(use); - // icon.appendChild(document.importNode(doc.querySelector(`#${type}`), true)); return icon; } -- cgit v1.2.3