Metacritic: Hide games with no Metascore

Hide under-reviewed games while browsing metacritic.com

当前为 2023-10-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Metacritic: Hide games with no Metascore
  3. // @description Hide under-reviewed games while browsing metacritic.com
  4. // @version 0.3
  5. // @author mica
  6. // @namespace greasyfork.org/users/12559
  7. // @match https://www.metacritic.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. function clickNext(hidden) {
  12. if (hidden == 24) {
  13. document.querySelector('.c-navigationPagination_item--next > span > span').click();
  14. }
  15. }
  16.  
  17. function hideGames() {
  18. var hidden = 0;
  19. var elements = document.querySelectorAll('.c-finderProductCard_meta.g-outer-spacing-top-auto');
  20. elements.forEach(element => {
  21. if (element.innerHTML.length <= 23) {
  22. element.closest('.c-finderProductCard').style.display = 'none';
  23. hidden++;
  24. }
  25. });
  26. clickNext(hidden);
  27. }
  28.  
  29. function checkLoaded() {
  30. if (document.querySelectorAll('.c-cmsImage-loaded').length < 15) {
  31. setTimeout(checkLoaded, 100);
  32. } else {
  33. hideGames();
  34. }
  35. }
  36.  
  37. var url;
  38. setInterval(() => {
  39. if (url != location.href) {
  40. url = location.href;
  41. if (location.pathname.match('^\/browse\/game\/')) {
  42. checkLoaded();
  43. }
  44. }
  45. }, 100)