Hey everyone! I’m not sure I can say this is my idea because I think I got it from someone mentioning it on Adam’s livestream or maybe on IRC…
Anyways… if you see yourself, like me, constantly going back and forth between your profile page and the editor here’s some yummy spaghetti code that would be cool to add to your “Additional <head> content” (be sure to replace YOUR-ADDRESS
):
<script>
document.addEventListener('keydown', event => {
if (event.key === ".") {
if (window.location.href.slice(-4) === "/now" || window.location.href.slice(-5) === "/now/"){
window.location.assign("https://home.omg.lol/address/YOUR-ADDRESS/now");
} else {
window.location.assign("https://home.omg.lol/address/YOUR-ADDRESS/web");
}
}
});
</script>
This code redirects you to your profile/now page dashboard when someone presses the .
key on the keyboard, à là GitHub.
This snippet assumes that:
- You also want it to work for your now page.
- Your now page is at the same URL as your profile address but with
/now
or/now/
at the end (change theif
guard if your case is different). - You want the
.
key to do the job (change line 3 otherwise).
Marked this as feature-request because it would be cool if @adam implemented this behaviour in the backend .
Last note: if the visitor has Javascript off, the page would work fine but the shortcut won’t work.
Edit 2023-04-26:
Changed window.location.replace
to window.location.assign
which keeps the previous page in the browser’s history. I’m definitely not the best at Javascript .