Notion Navigation Fixer

Allow browser nav options like back forward pgup pgdown

当前为 2019-06-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Notion Navigation Fixer
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Allow browser nav options like back forward pgup pgdown
  6. // @author Andreas Huttenrauch
  7. // @match *://www.notion.so/*
  8. // @run-at document-end
  9. // ==/UserScript==
  10.  
  11. console.log("fixing nav");
  12.  
  13. document.addEventListener('mousedown', function(e) {
  14. console.log(e);
  15. if ( (e.buttons & 8) == 8 ) {
  16. e.stopImmediatePropagation();
  17. e.preventDefault();
  18. window.history.back();
  19. }
  20. if ( (e.buttons & 16) == 16 ) {
  21. e.stopImmediatePropagation();
  22. e.preventDefault();
  23. window.history.forward();
  24. }
  25. });
  26.  
  27. document.addEventListener('keydown', function(e) {
  28. console.log(e);
  29. /*
  30. if ( e.target.contentEditable ) {
  31. console.log("not moving because you are editing something important");
  32. return;
  33. }
  34. */
  35. var mainDiv = document.querySelector(".notion-frame .notion-scroller");
  36. if ( mainDiv == "undefined" ) return;
  37. var scrollAmt = parseInt(window.innerHeight*0.8);
  38. if ( e.keyCode == 34 && e.shiftKey == false && e.ctrlKey == false ) {
  39. e.stopImmediatePropagation();
  40. e.preventDefault();
  41. mainDiv.scrollBy(0, scrollAmt);
  42. }
  43. if ( e.keyCode == 33 && e.shiftKey == false && e.ctrlKey == false ) {
  44. e.stopImmediatePropagation();
  45. e.preventDefault();
  46. mainDiv.scrollBy(0, -scrollAmt);
  47. }
  48. });
  49.  
  50.  
  51.  

QingJ © 2025

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