proxies moddified khan hack

Here Is A Moddifed Version Of Khan Hack

  1. // ==UserScript==
  2. // @name proxies moddified khan hack
  3. // @version 3.9
  4. // @description Here Is A Moddifed Version Of Khan Hack
  5. // @author proxyleft
  6. // @match https://www.khanacademy.org/*
  7. // @grant none
  8. // @namespace https://greasyfork.org/users/783447
  9. // ==/UserScript==
  10. // @license MIT
  11.  
  12. (function () {
  13. let overlayHTML = ` <link rel="preconnect" href="https://fonts.googleapis.com">
  14. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  15. <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
  16. <div id="box">
  17. <button class="main" id="accordian">Toggle</button>
  18. <div class="main" id="box2">
  19. <center><p class="pdark" id="pdark"> KhanHack </p></center>
  20. <button onclick="location.reload()" class="inputans">Reset Answer List</button>
  21. <br>
  22. <center><section><label id="ansHead">-Answers-</label></section></center>
  23.  
  24. <center id="mainCen">
  25. <section><label id="ansBreak">&nbsp;</label></section>
  26. </center>
  27. <section><label>&nbsp;</label></section>
  28. <section class="toggleclass"><label>M also toggles Menu</label></section>
  29. </div>
  30. </div>
  31.  
  32. <style>
  33. #box {
  34. z-index: 9999;
  35. position: fixed;
  36. top: 0;
  37. right: 0;}
  38. #box2 {
  39. padding: 15px;
  40. margin-bottom: 5px;
  41. display: grid;
  42. border-radius: 25px;};
  43. section {
  44. display: flex;
  45. justify-content: space-between;margin:5px;}
  46. .main {
  47. background-color: #072357;
  48. letter-spacing: 2px;
  49. font-weight: none;
  50. font-size: 11px;
  51. font-family: 'Roboto', sans-serif;
  52. color:white;
  53. webkit-user-select: all;}
  54. .pdark {
  55. border-bottom:2px solid white;
  56.  
  57. }
  58. #accordian {
  59. width: 100%;
  60. border: 0;
  61. cursor: pointer;
  62. border-radius: 25px;}
  63. .inputans {
  64. border: 0;
  65. cursor: pointer;
  66. border-radius: 25px;
  67. background-color: #0b40a1;
  68. color: white;
  69. font-family: 'Roboto', sans-serif;
  70. }
  71. .inputans:hover {
  72. background-color: #0b378a;
  73. }
  74. .toggleclass {
  75. text-align: center;
  76. }
  77. </style>
  78. `
  79.  
  80.  
  81.  
  82. function get(x) { return document.getElementById(x); }
  83.  
  84. let overlay = document.createElement("div");
  85. overlay.innerHTML = overlayHTML;
  86. document.body.appendChild(overlay);
  87.  
  88. let acc = get("accordian"),
  89. darkToggle = get("darkToggle"),
  90. ansbutton = get("inputans"),
  91. ansbutton2 = get("inputans2")
  92.  
  93. acc.onclick = function() {
  94. let panel = get("box2");
  95. let acc = get("accordian")
  96. if (panel.style.display == "grid") panel.style.display = "none";
  97. else { panel.style.display = "grid";}
  98.  
  99. }
  100.  
  101. document.addEventListener('keydown', (event) => {
  102. if (event.key === 'm') {
  103.  
  104. let panel = get("box2");
  105. if (panel.style.display == "grid") panel.style.display = "none";
  106. else { panel.style.display = "grid"; }
  107. }
  108. });
  109.  
  110. 'use strict';
  111. window.loaded = false;
  112.  
  113. class Answer {
  114.  
  115. constructor(answer, type) {
  116. this.body = answer;
  117. this.type = type;
  118. }
  119.  
  120. get isMultiChoice() {
  121. return this.type == "multiple_choice";
  122. }
  123.  
  124. get isFreeResponse() {
  125. return this.type == "free_response";
  126. }
  127.  
  128. get isExpression() {
  129. return this.type == "expression";
  130. }
  131.  
  132. get isDropdown() {
  133. return this.type == "dropdown";
  134. }
  135.  
  136. log() {
  137. const answer = this.body;
  138.  
  139. answer.map(ans => {
  140. if (typeof ans == "string") {
  141. if (ans.includes("web+graphie")) {
  142. this.body[this.body.indexOf(ans)] = "";
  143. this.printImage(ans);
  144. } else {
  145. answer[answer.indexOf(ans)] = ans.replaceAll("$", "");
  146. }
  147. }
  148. });
  149.  
  150.  
  151. }
  152.  
  153.  
  154. }
  155.  
  156. const originalFetch = window.fetch;
  157. window.fetch = function () {
  158. return originalFetch.apply(this, arguments).then(async (res) => {
  159. if (res.url.includes("/getAssessmentItem")) {
  160. const clone = res.clone();
  161. const json = await clone.json()
  162. let item, question;
  163.  
  164.  
  165. item = json.data.assessmentItem.item.itemData;
  166. question = JSON.parse(item).question;
  167.  
  168.  
  169. Object.keys(question.widgets).map(widgetName => {
  170. switch (widgetName.split(" ")[0]) {
  171. case "numeric-input":
  172. return freeResponseAnswerFrom(question).log();
  173. case "radio":
  174. return multipleChoiceAnswerFrom(question).log();
  175. case "expression":
  176. return expressionAnswerFrom(question).log();
  177. case "dropdown":
  178. return dropdownAnswerFrom(question).log();
  179. }
  180. });
  181. }
  182.  
  183. if (!window.loaded) {
  184. console.clear();
  185.  
  186. window.loaded = true;
  187. }
  188.  
  189. return res;
  190. })
  191. }
  192.  
  193. let curAns = 1
  194.  
  195. function freeResponseAnswerFrom(question) {
  196. const answer = Object.values(question.widgets).map((widget) => {
  197. if (widget.options?.answers) {
  198. return widget.options.answers.map(answer => {
  199. if (answer.status == "correct") {
  200.  
  201. var parNumCurAns = "parNum" + curAns
  202. var createPar = document.createElement('section')
  203. createPar.innerHTML = answer.value
  204. document.getElementById('ansBreak').append(createPar)
  205.  
  206. curAns++
  207. }
  208. });
  209. }
  210. }).flat().filter((val) => { return val !== undefined; });
  211.  
  212. return new Answer(answer, "free_response");
  213. }
  214.  
  215.  
  216.  
  217. function multipleChoiceAnswerFrom(question) {
  218. const answer = Object.values(question.widgets).map((widget) => {
  219. if (widget.options?.choices) {
  220. return widget.options.choices.map(choice => {
  221. if (choice.correct) {
  222.  
  223. var parNumCurAns = "parNum" + curAns
  224. var createPar = document.createElement('section')
  225. createPar.innerHTML = choice.content
  226. document.getElementById('ansBreak').append(createPar)
  227.  
  228. curAns++
  229.  
  230. }
  231. });
  232. }
  233. }).flat().filter((val) => { return val !== undefined; });
  234.  
  235. return new Answer(answer, "multiple_choice");
  236. }
  237.  
  238. function expressionAnswerFrom(question) {
  239. const answer = Object.values(question.widgets).map((widget) => {
  240. if (widget.options?.answerForms) {
  241. return widget.options.answerForms.map(answer => {
  242. if (Object.values(answer).includes("correct")) {
  243.  
  244. var parNumCurAns = "parNum" + curAns
  245. var createPar = document.createElement('section')
  246. createPar.innerHTML = answer.value
  247. document.getElementById('ansBreak').append(createPar)
  248.  
  249. curAns++
  250.  
  251. }
  252. });
  253. }
  254. }).flat();
  255.  
  256. return new Answer(answer, "expression");
  257. }
  258.  
  259. function dropdownAnswerFrom(question) {
  260. const answer = Object.values(question.widgets).map((widget) => {
  261. if (widget.options?.choices) {
  262. return widget.options.choices.map(choice => {
  263. if (choice.correct) {
  264.  
  265. var parNumCurAns = "parNum" + curAns
  266. var createPar = document.createElement('section')
  267. createPar.innerHTML = choice.content
  268. document.getElementById('ansBreak').append(createPar)
  269.  
  270. curAns++
  271. }
  272. });
  273. }
  274. }).flat();
  275.  
  276. return new Answer(answer, "dropdown");
  277. }
  278. })();