Greasy Fork is available in English.

Khan Acadamy UI Enhance

1. Khan Acadamy dialogs force FullScreen, 2. Ctrl+Enter To confirm

  1. // ==UserScript==
  2. // @name Khan Acadamy UI Enhance
  3. // @namespace https://userscript.snomiao.com/
  4. // @version 0.0.1
  5. // @description 1. Khan Acadamy dialogs force FullScreen, 2. Ctrl+Enter To confirm
  6. // @author snomiao@gmail.com
  7. // @match https://www.khanacademy.org/*
  8. // @icon https://www.google.com/s2/favicons?domain=khanacademy.org
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. "use strict";
  14. const e = document.createElement("div");
  15. e.innerHTML = `
  16. <style>
  17. [role="dialog"] {
  18. width: 100% !important;
  19. height: 100% !important;
  20. max-height: 100% !important;
  21. max-width: 100% !important;
  22. }
  23. <style>`;
  24. document.addEventListener("keydown", (event) => {
  25. // ctrl+enter or Alt+Enter to click the confirm button
  26. if (
  27. (event.ctrlKey &&
  28. !event.altKey &&
  29. !event.shiftKey &&
  30. event.key === "Enter") ||
  31. (!event.ctrlKey &&
  32. event.altKey &&
  33. !event.shiftKey &&
  34. event.key === "Enter")
  35. ) {
  36. var e =
  37. document.querySelector('[data-test-id="exercise-check-answer"]') ||
  38. document.querySelector('[data-test-id="exercise-next-question"]') ||
  39. document.querySelector('[data-test-id="modal-done-button"]') ||
  40. document.querySelector('[role="dialog"] [role="button"]');
  41. if (e) {
  42. e.click();
  43. e && event.preventDefault();
  44. }
  45. }
  46. });
  47. document.body.appendChild(e);
  48. })();