Last active
September 6, 2021 13:48
-
-
Save JakeChampion/93e792195594db1270d4dea73e787dfa to your computer and use it in GitHub Desktop.
Install javascript by chee (https://addons.mozilla.org/en-US/firefox/addon/javascript/) and then visit ft.com and paste the below code into the extension -- do the same for local.ft.com and that is it. When you press `t` it will toggle the domain from ft.com to local.ft.com and vice versa
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener( | |
"keydown", | |
(event) => { | |
var name = event.key; | |
if ( | |
window.location.hostname.endsWith("ft.com") && | |
name.toLowerCase() === "t" | |
) { | |
window.location = toggleOrigin(window.location); | |
} | |
}, | |
false | |
); | |
function toggleOrigin({ hostname, pathname }) { | |
const origin = | |
hostname === "local.ft.com" | |
? "https://www.ft.com" | |
: "https://local.ft.com:5050"; | |
return new URL(origin + pathname); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment