wowchemy-init.js 860 B

1234567891011121314151617181920212223242526272829303132
  1. /*************************************************
  2. * Wowchemy
  3. * https://github.com/wowchemy/wowchemy-hugo-themes
  4. *
  5. * Wowchemy Initialization
  6. **************************************************/
  7. import {initThemeVariation} from './wowchemy-theming';
  8. import {wcDarkLightEnabled, wcIsSiteThemeDark} from '@params';
  9. window.wc = {
  10. darkLightEnabled: wcDarkLightEnabled,
  11. isSiteThemeDark: wcIsSiteThemeDark,
  12. };
  13. // CMS authentication
  14. if (window.netlifyIdentity) {
  15. window.netlifyIdentity.on('init', (user) => {
  16. if (!user) {
  17. window.netlifyIdentity.on('login', () => {
  18. document.location.href = '/admin/';
  19. });
  20. }
  21. });
  22. }
  23. // Initialize theme variation and set body theme class.
  24. initThemeVariation();
  25. // For Plotly compatibility with MathJax (must appear prior to loading Plotly).
  26. window.PlotlyConfig = {MathJaxConfig: 'local'};