Files
HugoBlox-kit/wowchemy/assets/js/wowchemy-init.js
T
George Cushen aa1071adfc feat: support site.Params.marketing.google_optimize
Also:

- refactor Bootstrap JS out of wowchemy.js for easier maintenance
- refactor lengthy env checks to hugo.IsProduction
- refactor window.PlotlyConfig from inline JS to the init script
- no longer prevent loading GA if GTM provided, in case user wants both
2021-02-05 20:30:40 +00:00

33 lines
861 B
JavaScript

/*************************************************
* Wowchemy
* https://github.com/wowchemy/wowchemy-hugo-modules
*
* Wowchemy Initialization
**************************************************/
import {initThemeVariation} from './wowchemy-theming';
import {wcDarkLightEnabled, wcIsSiteThemeDark} from '@params';
window.wc = {
darkLightEnabled: wcDarkLightEnabled,
isSiteThemeDark: wcIsSiteThemeDark,
};
// CMS authentication
if (window.netlifyIdentity) {
window.netlifyIdentity.on('init', (user) => {
if (!user) {
window.netlifyIdentity.on('login', () => {
document.location.href = '/admin/';
});
}
});
}
// Initialize theme variation and set body theme class.
initThemeVariation();
// For Plotly compatibility with MathJax (must appear prior to loading Plotly).
window.PlotlyConfig = {MathJaxConfig: 'local'};