Skip to content

Commit

Permalink
Make subreddit name clickable, fix #90
Browse files Browse the repository at this point in the history
  • Loading branch information
OctoNezd committed Jan 5, 2024
1 parent 04d3d56 commit 32daae7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/header/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ async function createHeader() {
header.querySelector(".sr-info")?.addEventListener("click", () => {
window.scrollTo(0,0)
})
if (pageName !== null) {
header.querySelector<HTMLParagraphElement>(".subreddit-name")?.addEventListener("click", () => {
location.pathname = `/r/${pageName.innerText}`
})
}
let prevScrollPos = window.scrollY;
let headerTop = 0;
function onScroll() {
Expand Down

0 comments on commit 32daae7

Please sign in to comment.