Khan Respostas 1.4

Respostas Khan

  1. // ==UserScript==
  2. // @name Khan Respostas 1.4
  3. // @version 1.4
  4. // @description Respostas Khan
  5. // @author Emerson
  6. // @match https://pt.khanacademy.org/*
  7. // @grant none
  8. // @namespace https://gf.qytechs.cn/pt-BR/users/305931-emerson-bardusco
  9. // ==/UserScript==
  10. (function () {
  11. if (typeof khanRespostasCarregado !== 'boolean' || !khanRespostasCarregado) {
  12. khanRespostasCarregado = true;
  13.  
  14. const overlayHTML = `
  15. <link rel="preconnect" href="https://fonts.googleapis.com">
  16. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  17. <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
  18. <div id="box">
  19. <button class="main" id="accordian">=</button>
  20. <div class="main" id="box2">
  21. <center>
  22. <p class="pdark" id="pdark"> KHAN </p>
  23. </center>
  24. <button onclick="location.reload()" class="inputans">Resetar</button>
  25. <br>
  26. <center>
  27. <section><label id="ansHead">--</label></section>
  28. </center>
  29. <center id="mainCen">
  30. <section><label id="ansBreak">&nbsp;</label></section>
  31. </center>
  32. <section><label>&nbsp;</label></section>
  33. <section class="toggleclass"><label>M para esconder Menu</label></section>
  34. </div>
  35. </div>
  36. `;
  37.  
  38. function get(x) {
  39. return document.getElementById(x);
  40. }
  41.  
  42. const overlay = document.createElement("div");
  43. overlay.innerHTML = overlayHTML;
  44. document.body.appendChild(overlay);
  45.  
  46. const acc = get("accordian"),
  47. darkToggle = get("darkToggle"),
  48. ansbutton = get("inputans");
  49.  
  50. acc.onclick = function () {
  51. const panel = get("box2");
  52. panel.style.display = panel.style.display === "grid" ? "none" : "grid";
  53. };
  54.  
  55. document.addEventListener("keydown", (event) => {
  56. if (event.key === "m" || event.key === "M") {
  57. const panel = get("box2");
  58. panel.style.display = panel.style.display === "grid" ? "none" : "grid";
  59. }
  60. });
  61. document.addEventListener('keydown', (event) => {
  62. if (event.key === 'M') {
  63. let panel = get("box2");
  64. if (panel.style.display == "grid") panel.style.display = "none";
  65. else { panel.style.display = "grid"; }
  66. }
  67. });
  68.  
  69. 'use strict';
  70. window.loaded = false;
  71.  
  72. class Answer {
  73. constructor(answer, type) {
  74. this.body = answer;
  75. this.type = type;
  76. }
  77.  
  78. get isMultiChoice() {
  79. return this.type == "multiple_choice";
  80. }
  81.  
  82. get isFreeResponse() {
  83. return this.type == "free-response";
  84. }
  85.  
  86. get isExpression() {
  87. return this.type == "expression";
  88. }
  89.  
  90. get isDropdown() {
  91. return this.type == "dropdown";
  92. }
  93.  
  94. log() {
  95. const answer = this.body;
  96.  
  97. answer.map(ans => {
  98. if (typeof ans == "string") {
  99. if (ans.includes("web+graphie")) {
  100. this.body[this.body.indexOf(ans)] = "";
  101. this.printImage(ans);
  102. } else { answer[answer.indexOf(ans)] = ans.replaceAll("$", "");
  103. }
  104. }
  105. });
  106. }
  107. }
  108.  
  109. const originalFetch = window.fetch;
  110. window.fetch = function () {
  111. return originalFetch.apply(this, arguments).then(async (res) => {
  112. if (res.url.includes("/getAssessmentItem")) {
  113. const clone = res.clone();
  114. const json = await clone.json();
  115. let item, question;
  116.  
  117. item = json.data.assessmentItem.item;
  118. question = item.itemData.questions[0];
  119.  
  120. if (question.presentation.widgets[0].type === "multiple_choice") {
  121. const answer = question.presentation.widgets[0].choices.filter(
  122. (choice) => choice.correct
  123. );
  124.  
  125. new Answer([answer[0].id], "multiple_choice").log();
  126. } else if (question.presentation.widgets[0].type === "free-response") {
  127. new Answer([question.response.value], "free-response").log();
  128. } else if (question.presentation.widgets[0].type === "expression") {
  129. new Answer([question.response.value], "expression").log();
  130. } else if (question.presentation.widgets[0].type === "dropdown") {
  131. const answer = question.presentation.widgets[0].choices.filter(
  132. (choice) => choice.correct
  133. );
  134.  
  135. new Answer([answer[0].id], "dropdown").log();
  136. }
  137. }
  138.  
  139. return res;
  140. });
  141. };
  142. }
  143. })();

QingJ © 2025

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