MetaCriticAll

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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址