mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-07 06:14:00 +00:00
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
33 lines
861 B
JavaScript
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'};
|