tarot/script.js

140 lines
3.5 KiB
JavaScript
Raw Permalink Normal View History

function major() {
const div_major = document.getElementById('major');
const majors = [
"shut",
"mag",
"zhrica",
"imperatrica",
"imperator",
"ierofant",
"vlyublennye",
"kolesnica",
"spravedlivost",
"otshelnik",
"koleso-fortuny",
"sila",
"poveshennyi",
"smert",
"umerennost",
"diavol",
"bashnya",
"zvezda",
"luna",
"solnce",
"sud",
"mir"
];
const majors_translated = [
"Шут",
"Маг",
"Жрица",
"Императрица",
"Император",
"Иерофант",
"Влюбленные",
"Колесница",
"Справедливость",
"Отшельник",
"Колесо Фортуны",
"Сила",
"Повешенный",
"Смерть",
"Умеренность",
"Дьявол",
"Башня",
"Звезда",
"Луна",
"Солнце",
"Суд",
"Мир"
];
roman_numerals = [
"0", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X",
"XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX", "XXI"
];
for (let i = 0; i < 22; i++) {
const container = document.createElement('div');
const link = document.createElement('a');
const roman = document.createElement('span');
const name = document.createElement('span');
link.href = `./explanations/${majors[i]}.html`;
link.classList.add('card-link');
roman.textContent = roman_numerals[i].padEnd(7, ' ');
roman.classList.add('monospace');
name.textContent = majors_translated[i];
link.appendChild(roman);
link.appendChild(name);
container.appendChild(link);
div_major.appendChild(container);
}
}
function minor() {
const div_minor = document.getElementById('minor');
const minor_numbers = [
"tuz", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"pazh", "rytsar", "koroleva", "korol"
];
const minor_translated = [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"Паж",
"Рыцарь",
"Королева",
"Король"
];
const minor_suits = [
"zhezlov", "kubkov", "metchey", "monet"
];
const minor_suits_translated = [
"Жезлов",
"Кубков",
"Мечей",
"Монет"
];
for (let suit = 0; suit < 4; suit++) {
div_minor.appendChild(document.createElement('hr'));
for (let number = 0; number < 14; number++) {
const container = document.createElement('div');
const link = document.createElement('a');
link.href = `./explanations/${minor_numbers[number]}-${minor_suits[suit]}.html`;
link.textContent = `${minor_translated[number]} ${minor_suits_translated[suit]}`;
link.classList.add('card-link');
container.appendChild(link);
div_minor.appendChild(container);
}
}
}
if (window.location.pathname.endsWith('index.html')) {
document.addEventListener('DOMContentLoaded', major);
document.addEventListener('DOMContentLoaded', minor);
}
if (window.location.pathname.match(/explanations/)) {
}