Proton db

try to take over the world!

  1. // ==UserScript==
  2. // @name Proton db
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://store.steampowered.com/app/*
  8. // @grant GM.xmlHttpRequest
  9. // ==/UserScript==
  10. // SteamPlay Whitelist
  11. // Generated by get_whitelist.py on 2020-04-07
  12.  
  13. whitelist = [
  14. 2280,
  15. 2290,
  16. 2300,
  17. 2310,
  18. 2360,
  19. 2370,
  20. 2390,
  21. 2990,
  22. 3300,
  23. 3340,
  24. 3980,
  25. 4500,
  26. 4580,
  27. 4900,
  28. 6060,
  29. 6600,
  30. 8200,
  31. 8210,
  32. 8220,
  33. 8230,
  34. 8240,
  35. 8250,
  36. 8260,
  37. 8270,
  38. 8280,
  39. 8290,
  40. 8300,
  41. 9180,
  42. 9450,
  43. 15520,
  44. 16300,
  45. 22100,
  46. 23310,
  47. 24240,
  48. 31220,
  49. 31230,
  50. 31240,
  51. 31250,
  52. 31260,
  53. 31270,
  54. 31280,
  55. 32400,
  56. 32460,
  57. 32510,
  58. 33120,
  59. 38400,
  60. 38410,
  61. 40720,
  62. 40950,
  63. 48720,
  64. 49470,
  65. 57690,
  66. 78000,
  67. 94200,
  68. 94400,
  69. 94590,
  70. 97330,
  71. 104200,
  72. 204360,
  73. 207690,
  74. 209690,
  75. 210970,
  76. 213670,
  77. 215710,
  78. 227000,
  79. 234080,
  80. 236450,
  81. 237630,
  82. 239350,
  83. 246840,
  84. 249050,
  85. 268130,
  86. 268910,
  87. 269050,
  88. 288160,
  89. 314180,
  90. 317280,
  91. 322110,
  92. 322170,
  93. 342890,
  94. 343780,
  95. 344480,
  96. 348250,
  97. 348430,
  98. 348440,
  99. 350080,
  100. 354970,
  101. 355170,
  102. 360380,
  103. 360740,
  104. 363440,
  105. 364930,
  106. 365260,
  107. 366970,
  108. 370060,
  109. 374320,
  110. 375310,
  111. 375530,
  112. 377860,
  113. 379720,
  114. 382900,
  115. 388970,
  116. 389730,
  117. 397430,
  118. 400630,
  119. 412830,
  120. 414700,
  121. 435120,
  122. 447150,
  123. 448510,
  124. 460950,
  125. 462930,
  126. 480640,
  127. 490100,
  128. 502720,
  129. 505330,
  130. 510540,
  131. 511470,
  132. 522470,
  133. 524220,
  134. 532110,
  135. 534550,
  136. 537520,
  137. 540610,
  138. 556180,
  139. 557340,
  140. 557600,
  141. 575330,
  142. 587000,
  143. 588430,
  144. 590380,
  145. 618310,
  146. 620980,
  147. 650000,
  148. 663210,
  149. 674940,
  150. 676820,
  151. 691830,
  152. 698780,
  153. 705220,
  154. 712180,
  155. 717610,
  156. 730820,
  157. 744050,
  158. 744190,
  159. 744810,
  160. 758190,
  161. 764790,
  162. 771070,
  163. 782570,
  164. 788770,
  165. 820040,
  166. 826600,
  167. 887880,
  168. 896420,
  169. 897330,
  170. 898940,
  171. 905200,
  172. 905260,
  173. 909080,
  174. 909110,
  175. 910880,
  176. 922400,
  177. 935880,
  178. 937170,
  179. 952250,
  180. 990400,
  181. 1043180,
  182. ]
  183.  
  184. console.log(GM.xmlHttpRequest);
  185.  
  186.  
  187. function calll (appid) {
  188. var url = "https://www.protondb.com/" + "api/v1/reports/summaries/" + appid + ".json";
  189.  
  190. return new Promise((resolve, reject) => {
  191. GM.xmlHttpRequest({
  192. method: "GET",
  193. url: url,
  194. onload: function(response) {
  195. resolve(JSON.parse(response.responseText))
  196. },
  197. onerror: reject
  198. })
  199. }).catch(error => console.log(error))
  200. ;
  201. }
  202.  
  203. class ProtonDB {
  204. static get HOMEPAGE() {return "https://www.protondb.com/";}
  205. static get API_SUMMARY() {return "api/v1/reports/summaries/";}
  206.  
  207. static request_summary(appid, callback) {
  208. var request = new XMLHttpRequest();
  209. request.onreadystatechange = function () {
  210. callback(request);
  211. }
  212. request.open("GET", this.HOMEPAGE + this.API_SUMMARY + appid + ".json", true);
  213. request.send(null);
  214. }
  215.  
  216. static request_rating(appid, callback)
  217. {
  218. calll(appid).then(callback);
  219. }
  220. /*
  221. bestReportedTier: "platinum"
  222. confidence: "strong"
  223. score: 0.45
  224. tier: "gold"
  225. total: 109
  226. trendingTier: "silver"
  227. */
  228.  
  229. static get_rating_container(rating, whitelisted, key) {
  230. var container = document.createElement("div");
  231.  
  232. container.className = "dev_row protondb_rating_row steam_row";
  233. container.title = "As seen by the community of ProtonDB.com";
  234.  
  235. var link = document.createElement("a");
  236. link.className = "protondb_rating_link protondb_rating_" + rating[key];
  237.  
  238. link.href = ProtonDB.HOMEPAGE + "app/" + Steam.get_app_id(window.location.href);
  239. link.textContent = rating[key];
  240. link.target = "_blank"
  241.  
  242. if (whitelisted) {
  243. var star = document.createElement("span");
  244. star.className = "protondb_rating_whitelisted"
  245. star.title = "Whitelisted by Valve";
  246. star.textContent = " ★"
  247.  
  248. link.appendChild(star);
  249. }
  250.  
  251. container.appendChild(link);
  252. return container;
  253. }
  254. }
  255.  
  256. class Steam {
  257. // Return a games appid from the url
  258. static get_app_id(url) {
  259. var appid = url.match(/\/(app)\/([0-9]{1,7})/);
  260.  
  261. return parseInt(appid[2], 10);
  262. }
  263.  
  264. // Insert the ProtonDB rating below DEVELOPER/PUBLISHER
  265. static insert_rating(rating, whitelisted, label, key) {
  266. var element = document.querySelector(".user_reviews");
  267. var subtitle = document.createElement("div");
  268. subtitle.className = "subtitle column'";
  269. subtitle.textContent = label;
  270. var container = ProtonDB.get_rating_container(rating, whitelisted, key);
  271. container.prepend(subtitle);
  272.  
  273. if (element) {
  274. element.append(container);
  275. }
  276. }
  277. }
  278.  
  279. // Main
  280. var appid = Steam.get_app_id(window.location.href);
  281. if (document.querySelector("span.platform_img.linux") === null) {
  282. ProtonDB.request_rating(appid, (rating) => {
  283. Steam.insert_rating(rating, null, 'ProtonDB score', 'score');
  284. Steam.insert_rating(rating, null, 'ProtonDB total', 'total');
  285. Steam.insert_rating(rating, null, 'ProtonDB max', 'bestReportedTier');
  286. Steam.insert_rating(rating, whitelist.includes(appid) ? true : false, 'ProtonDB Note', 'tier');
  287. });
  288. } else {
  289. Steam.insert_rating("native");
  290. }

QingJ © 2025

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