diff --git a/src/js/print/cut.ts b/src/js/print/cut.ts new file mode 100644 index 00000000..30ce1637 --- /dev/null +++ b/src/js/print/cut.ts @@ -0,0 +1,18 @@ +const Selector = { + CUT_ROOT: '.yfm details.yfm-cut', +}; + +function openCuts() { + document.querySelectorAll(Selector.CUT_ROOT).forEach((element) => { + element.setAttribute('open', 'true'); + element.classList.add('open'); + }); +} + +if (typeof document !== 'undefined') { + window.addEventListener('load', () => { + openCuts(); + }); +} + +export {}; diff --git a/src/js/print/index.ts b/src/js/print/index.ts index 5d6838d9..3295ecf5 100644 --- a/src/js/print/index.ts +++ b/src/js/print/index.ts @@ -1 +1,2 @@ import './table'; +import './cut';