Prevent Notion from opening two windows with one click

Not sure if it's my own problem or if it's a bug in Notion, in Board view mode if any URL properties are displayed and clicking on them opens two pages with the same address in the browser.

  1. // ==UserScript==
  2. // @name Prevent Notion from opening two windows with one click
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Not sure if it's my own problem or if it's a bug in Notion, in Board view mode if any URL properties are displayed and clicking on them opens two pages with the same address in the browser.
  6. // @author Dylan
  7. // @match https://www.notion.so/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=www.notion.so
  9. // @grant none
  10. // @license GNU GPLv3
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. let lastSeconds = -1;
  16. let lastTargets = []
  17.  
  18. document.addEventListener('click', function(event) {
  19. if (event.target.tagName == 'A' && "href" in event.target.attributes) {
  20. let href = event.target.attributes.href.value;
  21. let seconds = new Date().getSeconds();
  22.  
  23. if (seconds == lastSeconds) {
  24. if (lastTargets.includes(href)) {
  25. event.preventDefault();
  26. event.stopPropagation();
  27. } else {
  28. lastTargets.push(href);
  29. }
  30. } else {
  31. lastSeconds = seconds;
  32.  
  33. if (event.target.tagName == 'A') {
  34. lastTargets = [href]
  35. }
  36. }
  37. }
  38.  
  39. }, true);
  40. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址