vimfx.listen("goWayBack", async (_, msg) => { try { let eUrl = encodeURIComponent(content.location) let aUrl = `https://archive.org/wayback/available?url=${eUrl}&closest=either&status_code=200` let res = await content.fetch(aUrl) if (!res.ok) return msg("Network error; failed to time travel") let json = await res.json() let nUrl = json?.archived_snapshots?.closest?.url if (nUrl) content.location = nUrl else msg("No URLs to travel to") } catch { msg("Failed to time travel") } }) vimfx.listen("goWayForward", (_, msg) => { content.location.href = content.location.href .replace(new RegExp("^.+://web.archive.org/web/[0-9*]+/"), "") }) vimfx.listen("location.replace", (url, msg) => { content.location.replace(url) })