🏠 Home 

MetaCriticAll

Metacritic ratings everywhere. See the supported sites in the @include section of the script.


Installer dette script?
  1. // ==UserScript==
  2. // @name MetaCriticAll
  3. // @namespace http://stackoverflow.com/users/982924/rasg
  4. // @author RASG
  5. // @version 2016.12.30.1011
  6. // @description Metacritic ratings everywhere. See the supported sites in the @include section of the script.
  7. // @icon https://www.google.com/s2/favicons?domain=metacritic.com
  8. // @require http://code.jquery.com/jquery.min.js
  9. // @resource metacritic.global.css https://raw.githubusercontent.com/yodog/userscripts/master/res/metacritic.global.css
  10. // @resource metacritic.base.css https://raw.githubusercontent.com/yodog/userscripts/master/res/metacritic.base.css
  11. // @resource metacritic.css https://raw.githubusercontent.com/yodog/userscripts/master/res/metacritic.css
  12. // @grant GM_addStyle
  13. // @grant GM_getResourceText
  14. // @grant GM_log
  15. // @grant GM_xmlhttpRequest
  16. // @include http*://*.getgamesgo.com/*
  17. // @include http*://*.greenmangaming.com/*/games/*
  18. // @include http*://*.nuuvem.com.br/produto*
  19. // @include http*://*steamcommunity.com/id/*/wishlist
  20. // @include http*://*.steamgifts.com/*
  21. // @include http*://*store.steampowered.com/*
  22. // ==/UserScript==
  23. // temporarily disabling isthereanydeal, until someone have time to fix it
  24. // @include http*://*isthereanydeal.com/*
  25. var estilo1 = GM_getResourceText ("metacritic.global.css");
  26. GM_addStyle (estilo1);
  27. var estilo2 = GM_getResourceText ("metacritic.base.css");
  28. GM_addStyle (estilo2);
  29. var estilo3 = GM_getResourceText ("metacritic.css");
  30. GM_addStyle (estilo3);
  31. $(function(){
  32. // SEARCHING FOR GAMES
  33. if (window.location.href.indexOf('getgamesgo.com/product/') > -1) {
  34. full_ou_mini = 'full';
  35. elementos = $('#pageTitle');
  36. $("<style>.main_details, .side_details { display: inline-block; }</style>").appendTo(document.documentElement);
  37. $('nav.mainTitle').removeClass('mainTitle').css({"border":"2px solid rgb(66, 127, 166)", "background":"none repeat scroll 0% 0% rgb(0, 0, 0)"});
  38. }
  39. if (window.location.href.indexOf('greenmangaming.com/s') > -1) {
  40. full_ou_mini = 'full';
  41. elementos = $('div#main > .prod_det');
  42. $("<style>.main_details, .side_details { display: inline-block; }</style>").appendTo(document.documentElement);
  43. $("<style>.metafull { display: table !important; }</style>").appendTo(document.documentElement);
  44. $("div.wrapper").css({"min-width":"70%", "max-width":"90%"});
  45. }
  46. if (window.location.href.indexOf('isthereanydeal.com') > -1) {
  47. full_ou_mini = 'mini';
  48. elementos = $('div.title');
  49. elementos.css({'border':'1px solid red'})
  50. $("<style>.main_details, .side_details { display: inline-block; }</style>").appendTo(document.documentElement);
  51. }
  52. if (window.location.href.indexOf('nuuvem.com.br/produto/') > -1) {
  53. full_ou_mini = 'full';
  54. elementos = $('div.blockholder.right > .blockcontent > header > h2 > strong');
  55. $("<style>.main_details, .side_details { display: inline-block; }</style>").appendTo(document.documentElement);
  56. $("div.wrapper.pageholder").css({"min-width":"70%", "max-width":"90%"});
  57. $("div.blockholder.right").css({"min-width":"70%", "max-width":"90%"});
  58. }
  59. if (window.location.href.indexOf('nuuvem.com.br/produtos') > -1) {
  60. full_ou_mini = 'mini';
  61. elementos = $('div.info > a.name');
  62. $("<style>.main_details, .side_details { display: inline-block; }</style>").appendTo(document.documentElement);
  63. $("<style>.main_details, .side_details { width: 250px; }</style>").appendTo(document.documentElement);
  64. $("<style>div.metamini { float: left; }</style>").appendTo(document.documentElement);
  65. $("div.wrapper").css({"max-width":"90%", "width":"auto"});
  66. $("div#produtos").css({"display":"table"});
  67. $("div.games").css({"width":"auto", "height":"auto"});
  68. $("div.list > ul > li").css({"height":"52px", "overflow":"hidden"});
  69. $("div.info").css({"min-width":"800px", "width":"auto"});
  70. $("li div.purchase").css({"float":"right"});
  71. }
  72. if ((window.location.href.indexOf('steamcommunity.com/id/') > -1) && (window.location.href.indexOf('/wishlist') > -1)) {
  73. full_ou_mini = 'mini';
  74. elementos = $('div.wishlistRowItem > h4');
  75. $("<style>.main_details, .side_details { display: inline-block; }</style>").appendTo(document.documentElement);
  76. $("<style>.main_details, .side_details { width: 200px; }</style>").appendTo(document.documentElement);
  77. $("<style>div.metamini { float: left; }</style>").appendTo(document.documentElement);
  78. $("div.wishlistRow").css({"height":"auto", "overflow":"hidden", "width":"850px"});
  79. $("div.bottom_controls").css({"position":"initial"});
  80. }
  81. if (window.location.href.indexOf('steamgifts.com') > -1) {
  82. full_ou_mini = 'full';
  83. elementos = $('.ajax_gifts > .post > .left > .title > a');
  84. $("<style>.main_details, .side_details { display: inline-block; }</style>").appendTo(document.documentElement);
  85. $("<style>div.ajax_gifts div.left { border: 1px dotted red; }</style>").appendTo(document.documentElement);
  86. }
  87. if (window.location.href.indexOf('store.steampowered.com/app') > -1) {
  88. full_ou_mini = 'full';
  89. elementos = $('.apphub_HeaderStandardTop > .apphub_AppName');
  90. $("<style>.main_details, .side_details { display: inline-block; }</style>").appendTo(document.documentElement);
  91. $("<style>.apphub_HeaderStandardTop { height: auto !important; background-size: 100% auto; }</style>").appendTo(document.documentElement);
  92. }
  93. // METACRITIC CONTENT
  94. if (full_ou_mini == 'full') {
  95. var inicio = /(?=<div class="summary_wrap">)/i;
  96. var fim = '<div class="module critic_user_reviews">';
  97. var classe = 'metafull';
  98. }
  99. else if (full_ou_mini == 'mini') {
  100. var inicio = /(?=<div class="section product_scores">)/i;
  101. var fim = '<div class="section product_details">';
  102. var classe = 'metamini';
  103. }
  104. else {
  105. alert('variable full_ou_mini not defined for this domain');
  106. return;
  107. }
  108. // DOM
  109. elementos.each(function() {
  110. var elemjogo = $(this)
  111. var jogo = elemjogo.text()
  112. console.log('jogo encontrado: ' + jogo)
  113. jogo = jogo.replace(/\(MAC|NA\)*$/i, "");
  114. jogo = jogo.replace(/[\.,\/#!$%\^&\*;:{}=\_`'´’"~()]/g, "")
  115. jogo = $.trim(jogo).toLowerCase()
  116. jogo = jogo.replace(/[\s\-]+/g, '-');
  117. $(elemjogo).append("<div id='" + jogo + "' class='" + classe + "' style='display:inline-block; font-size:9px;' />")
  118. requisicao = "http://www.metacritic.com/game/pc/" + encodeURIComponent(jogo)
  119. conectar('GET', requisicao, respostametacritic)
  120. function conectar(metodo, endereco, resposta, corpo) {
  121. console.log('pesquisando no endereco: ' + endereco)
  122. callback = function(xhr) { resposta(xhr) };
  123. GM_xmlhttpRequest({
  124. "method" : metodo,
  125. "url" : endereco,
  126. "onerror" : callback,
  127. "onload" : callback,
  128. "headers" : {'Content-Type' : 'application/x-www-form-urlencoded'},
  129. "data" : corpo
  130. });
  131. }
  132. function respostametacritic(detalhes) {
  133. $("#" + jogo).html(detalhes.responseText.split(inicio)[1].split(fim)[0])
  134. }
  135. })
  136. });