mirror of
https://github.com/aljazceru/pear-docs.git
synced 2025-12-17 14:34:19 +01:00
sys status start
This commit is contained in:
@@ -43,7 +43,11 @@ customElements.define('docs-viewer', class extends HTMLElement {
|
||||
|
||||
this.panel = this.root.querySelector('#panel')
|
||||
|
||||
this.page = 'readme.md'
|
||||
this.home = document.querySelector('#home')
|
||||
|
||||
this.page = '/readme.md'
|
||||
|
||||
this.home.style.display = 'none'
|
||||
|
||||
const observer = new MutationObserver(() => {
|
||||
if (document.documentElement.classList.contains('light')) this.panel.classList.add('light')
|
||||
@@ -61,6 +65,11 @@ customElements.define('docs-viewer', class extends HTMLElement {
|
||||
this.load(evt.target.pathname)
|
||||
})
|
||||
|
||||
window.addEventListener('hashchange', () => {
|
||||
if (location.hash === '#documentation' && this.page === '/readme.md') this.home.style.display = 'none'
|
||||
else this.home.style.display = ''
|
||||
})
|
||||
|
||||
window.addEventListener('popstate', (evt) => {
|
||||
if (location.hash.startsWith('#documentation')) {
|
||||
const home = location.hash.endsWith('-home')
|
||||
@@ -99,5 +108,7 @@ customElements.define('docs-viewer', class extends HTMLElement {
|
||||
|
||||
async #load () {
|
||||
this.panel.querySelector('slot').innerHTML = marked.parse(await (await fetch(this.page)).text(), {headerIds: false, mangle: false})
|
||||
if (location.hash === '#documentation' && this.page === '/readme.md') this.home.style.display = 'none'
|
||||
else this.home.style.display = ''
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user