diff --git a/src/assets/js/script.js b/src/assets/js/script.js index fc89281..10c662d 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -14,12 +14,11 @@ class DocsPress { self.$singleAjax = document.querySelector('.docspress-single-ajax'); - self.initSearch(); - self.initDocSearch(); - self.initAnchors(); - self.initFeedbacks(); - self.initSidebarScroll(); - self.initAjax(); + self.initEarlier(); + + on(document, 'ready', () => { + self.init(); + }); } // eslint-disable-next-line class-methods-use-this @@ -27,6 +26,18 @@ class DocsPress { return href.replace(/#.*/, ''); } + initEarlier() { + this.initSidebarScroll(); + } + + init() { + this.initSearch(); + this.initDocSearch(); + this.initAnchors(); + this.initFeedbacks(); + this.initAjax(); + } + initSearch() { const self = this; let timeout = false; @@ -502,7 +513,5 @@ class DocsPress { } } -on(document, 'ready', () => { - // eslint-disable-next-line no-new - new DocsPress(); -}); +// eslint-disable-next-line no-new +new DocsPress();