任何网站双击shift回到页面顶部

叮~

  1. // ==UserScript==
  2. // @name 任何网站双击shift回到页面顶部
  3. // @namespace ding
  4. // @version 0.1
  5. // @description 叮~
  6. // @author jackpapapapa
  7. // @include *
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=mozilla.org
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. ;(function () {
  13. let start = 0
  14. let end = 0
  15. let count = 0
  16. document.addEventListener("keydown", (e) => {
  17. if (e.shiftKey) {
  18. if (count === 0) start = new Date().getTime()
  19. count++
  20. }
  21. if (count === 2) {
  22. end = new Date().getTime()
  23. if (end - start <= 600) {
  24. document.scrollingElement.scrollTop = 0
  25. }
  26. count = 0
  27. }
  28. })
  29. })()

QingJ © 2025

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