Trivia Crack / Preguntados Correct Answer Cheat! + works on Violentmonkey (Maxthon)

EN: This user script shows the Trivia Crack correct answer (Facebook Game). \n ES: Este script muestra la respuesta correcta en el juego Preguntados (Juego de Facebook)

当前为 2015-05-04 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Trivia Crack / Preguntados Correct Answer Cheat! + works on Violentmonkey (Maxthon)
  3. // @namespace ar.com.maurocendon.userscripts.triviacrackcheat
  4. // @version 1.3
  5. // @description EN: This user script shows the Trivia Crack correct answer (Facebook Game). \n ES: Este script muestra la respuesta correcta en el juego Preguntados (Juego de Facebook)
  6. // @match https://apps.facebook.com/triviacrack/*
  7. // @match http://www.triviacrack.com/game/*
  8. // @match http://www.preguntados.com/game/*
  9. // @homepageURL https://greasyfork.org/en/scripts/9624
  10. // @supportURL https://greasyfork.org/en/scripts/9624/feedback
  11. // @author HACKSCOMICON Credits: MauroCendon
  12. // ==/UserScript==
  13. var appName = "[ TRIVIA CRACK / PREGUNTADOS CORRECT ANSWER CHEAT ]";
  14. var preguntadosDomains = {"triviacrack.com": "triviacrack.com",
  15. "www.triviacrack.com":"www.triviacrack.com",
  16. "preguntados.com":"preguntados.com",
  17. "www.preguntados.com":"www.preguntados.com"};
  18. var gamePaths = {"/game":"/game","/game/":"/game/"};
  19. var pwHandler = function(){};
  20.  
  21. var pwAlertText = function(question)
  22. {
  23. return "Pregunta: " + question.text + "\nRespuesta Correcta: " + question.answers[question.correct_answer];
  24. }
  25.  
  26. var pwAlert = function(question, powerup)
  27. {
  28. alert(appName + "\r\n" + pwAlertText(question));
  29. }
  30.  
  31. var pwDecorateButton = function(question,powerup)
  32. {
  33. if (jQuery(".answers-container").size() > 0)
  34. {
  35. if (jQuery(".answers-container").find("button")[question.correct_answer])
  36. {
  37. jQuery(jQuery(".answers-container").find("button")[question.correct_answer]).css("border", "10px solid #ff0000");
  38. }
  39. }
  40. }
  41.  
  42. if (window.location.host in preguntadosDomains && window.location.pathname in gamePaths)
  43. {
  44. (function(open) {
  45. XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
  46. var xhr = this;
  47. if (url.indexOf("/dashboard") > -1)
  48. {
  49. async = false;
  50. xhr.onreadystatechange = function() {
  51. if (xhr.readyState == 4) {
  52. var data = JSON.parse(xhr.responseText);
  53. }
  54. };
  55. }
  56. if (url.indexOf("/games/") > -1)
  57. {
  58. async = false;
  59. xhr.onreadystatechange = function() {
  60. if (xhr.readyState == 4) {
  61. var data = JSON.parse(xhr.responseText);
  62. if (data.my_turn)
  63. {
  64. var spinsData = data.spins_data;
  65. if (!spinsData)
  66. return;
  67. var spins = spinsData.spins;
  68. if (!spins)
  69. return;
  70. //1� Caso: Pregunta NORMAL
  71. if (spins.length == 1)
  72. {
  73. var questionData = spins[0].questions[0];
  74. if (!questionData)
  75. return;
  76. var question = questionData.question;
  77. var powerup = questionData.powerup_question;
  78. pwHandler = function()
  79. {
  80. pwDecorateButton(question,powerup);
  81. };
  82. }
  83. else
  84. {
  85. //2� Caso: Duelo o Corona
  86. //TODO: IMPLEMENTAR DUELO
  87. if (spins.length == 2)
  88. {
  89. var crown = spins[0].type == "CROWN" ? spins[0] : spins[1];
  90. var duel = spins[1].type == "DUEL" ? spins[1] : spins[0];
  91. var question = null;
  92. pwHandler = function()
  93. {
  94. var handler = this;
  95. jQuery(".btn.choose-crown").off("click");
  96. jQuery(".btn.choose-duel").off("click");
  97. jQuery("input.category-radio").off("click");
  98. jQuery(".btn.choose-crown").on("click",function(ev)
  99. {
  100. handler.gameType = "CROWN";
  101. });
  102. jQuery(".btn.choose-duel").on("click",function(ev)
  103. {
  104. handler.gameType = "DUEL";
  105. });
  106. jQuery("input.category-radio").on("click", function(ev){
  107. var category = jQuery(this).val().toUpperCase();
  108. var game = null;
  109. if (handler.gameType == "CROWN")
  110. {
  111. game = crown
  112. }
  113. else if(handler.gameType == "DUEL")
  114. {
  115. game = duel;
  116. }
  117. for (var i=0;i<game.questions.length;i++)
  118. {
  119. if (game.questions[i].question.category == category)
  120. {
  121. question = game.questions[i];
  122. break;
  123. }
  124. }
  125. });
  126. if (question != null)
  127. {
  128. pwDecorateButton(question.question,question.powerup_question);
  129. }
  130. };
  131. }
  132.  
  133. }
  134. jQuery(document).off('DOMSubtreeModified');
  135. jQuery(document).on('DOMSubtreeModified', pwHandler);
  136. }
  137. }
  138. }
  139. }
  140. open.call(this, method, url, async, user, pass);
  141. };//open
  142. })(XMLHttpRequest.prototype.open);
  143.  
  144. }