Reddit notifications dropdown

add notifications dropdown to reddit

< 腳本Reddit notifications dropdown的回應

評論:正評 - 腳本一切正常

§
發表於:2025-09-29
編輯:2025-09-29

Added a line to your 2nd-to-last function so that ctrl+click still opens links in new tabs (rather than the parent frame) like it normally would. (I could not figure out how to make shift+click open links in a new window, though)

function setupIframeLinkHandler() {
    document.addEventListener("click", (event) => {
        const targetA = event.target.closest("a[href]");
        if (targetA) {
            event.preventDefault();
            console.log(unsafeWindow.top);
            if (event.ctrlKey) {
                unsafeWindow.open(targetA.href);
            } else {
                unsafeWindow.top.navigation.navigate(targetA.href);
            }
        }
    });
}
hdyzen作者
§
發表於:2025-09-29
編輯:2025-09-29

Hey, thanks for the feedback. I understood your idea and just updated the script. Links should now open natively, meaning:

Left click = Current window
Shift + Left click = New window
Ctrl + Left click = New tab
Middle mouse = New tab

§
發表於:2025-10-03

Thanks! You're so awesome. I understand if you don't want to be bothered any more about this, but two other real minor things I noticed:

  1. Clicking outside of the popup frame should probably dismiss it, right? Currently the only way I can see to dismiss it is to click the notification icon a second time.
  2. After clicking "Mark All As Read" in the popup, is it possible to remove the unread counter on the notification icon?
hdyzen作者
§
發表於:2025-10-03

I understand if you don't want to be bothered any more about this

It's ok.

Clicking outside of the popup frame should probably dismiss it, right? Currently the only way I can see to dismiss it is to click the notification icon a second time.

Added this, it should dismiss when clicking outside the popup.

After clicking "Mark All As Read" in the popup, is it possible to remove the unread counter on the notification icon?

I added a similar behavior, natively. If you view the notifications popup, it already removes the counter in the backend. So if I added it only when clicking "Mark All As Read" and you don’t click but view the popup and reload, the counter is already gone. Therefore, the script will remove it when clicking on notifications.

Thanks for the feedback. I really appreciate the ideas.

發表回覆

登入以回覆