function energy(_str, energyType, _offset, _s) {
	return `<img class="ptcg-energy-icon" src="/ptcg/${energyType}.svg" alt="${energyType}"/>`
}

function init() {
	const regex = /\[(C|D|F|G|L|M|N|P|R|W)\]/g;
	const elements = Array();

	const decks = document.querySelectorAll('.ptcg-deck');
	decks.forEach(deck => {
		const titles = deck.querySelectorAll('.ptcg-label');
		elements.push(...titles);

		const names = deck.querySelectorAll('.name');
		elements.push(...names);

		const abilityEffects = deck.querySelectorAll('.ability-effect')
		elements.push(...abilityEffects);

		const attackCosts = deck.querySelectorAll('.attack-cost')
		elements.push(...attackCosts);

		const effects = deck.querySelectorAll('.effect')
		elements.push(...effects);
	});

	const cards = document.querySelectorAll('.ptcg-card');
	cards.forEach(card => {
		const names = card.querySelectorAll('.name');
		elements.push(...names);

		const abilityEffects = card.querySelectorAll('.ability-effect')
		elements.push(...abilityEffects);

		const attackCosts = card.querySelectorAll('.attack-cost')
		elements.push(...attackCosts);

		const effects = card.querySelectorAll('.effect')
		elements.push(...effects);
	});
	elements.forEach(element => {
		element.innerHTML = element.innerHTML.replace(regex, energy);
	});
}

init();

