var MENU = [ { type: "parent", title: "soumettre mes cas", url: "", childrens: [ { title: "CAD CAM", url: "https://my.etk.dental", lang: ["fr"] }, { title: "guides", url: "https://cloud.lyraguide.dental", lang: ["fr"] }, { title: "gouttières", url: "https://cloud.lyralign.dental", lang: ["fr"] }, ], lang: ["fr"] }, { type: "parent", title: "suivre mon contrat", url: "", childrens: [ { title: "Mes consommables", url: "https://cloud.lyraplace.dental", lang: ["fr"] } ], lang: ["fr"] }, { type: "single", title: "médiathèque", url: "https://mediatheque.lyra.dental", lang: ["fr"] }, { type: "single", title: "médiathèque", url: "https://mediatheque.lyra.dental/en", lang: ["en"] }, { type: "single", title: "médiathèque", url: "https://mediatheque.lyra.dental/es", lang: ["es"] }, { type: "single", title: "médiathèque", url: "https://mediatheque.lyra.dental/it", lang: ["it"] }, { type: "single", title: "shop", class: "shop-basket", url: "https://lyrashop.dental", lang: ["fr", "en", "it", "es"] } ]; var dic = [ { "label": "soumettre mes cas", "fr": "soumettre mes cas", "en": "submit my cases", "es": "presentar mis casos", "it": "invia i miei casi" }, { "label": "prothèses", "fr": "CAD CAM", "en": "CAD CAM", "es": "CAD CAM", "it": "CAD CAM" }, { "label": "guides", "fr": "guides", "en": "guides", "es": "guías", "it": "guide" }, { "label": "gouttières", "fr": "gouttières", "en": "gutters", "es": "bandejas", "it": "portaimpronte" }, { "label": "suivre mon contrat", "fr": "suivre mon contrat", "en": "follow my contract", "es": "seguir mi contrato", "it": "segui il mio contratto" }, { "label": "mes consommables", "fr": "mes consommables", "en": "my consumables", "es": "mis consumibles", "it": "miei materiali di consumo" }, { "label": "médiathèque", "fr": "médiathèque", "en": "media library", "es": "mediateca", "it": "mediateca" }, { "label": "CONNEXION", "fr": "CONNEXION", "en": "CONNECTION", "es": "CONECTAR", "it": "CONNECT" } ]; function getBannerHTML(options = {}) { let lang = options.lang || 'fr'; if (!['fr', 'en', 'es', 'it'].includes(lang)) { lang = 'fr'; } let logoURL = options.logoURL || `https://cloud.mylyra.dental/` ; const t = (word) => { const item = dic.find(e => e.label === word); let w = word; if (item) w = item[lang]; return `${w.slice(0, 1).toUpperCase()}${w.slice(1)}`; } return `
`; } function getBannerMobileHTML(options = {}) { let lang = options.lang || 'fr'; if (!['fr', 'en', 'es', 'it'].includes(lang)) { lang = 'fr'; } const t = (word) => { const item = dic.find(e => e.label === word); let w = word; if (item) w = item[lang]; return `${w.slice(0, 1).toUpperCase()}${w.slice(1)}`; } return MenuMobile(MENU, t, lang); } const MenuChildren = (item, t, lang = 'fr') => { if (!item.lang.includes(lang)) return ''; return `${t(item.title)}`; } const MenuSingle = (item, t, lang = 'fr') => { if (!item.lang.includes(lang)) return ''; return `${t(item.title)}`; } const MenuParent = (item, t, lang = 'fr') => { if (!item.lang.includes(lang)) return ''; return ` ` } const Menu = (menu, t, lang) => { return menu.map((item) => { if (item.type === "parent") return MenuParent(item, t, lang); if (item.type === "single") return MenuSingle(item, t, lang); return ''; }).join(''); } const MenuChildrenMobile = (item, t, lang = 'fr') => { if (!item.lang.includes(lang)) return ''; return `