Place SVG in card definitions and load from those

This commit is contained in:
Stephen Jianu 2022-09-21 20:15:40 -05:00
commit ff787f7e64
5 changed files with 63 additions and 61 deletions

View file

@ -1,10 +1,11 @@
'use strict'
function Card (sym, value, type, name = 'Unknown') {
function Card (sym, value, type, name = 'Unknown', svg = '') {
this.symbol = sym
this.value = value
this.type = type
this.name = name
this.svg = svg
this.element = null
this.is_flipped = false
@ -26,6 +27,7 @@ function Card (sym, value, type, name = 'Unknown') {
const graphic = document.createElement('div')
graphic.className = 'graphic'
graphic.innerHTML = this.svg
face.appendChild(graphic)
// Name