diff options
Diffstat (limited to 'assets/js/main.js')
| -rw-r--r-- | assets/js/main.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/assets/js/main.js b/assets/js/main.js index 6cb2ad6..a0c714b 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -80,19 +80,20 @@ const getBlog = async (x) => { }) .then(response => response.text()) .then(text => { - main.body.innerHTML = DOMPurify.sanitize(text) - eventListener() - prism('https://fatalmatrix.xyz/js/prism.js') - window.scrollTo(0, 0) + const prism = new Promise((res, rej) => { + const script = document.createElement('script') + script.src = `${window.location.origin}/js/prism.js` + document.head.appendChild(script) + res('success') + }) + prism.then(output => { + main.body.innerHTML = DOMPurify.sanitize(text) + eventListener() + window.scrollTo(0, 0) + }) }) } -const prism = async (url) => { - const script = document.createElement('script') - script.src = url - document.head.appendChild(script) -} - const eventListener = () => { const menuList = document.getElementById('menu-list') const menuIcon = document.getElementById('menu-icon') |
