Hattrick skim series feed

Filter some sentences from the series feed

  1. // ==UserScript==
  2. // @name Hattrick skim series feed
  3. // @version 2024-03-19
  4. // @description Filter some sentences from the series feed
  5. // @author shotgunshine
  6. // @license MIT
  7. // @match https://*.hattrick.org/World/Series/*
  8. // @match https://*.hattrick.org/*/World/Series/*
  9. // @grant none
  10. // @namespace https://greasyfork.org/users/1381786
  11. // ==/UserScript==
  12.  
  13. function skimSeriesFeed() {
  14. let filter = new RegExp([
  15. // italiano
  16.  
  17. ' ha scritto un messaggio sui social dove rende noto ai suoi fan di essere stato',
  18. ' Pochi minuti dopo, l\'ufficio stampa della squadra ha confermato la notizia pubblicando un comunicato ufficiale[.]',
  19. 'La notizia era nell\'aria già da diversi giorni, tuttavia ora è stata battuta in via ufficiale da diverse agenzie stampa: ',
  20. ' considerato',
  21. ' da diversi addetti ai lavori',
  22. ' indetto una conferenza stampa per presentare ai propri tifosi',
  23. 'Brutte notizie dall\'infermeria di ',
  24. 'Brutta tegola per l\'allenatore di ',
  25. '[.] Questo giocatore è',
  26.  
  27. ' altrimenti le loro possibilità di promozione svaniranno[.] Riusciranno a rimanere lucidi[?]',
  28. 'Non c\'è più speranza per ',
  29. '[!.] La squadra',
  30. ' indipendentemente da quello che accadrà',
  31. ' nel turno [0-9]+[.]',
  32. ' negli ultimi [0-9]+ turni',
  33. ' nell\'ultimo turno[.]',
  34. 'è arrivato il momento della verità: ',
  35. 'è il momento della verità: ',
  36. ' se vogliono evitare la retrocessione diretta',
  37. 'Nessuna ulteriore chiamata a disposizione per ',
  38. ' se vogliono evitare lo spareggio per non retrocedere[.]',
  39. ' se vuole mantenere viva la speranza di promozione[.] Riusciranno a rimanere lucidi[?]',
  40. 'Se vuole avere ancora opportunità di finire al primo posto, ',
  41. ' Ce la faranno[?]',
  42. ' se vogliono evitare lo spareggio per non retrocedere [(]o anche peggio[)]',
  43. 'può ancora ambire alla promozione diretta, tuttavia giocatori e allenatore ',
  44.  
  45. 'I tifosi di ',
  46. 'stanno vivendo un vero e proprio psicodramma da quando ',
  47. ' continuerà a partecipare a tutte le competizioni, ma l\'incertezza che circonda il club si ripercuoterà inevitabilmente su giocatori e staff',
  48. 'Nonostante rimanga(no)? (una|[0-9]+) giornat(a|e) ancora da giocare, ',
  49. ' Congratulazioni, campioni[!]',
  50. 'Congratulazioni a ',
  51. ' e la prossima stagione giocherà nella serie superiore',
  52. 'subisce le conseguenze di una stagione a dir poco complicata: ',
  53. ' è purtroppo diventata realtà',
  54. 'deve voltare pagina dopo il triste epilogo dello scorso campionato[.] A seguito della retrocessione, la squadra ',
  55. 'Fresca di promozione, ',
  56.  
  57. // english
  58.  
  59. ' has announced to social media networks that he',
  60. 'announced on social media that he ',
  61. ' Minutes later, the move was confirmed by the club[.]',
  62. ', a big name on the squad[.] It will be interesting to see what other changes this may lead to',
  63. 'often described as ',
  64. ' the team hopes will become a key player for the team',
  65. ' an essential player',
  66. '[.] The player is',
  67.  
  68. ', otherwise their promotion chances will evaporate into thin air[.] Can they deliver[?]',
  69. 'There is no hope left for ',
  70. '[!.] The team',
  71. ' no matter what they do in the (last|final [0-9]+) round(s)?[.]',
  72. 'to get real[.] They ',
  73. 'It\'s time for ',
  74. ' to avoid direct demotion',
  75. 'There are no margins left for ',
  76. ' to avoid the horror of a demotion qualifier match[.]',
  77. 'If they want to keep their chances for finishing first, ',
  78. ' Can they deliver[?]',
  79. ' to avoid the horror of a demotion qualifier match, or - perhaps worse - direct demotion',
  80. 'still has a chance for direct promotion, but ',
  81. ' to stay on track',
  82.  
  83. 'Following weeks of rumors, it has been confirmed that ',
  84. ' The team will continue to participate in all competitions, but the uncertainty surrounding the club will likely affect players and staff.',
  85. 'Despite there being [0-9]+ round(s)? left to play, ',
  86. ' Congratulations, champions[!]',
  87. 'Having just been promoted, ',
  88. ' for the upcoming season',
  89. 'is coming off a bad season, which ended in demotion[.] They ',
  90. 'Congratulations to ',
  91. ' and will play in a higher division next season',
  92. 'is seeing the consequences of their weak season and ',
  93. ].join('|'), 'g');
  94.  
  95. let feed = document.getElementById('ctl00_ctl00_CPContent_CPMain_repLLUEvents');
  96. feed.innerHTML = feed.innerHTML.replaceAll(filter, '');
  97. }
  98.  
  99. (function() {
  100. 'use strict';
  101.  
  102. skimSeriesFeed();
  103.  
  104. let observerTarget = document.getElementById('ctl00_ctl00_CPContent_CPMain_updLLUEvents');
  105. let observerOptions = {subtree: true, childList: true};
  106. const observer = new MutationObserver(() => {
  107. observer.disconnect();
  108. skimSeriesFeed();
  109. observer.observe(observerTarget, observerOptions);
  110. });
  111. observer.observe(observerTarget, observerOptions);
  112. })();