MetaCriticAll

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

当前为 2014-06-10 提交的版本,查看 最新版本

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

QingJ © 2025

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