2022-05-03 20:50:57 +02:00
|
|
|
import Events from '../_events'
|
2021-08-09 18:04:09 +02:00
|
|
|
|
2023-08-07 18:59:32 +02:00
|
|
|
const LayoutUI = ((window) => {
|
2022-05-03 20:50:57 +02:00
|
|
|
const NAME = '_layout'
|
2021-08-09 18:04:09 +02:00
|
|
|
|
2022-05-03 21:44:33 +02:00
|
|
|
const initFonts = () => {
|
|
|
|
console.log(`${NAME}: initFonts`)
|
2021-08-09 18:04:09 +02:00
|
|
|
|
2023-08-07 18:59:32 +02:00
|
|
|
const css = document.createElement('link')
|
2022-05-03 20:50:57 +02:00
|
|
|
css.rel = 'stylesheet'
|
|
|
|
css.type = 'text/css'
|
|
|
|
css.media = 'all'
|
2021-08-18 20:51:15 +02:00
|
|
|
css.href =
|
2022-05-03 20:50:57 +02:00
|
|
|
'https://fonts.googleapis.com/css?family=Roboto:ital,wght@0,400;0,700;1,400&display=swap'
|
2023-08-07 18:59:32 +02:00
|
|
|
document.getElementsByTagName('head')[0].appendChild(css)
|
2022-05-03 20:50:57 +02:00
|
|
|
}
|
2021-08-09 18:04:09 +02:00
|
|
|
|
2022-05-03 21:44:33 +02:00
|
|
|
const initAnalytics = () => {
|
|
|
|
console.log(`${NAME}: initAnalytics`)
|
2022-05-03 20:50:57 +02:00
|
|
|
/* google analytics */
|
|
|
|
/* (function(i, s, o, g, r, a, m) {
|
2021-08-09 18:04:09 +02:00
|
|
|
i['GoogleAnalyticsObject'] = r;
|
|
|
|
(i[r] =
|
|
|
|
i[r] ||
|
|
|
|
function() {
|
|
|
|
(i[r].q = i[r].q || []).push(arguments);
|
|
|
|
}),
|
|
|
|
(i[r].l = 1 * new Date());
|
|
|
|
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
|
|
|
|
a.async = 1;
|
|
|
|
a.src = g;
|
|
|
|
m.parentNode.insertBefore(a, m);
|
|
|
|
})(
|
|
|
|
window,
|
|
|
|
document,
|
|
|
|
'script',
|
|
|
|
'//www.google-analytics.com/analytics.js',
|
|
|
|
'ga',
|
|
|
|
);
|
|
|
|
ga('create', 'UA-********-*', 'auto');
|
2022-05-03 20:50:57 +02:00
|
|
|
ga('send', 'pageview'); */
|
|
|
|
}
|
2021-08-09 18:04:09 +02:00
|
|
|
|
2023-08-07 18:59:32 +02:00
|
|
|
// set attributes for mobile friendly tables
|
|
|
|
const initMobileTables = () => {
|
|
|
|
document.querySelectorAll('.typography table').forEach((el) => {
|
|
|
|
const header = el.querySelector('thead tr:first-child')
|
|
|
|
if (!header) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
header.classList.add('d-typography-breakpoint-none')
|
|
|
|
|
|
|
|
header.querySelectorAll('td').forEach((h) => {
|
|
|
|
el.querySelectorAll(`td:eq(${i})`)
|
2023-10-10 20:04:16 +02:00
|
|
|
.forEach((el) => {
|
|
|
|
if (!el.dataset.label) {
|
|
|
|
el.dataset.label = h.innerText
|
|
|
|
}
|
|
|
|
});
|
2023-08-07 18:59:32 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener(`${Events.LOADED}`, () => {
|
2022-05-03 21:44:33 +02:00
|
|
|
initFonts()
|
|
|
|
initAnalytics()
|
2023-08-07 18:59:32 +02:00
|
|
|
initMobileTables()
|
2022-05-03 20:50:57 +02:00
|
|
|
})
|
|
|
|
})(window)
|
|
|
|
export default LayoutUI
|