GGn Ignore Requests

Ignore requests

目前為 2024-02-18 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name GGn Ignore Requests
  3. // @namespace none
  4. // @version 1
  5. // @description Ignore requests
  6. // @author ingts
  7. // @match https://gazellegames.net/requests.php*
  8. // @grant GM_setValue
  9. // @grant GM_getValue
  10. // @grant GM_deleteValue
  11. // ==/UserScript==
  12. if (location.href.includes('action=view')) {
  13. const id = new URL(location.href).searchParams.get('id')
  14. let ignored = GM_getValue(id)
  15. const button = document.createElement('a')
  16. button.href = 'javascript:'
  17. button.className = 'brackets'
  18. button.textContent = ignored ? ' Unignore ' : ' Ignore '
  19. document.querySelector('div.linkbox').append(button)
  20. button.onclick = () => {
  21. if (ignored) {
  22. GM_deleteValue(id)
  23. button.textContent = ' Ignore '
  24. ignored = false
  25. } else {
  26. GM_setValue(id, 1)
  27. button.textContent = ' Unignore '
  28. ignored = true
  29. }
  30. }
  31. } else {
  32. document.querySelectorAll('#requests_list tr:not(.colhead_dark)').forEach(row => {
  33. if (GM_getValue(/\d+/.exec(row.querySelector('a').href)[0])) row.remove()
  34. })
  35. }