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)

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