MetaCriticAll

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

目前为 2015-01-13 提交的版本。查看 最新版本

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

QingJ © 2025

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