Toggle Auto Follow

Quickly toggle the 'Keep Current Pattern Selected' preference by pressing alt + A

目前为 2023-12-02 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Toggle Auto Follow
  3. // @namespace Jummbox Scripts
  4. // @match https://ultraabox.github.io/
  5. // @match https://aurysystem.github.io/goldbox/
  6. // @match https://jummbus.bitbucket.io/
  7. // @grant none
  8. // @version 1.2
  9. // @author PlanetBluto
  10. // @description Quickly toggle the 'Keep Current Pattern Selected' preference by pressing alt + A
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. const print = console.log
  15.  
  16. var inited = false
  17.  
  18. var toggleFunc = (elem, key) => {
  19. elem.value = key
  20. elem.dispatchEvent(new Event("change"))
  21.  
  22. print(localStorage.getItem(key))
  23. }
  24.  
  25. var int = setInterval(() => {
  26. var selectElem = document.querySelector(".selectContainer.menu.preferences > select")
  27. if (selectElem) {
  28. clearInterval(int)
  29.  
  30. document.addEventListener("keydown", e => {
  31. if (e.which == 65 && e.altKey == true) {
  32. toggleFunc(selectElem, "autoFollow")
  33. }
  34. })
  35. }
  36. }, 10)