GGn Ignore Requests

Ignore individual requests and by user

  1. // ==UserScript==
  2. // @name GGn Ignore Requests
  3. // @namespace none
  4. // @version 2
  5. // @description Ignore individual requests and by user
  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.  
  13. if (location.href.includes('action=view')) {
  14. const id = new URL(location.href).searchParams.get('id')
  15. let ignored = GM_getValue(id)
  16. const button = document.createElement('a')
  17. button.href = 'javascript:'
  18. button.className = 'brackets'
  19. button.textContent = ignored ? ' Unignore ' : ' Ignore '
  20. document.querySelector('div.linkbox').append(button)
  21. button.onclick = () => {
  22. if (ignored) {
  23. GM_deleteValue(id)
  24. button.textContent = ' Ignore '
  25. ignored = false
  26. } else {
  27. GM_setValue(id, 1)
  28. button.textContent = ' Unignore '
  29. ignored = true
  30. }
  31. }
  32.  
  33. let users = GM_getValue('users', [])
  34. const name = document.querySelector("td > strong > a").textContent
  35. const button2 = document.createElement('a')
  36. button2.href = 'javascript:'
  37. button2.className = 'brackets'
  38. let userIgnored = users.includes(name)
  39. button2.textContent = userIgnored ? ' Unignore User ' : ' Ignore User '
  40. document.querySelector('div.linkbox').append(button2)
  41. button2.onclick = () => {
  42. if (userIgnored) {
  43. users = users.filter(n => n !== name)
  44. GM_setValue('users', users)
  45. button2.textContent = ' Ignore User '
  46. userIgnored = false
  47. } else {
  48. users.push(name)
  49. GM_setValue('users', users)
  50. button2.textContent = ' Unignore User '
  51. userIgnored = true
  52. }
  53. }
  54. } else if (location.href.endsWith('requests.php') || location.href.includes('page=')) {
  55. const users = GM_getValue('users', [])
  56. document.querySelectorAll('#requests_list tr:not(.colhead_dark)').forEach(row => {
  57. if (GM_getValue(/\d+/.exec(row.querySelector('a').href)[0]) || users.includes(row.querySelector('a.username').textContent)) row.remove()
  58. })
  59. }