/*! * Hugo Theme Stack * * @author: Jimmy Cai * @website: https://jimmycai.com * @link: https://github.com/CaiJimmy/hugo-theme-stack */ import StackCodeBlock from "ts/codeblock"; import menu from 'ts/menu'; import createElement from 'ts/createElement'; import StackColorScheme from 'ts/colorScheme'; import { setupScrollspy } from 'ts/scrollspy'; import { setupSmoothAnchors } from "ts/smoothAnchors"; let Stack = { init: () => { /** * Bind menu event */ menu(); const articleContent = document.querySelector('.article-content') as HTMLElement; if (articleContent) { setupSmoothAnchors(); setupScrollspy(); } new StackColorScheme(document.getElementById('dark-mode-toggle')); StackCodeBlock(); } } window.addEventListener('load', () => { setTimeout(function () { Stack.init(); }, 0); }) declare global { interface Window { createElement: any; Stack: any } } window.Stack = Stack; window.createElement = createElement;