mirror of
https://github.com/vale981/tridactyl
synced 2025-03-04 17:11:40 -05:00
WIP: make back button work
Command line is very broken. Generally thinking this might be a bad idea because it feels like it would be fragile, needing updating every time we add something to Tridactyl
This commit is contained in:
parent
02e11b321e
commit
569b01a607
1 changed files with 13 additions and 0 deletions
|
@ -5991,6 +5991,10 @@ import { Readability } from "@mozilla/readability"
|
|||
|
||||
//#content
|
||||
export async function reader2() {
|
||||
// Store old doc for restoration
|
||||
const old_doc = document.documentElement.innerHTML
|
||||
const cmdline = document.getElementById("cmdline_iframe")
|
||||
|
||||
document.querySelectorAll(".TridactylStatusIndicator").forEach(ind => ind.parentNode.removeChild(ind))
|
||||
const article = new Readability(document).parse()
|
||||
document.body.innerHTML = article.content
|
||||
|
@ -6021,6 +6025,15 @@ export async function reader2() {
|
|||
}
|
||||
document.body.insertBefore(header, document.body.firstChild)
|
||||
}
|
||||
|
||||
window.history.pushState(null, null)
|
||||
|
||||
const old_pop = window.onpopstate
|
||||
window.onpopstate = () => {
|
||||
document.documentElement.innerHTML = old_doc
|
||||
document.documentElement.appendChild(cmdline)
|
||||
window.onpopstate = old_pop
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue