Naurok Bypass v2: Extras

Companion userscript for naurok bypass; Contains unstable and unfinished features and enhancements for the Testing pages.

安裝腳本?
作者推薦腳本

您可能也會喜歡 Naurok Bypass v2

安裝腳本
  1. // ==UserScript==
  2. // @name Naurok Bypass v2: Extras
  3. // @description Companion userscript for naurok bypass; Contains unstable and unfinished features and enhancements for the Testing pages.
  4. // @author griffi-gh
  5. // @namespace griffi-gh
  6. // @match https://naurok.com.ua/test/testing/*
  7. // @grant none
  8. // @grant GM_addStyle
  9. // @version 0.3
  10. // @run-at document-idle
  11. // @inject-into page
  12. // @sandbox DOM
  13. // @connect naurok.com.ua
  14. // @icon https://play-lh.googleusercontent.com/scIkpmsUJTfDbV39X0rb-AvxbgxOrpa9zIGJQqDHP1VbuBTmortXomSSWVZnpErwyA=w480-h960
  15. // ==/UserScript==
  16.  
  17. "use strict";
  18.  
  19. let session_info;
  20.  
  21. async function loadSessionInfo() {
  22. //Get session ID
  23. const session_id = document.querySelector(`[ng-app="testik"]`).getAttribute("ng-init").match(/[0-9]+/g)[1];
  24. console.log("Session id: ", session_id);
  25.  
  26. //Get session info from API
  27. session_info = await fetch(`https://naurok.com.ua/api2/test/sessions/${session_id}`, {
  28. credentials: "include",
  29. headers: {
  30. 'Accept': 'application/json, text/plain, */*',
  31. 'Content-Type': 'application/json'
  32. },
  33. redirect: 'follow',
  34. }).then(x => x.json());
  35. console.log("Session info: ", session_info);
  36. }
  37.  
  38. function displayUi() {
  39. //Add test name to the page
  40. const testContainer = document.querySelector('.test-container')
  41.  
  42. const infoNode = document.createElement("div");
  43. infoNode.classList.add("x-test-info");
  44. testContainer.insertBefore(infoNode, testContainer.firstChild);
  45.  
  46. const nameNode = document.createElement("div");
  47. nameNode.classList.add("x-test-name");
  48. infoNode.append(nameNode);
  49. nameNode.textContent = `${session_info.settings.name}`;
  50.  
  51. const buttonsNode = document.createElement("div");
  52. buttonsNode.classList.add("x-button-container");
  53. infoNode.append(buttonsNode);
  54.  
  55. let xButton
  56.  
  57. xButton = document.createElement("a");
  58. buttonsNode.append(xButton);
  59. xButton.classList.add("x-button");
  60. xButton.textContent = "Результати інших учнів";
  61. xButton.href = `https://naurok.com.ua/test/homework/${session_info.settings.id}/detailed-export/score`;
  62.  
  63. xButton = document.createElement("a");
  64. buttonsNode.append(xButton);
  65. xButton.classList.add("x-button");
  66. xButton.textContent = "Наступні питання";
  67. xButton.href = `javascript:alert("TODO")`;
  68.  
  69. }
  70.  
  71. function applyStyles() {
  72. let styleCss = `
  73. /* allow selection */
  74. * {
  75. -webkit-user-select: unset !important;
  76. -webkit-touch-callout: unset !important;
  77. -moz-user-select: unset !important;
  78. -ms-user-select: unset !important;
  79. user-select: unset !important;
  80. }
  81.  
  82. /* style our own ui */
  83. .test-container {
  84. display: flex !important;
  85. flex-direction: row !important;
  86. }
  87. .test-container > :last-child {
  88. flex-grow: 1 !important;
  89. }
  90.  
  91. .x-test-info {
  92. background: white;
  93. border-radius: 1rem;
  94. max-width: 20vw;
  95. min-width: 200px;
  96. margin: 1rem;
  97. padding: 1rem;
  98. box-shadow: 0 0 .5rem rgba(0,0,0,.5);
  99. overflow: hidden;
  100. position: absolute;
  101. z-index: 999;
  102. height: 100%;
  103. transition: transform 1s, opacity .5s;
  104. transform: translateZ(1px);
  105. }
  106.  
  107. .x-test-info:not(:hover) {
  108. transform: rotate(5deg) translateX(-100%) translateX(-10px) scaleY(.95) skewX(-1deg) skewY(-1deg) translateZ(1px);
  109. opacity: .6;
  110. }
  111.  
  112. .dyslexia .x-test-info {
  113. background: #fafac8;
  114. }
  115.  
  116. .x-test-name {
  117. margin: -1rem;
  118. margin-bottom: 1rem;
  119. padding: 1rem;
  120. background: #40596b;
  121. color: white;
  122. }
  123.  
  124. .dyslexia .x-test-name {
  125. background: #dadaa8;
  126. color: black;
  127. }
  128.  
  129. .x-button-container {
  130. display: flex;
  131. flex-direction: column;
  132. gap: .5rem;
  133. }
  134.  
  135. .x-button {
  136. display: block;
  137. appearance: button;
  138. text-decoration: none;
  139. text-align: center;
  140. background-color: #f7cdcd;
  141. padding: 1rem 2rem;
  142. color: black;
  143. border-radius: .33rem;
  144. font-size: 1.5rem;
  145. }
  146.  
  147. .x-button:hover {
  148. text-decoration: inherit;
  149. color: inherit;
  150. }
  151.  
  152. .dyslexia .x-button {
  153. background: #dadaa8;
  154. }
  155. `;
  156.  
  157. //use layer if possible on newer browsers to override important
  158. styleCss = `
  159. ${ styleCss }
  160. @layer { ${styleCss} }
  161. `;
  162.  
  163. //add css to page, using GM_addStyle if possible
  164. if (window.GM_addStyle) {
  165. window.GM_addStyle(styleCss);
  166. } else {
  167. const styleElement = document.createElement("style");
  168. styleElement.innerHTML = styleCss;
  169. document.querySelector("head").append(styleElement);
  170. }
  171. }
  172.  
  173. async function main() {
  174. applyStyles();
  175. loadSessionInfo().then(() => {
  176. displayUi();
  177. });
  178. }
  179.  
  180. main();