Skip to content

Instantly share code, notes, and snippets.

@JakeChampion
Last active September 6, 2021 13:48
Show Gist options
  • Save JakeChampion/93e792195594db1270d4dea73e787dfa to your computer and use it in GitHub Desktop.
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
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