Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import Singleton from '../abstracts/Singleton';
|
|
|
|
/**
|
|
* Embeds the "extras" stylesheet into the page, if it is not loaded through the theme.
|
|
*
|
|
* @copyright 2021 Winter.
|
|
* @author Ben Thomson <git@alfreido.com>
|
|
*/
|
|
export default class StylesheetLoader extends Singleton {
|
|
/**
|
|
* Defines listeners.
|
|
*
|
|
* @returns {Object}
|
|
*/
|
|
listens() {
|
|
return {
|
|
ready: 'ready',
|
|
};
|
|
}
|
|
|
|
ready() {
|
|
let stylesLoaded = false;
|
|
|
|
// Determine if stylesheet is already loaded
|
|
document.querySelectorAll('link[rel="stylesheet"]').forEach((css) => {
|
|
if (css.href.endsWith('/modules/system/assets/css/snowboard.extras.css')) {
|
|
stylesLoaded = true;
|
|
}
|
|
});
|
|
|
|
if (!stylesLoaded) {
|
|
const stylesheet = document.createElement('link');
|
|
stylesheet.setAttribute('rel', 'stylesheet');
|
|
stylesheet.setAttribute('href', this.snowboard.url().asset('/modules/system/assets/css/snowboard.extras.css'));
|
|
document.head.appendChild(stylesheet);
|
|
}
|
|
}
|
|
}
|