import { celebrations } from "../config.js"; export function switcher(obj) { let items = ``; switch(obj.name) { case "download": items = obj.items; break; default: for (let i = 0; i < obj.items.length; i++) { let classes = obj.items[i]["classes"] ? obj.items[i]["classes"] : [] items += `` } break; } return `
${obj.subtitle ? `
${obj.subtitle}
` : ``}
${items}
${obj.explanation ? `
${obj.explanation}
` : ``}
` } export function checkbox(action, text, aria, paddingType) { let paddingClass = ` ` switch (paddingType) { case 1: paddingClass += "bottom-margin" break; case 2: paddingClass += "top-margin" break; case 3: paddingClass += "no-margin" break; } return `` } export function popup(obj) { let classes = obj.classes ? obj.classes : [] let body = obj.body; if (Array.isArray(obj.body)) { body = `` for (let i = 0; i < obj.body.length; i++) { if (obj.body[i]["text"].length > 0) { classes = obj.body[i]["classes"] ? obj.body[i]["classes"] : [] if (i !== obj.body.length - 1 && !obj.body[i]["nopadding"]) { classes.push("desc-padding") } body += obj.body[i]["raw"] ? obj.body[i]["text"] : `` } } } return ` ${obj.standalone ? `` : ''}` } export function multiPagePopup(obj) { let tabs = `` let tabContent = `` for (let i = 0; i < obj.tabs.length; i++) { tabs += `` tabContent += `` } tabs += `` return ` ` } export function popupWithBottomButtons(obj) { let tabs = `` for (let i = 0; i < obj.buttons.length; i++) { tabs += obj.buttons[i] } tabs += `` return ` ` } export function backdropLink(link, text) { return `${text}` } export function settingsCategory(obj) { return `
${obj.title ? obj.title : obj.name}
${obj.body}
` } export function footerButtons(obj) { let items = `` for (let i = 0; i < obj.length; i++) { switch (obj[i]["type"]) { case "toggle": items += ``; break; case "action": items += ``; break; case "popup": items += ``; i++; break; } } return ` ` } export function celebrationsEmoji() { let n = new Date().toISOString().split('T')[0].split('-'); let dm = `${n[1]}-${n[2]}`; return Object.keys(celebrations).includes(dm) ? celebrations[dm] : "🐲"; }