Edge-nuity Megascript

Completes through instructional, summary, and warm-up sections by guessing answers (they don’t impact grades). You can begin activities while the instructor is speaking, when theres an activity, a "Search clipboard" button appears for quick access to answers during quizzes (will search your copied text on brainly and auto-redirect) And much more (read desc).

  1. // ==UserScript==
  2. // @name Edge-nuity Megascript
  3. // @version 2.3
  4. // @description Completes through instructional, summary, and warm-up sections by guessing answers (they don’t impact grades). You can begin activities while the instructor is speaking, when theres an activity, a "Search clipboard" button appears for quick access to answers during quizzes (will search your copied text on brainly and auto-redirect) And much more (read desc).
  5. // @author TTT
  6. // @license MIT
  7. // @include *://*nuity.com*/*
  8. // @include https://brainly.com/*
  9. // @grant none
  10. // @namespace https://www.tampermonkey.net/
  11. // ==/UserScript==
  12. function redirectToStudent() {
  13. const currentHref = window.location.href;
  14. const newHref = currentHref.replace("core.learn", "student");
  15. window.location.href = newHref;
  16. }
  17. if (window.location.href.includes("core.learn") && window.location.href.includes("/EdgeAuth/lti/goodbye")) {
  18. setInterval(redirectToStudent, 1000);
  19. }
  20. function clickVisibleElementWithClass() {
  21. const elements = document.getElementsByClassName('btn btn-primary modal-dialog-button');
  22. for (let i = 0; i < elements.length; i++) {
  23. const targetElement = elements[i];
  24. const computedStyle = window.getComputedStyle(targetElement);
  25. const boundingRect = targetElement.getBoundingClientRect();
  26. const isVisible =
  27. computedStyle.opacity !== '0' &&
  28. computedStyle.visibility !== 'hidden' &&
  29. computedStyle.display !== 'none' &&
  30. boundingRect.width > 0 &&
  31. boundingRect.height > 0;
  32. if (isVisible) {
  33. const simulatedClickEvent = new MouseEvent('click', {
  34. view: window,
  35. bubbles: true,
  36. cancelable: true
  37. });
  38. targetElement.dispatchEvent(simulatedClickEvent);
  39. console.log('Clicked a visible button!');
  40. addBeforeUnloadListener();
  41. break;
  42. }
  43. }
  44. }
  45. setInterval(clickVisibleElementWithClass, 1000);
  46. const checkElementVisibility = (element) => {
  47. const boundingRect = element.getBoundingClientRect();
  48. const computedStyle = window.getComputedStyle(element);
  49. return (
  50. computedStyle.opacity !== '0' &&
  51. computedStyle.visibility !== 'hidden' &&
  52. computedStyle.display !== 'none' &&
  53. boundingRect.width > 0 &&
  54. boundingRect.height > 0
  55. );
  56. };
  57. const checkForTimerStayElement = () => {
  58. const targetElement = document.getElementById('timerStay');
  59. if (targetElement && checkElementVisibility(targetElement)) {
  60. const simulatedClickEvent = new MouseEvent('click', {
  61. view: window,
  62. bubbles: true,
  63. cancelable: true
  64. });
  65. targetElement.dispatchEvent(simulatedClickEvent);
  66. console.log('Clicked timerStay element!');
  67. addBeforeUnloadListener();
  68. }
  69. };
  70. if (window.top === window.self) {
  71. const intervalId = setInterval(checkForTimerStayElement, 100);
  72. }
  73. const addBeforeUnloadListener = () => {
  74. window.onbeforeunload = function (event) {
  75. const message = 'Are you sure you want to leave this page?';
  76. event.returnValue = message;
  77. return message;
  78. };
  79. };
  80. let videoElement = null;
  81. let alertTriggered = false;
  82. let alertScheduled = false;
  83. const callback = function(mutationsList, observer) {
  84. for (const mutation of mutationsList) {
  85. if (mutation.type === 'childList') {
  86. videoElement = document.getElementById("home_video_js");
  87. if (videoElement) {
  88. startCheckingVideo();
  89. observer.disconnect();
  90. }
  91. }
  92. }
  93. };
  94. const config = {
  95. attributes: false,
  96. childList: true,
  97. subtree: true
  98. };
  99. const targetNode = document.body;
  100. const observer = new MutationObserver(callback);
  101. observer.observe(targetNode, config);
  102. function insertDiv() {
  103. let logoImage = document.querySelector('img.course-logo-bug[src="/images/logobug-edge-ex.png"][alt="Edge EX"]');
  104. if (logoImage && !document.getElementById('testDiv')) {
  105. const testDiv = document.createElement('div');
  106. testDiv.id = 'testDiv';
  107. testDiv.style.fontFamily = 'Atkinson Hyperlegible';
  108. testDiv.style.color = 'black';
  109. testDiv.style.margin = '10px';
  110. testDiv.style.width = 'calc(100% - 20px)';
  111. testDiv.style.maxWidth = '999px';
  112. testDiv.style.marginLeft = 'auto';
  113. testDiv.style.marginRight = 'auto';
  114. testDiv.style.position = 'fixed';
  115. testDiv.style.top = '50%';
  116. testDiv.style.left = '50%';
  117. testDiv.style.transform = 'translate(-50%, -50%)';
  118. testDiv.style.backgroundColor = 'aqua';
  119. testDiv.style.padding = '10px';
  120. testDiv.style.borderRadius = '5px';
  121. testDiv.style.zIndex = '2147483647';
  122. const firstItemContainer = document.createElement('div');
  123. const textSpan = document.createElement('span');
  124. textSpan.style.display = 'inline';
  125. textSpan.textContent = "Sadly, the script you downloaded (Edge-nuity Megascript) Does not support Edge-x classes, which you have one or more of. (Each marked by):";
  126. firstItemContainer.appendChild(textSpan);
  127. const imageContainer = document.createElement('span');
  128. imageContainer.style.display = 'inline';
  129. imageContainer.style.marginLeft = '10px';
  130. const imgElement1 = document.createElement('img');
  131. imgElement1.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAMAAAApWqozAAACSVBMVEUAAAAAAAAAAIAAAIAAAGYAAHEAAIAAAHQAAHcAAIAAAHkAAIAAAHkAAIAAAHoAAIAAAIAAAHsAAIAAAHsAAIAAAHwAAHwAAHkAAHwAAHkAAH0AAHoAAHoAAH0AAHsAAH0AAH0AAHsAAHsAAHwAAHoAAHsAAHwAAHsAAH0AAH0AAHsAAHwAAH0AAHsAAHwAAHwAAHwAAH0AAH0AAHwAAHsAAHwAAHsAAHwAAHwAAHwAAHwAAHwAAH0AAHwAAHsAAHwAAHwAAHsAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAH0AAHsAAHwAAHsAAHwAAHsAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwAAHwCAn0DA34EBH4FBX8GBn8NDYMQEIQREYUSEoUXF4gYGIgZGYkaGokhIY0jI44qKpIxMZU1NZc4OJk5OZk6Opo7O5o8PJs9PZtAQJ1DQ55ERJ9GRqBHR6BJSaFKSqJMTKNSUqZVVaheXqxmZrBnZ7FoaLFqarJsbLN3d7l6ert8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qlqWGkb2ja/KJqyKwbFmXEUlDG0YlTEuNNNNh/Z1K0M41d9QQAAAAASUVORK5CYII=';
  132. imgElement1.alt = 'Embedded Image';
  133. imgElement1.style.maxHeight = '50px';
  134. imageContainer.appendChild(imgElement1);
  135. firstItemContainer.appendChild(imageContainer);
  136. testDiv.appendChild(firstItemContainer);
  137. const additionalInfoDiv = document.createElement('div');
  138. additionalInfoDiv.style.marginTop = '10px';
  139. additionalInfoDiv.textContent = "However, I'm gonna work on adding it as soon as possible, join ";
  140. const link = document.createElement('a');
  141. link.href = "https://discord.gg/6qJwkYSmrQ";
  142. link.target = "_blank";
  143. link.style.color = 'blue';
  144. link.style.textDecoration = 'underline';
  145. link.textContent = "HERE";
  146. additionalInfoDiv.appendChild(link);
  147. additionalInfoDiv.append(" and ping me \"@TallTacoTristan\" in any chat if you want to volunteer your own class, which I will complete for you in return.");
  148. testDiv.appendChild(additionalInfoDiv);
  149. const line3Div = document.createElement('div');
  150. line3Div.style.marginTop = '10px';
  151. line3Div.textContent = "If not, simply note: only normal classes are supported, any normal class is marked by:";
  152. const imageContainer2 = document.createElement('span');
  153. imageContainer2.style.display = 'inline';
  154. imageContainer2.style.marginLeft = '10px';
  155. const imgElement2 = document.createElement('img');
  156. imgElement2.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAGYNAABl0QFoooEwAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAIABJREFUeJzt3Xl4VOXB/vHvmZmEyL6JgiCggCjiRq0FJBYUFyrqq6AWX7fWUpe6tPqqSPAdSQL+rK0L1rbU/rSKIq5VlCK4QAKIUlQUFNACIqJBlkjYQmbmvH8kQZasM2fmOcv9uS4uJJlzzm1Cbp5z5pznsRA5wMgw9DkM4l3Bbge0A9qD1X6vP7cDcsBuU7mNlQ00q9pBMyC76r+3VP1eAfa2qtduB8rB3gTWJqDql7UJEpsgvBEqvoZdq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TG8IXwNcDnQwnUYOUAHWDLAfgxX/gufjpgMFlQrLVUaGoVd/CI0E+1JUXibFgYXA8xCZCtENpgOJCsvF9imvnwMHm04UAAngXSpLahpEvzUdSPalwvKEaDYkBleuP8fZYPcynchHSoE3gZmQeA0mlJgOJLVTYXlSXnewhgJngH0W0NJ0Im+xPgV7OvAmRIqCvKiD16iwPO/GJtBqINinAgPA6o8KbG9x4GOw50NoPsTf0SjKu1RYvjMyDD37QGgQ0J/KNRe7Gw6VSVvBfg+sBZUFtWsh3FdmOpQ4Q4UVCNGWEO8J9AH6Vc1RfwLQ3myulMTAXlt5esdisJdB6FMIfwZRTS/sUyqs4LIgrxuEekGiG5WjsG57/XLDNDk7gNVgrYFE1e/2GgitgtJPYVK52XiSaSosqUW0KZR3g0g7sNsBVb+HDv7hzzSt+tWkchu7akodKwc4CIiDvbXqYzuA6oLZAsSATWBtgkTV79YmsDdCYiNkr9e9TyIiIiIi6fZ/tyEb8N5jlqcAAAAASUVORK5CYII=';
  157. imgElement2.alt = 'Courseware Image';
  158. imgElement2.style.maxHeight = '50px';
  159. imageContainer2.appendChild(imgElement2);
  160. line3Div.appendChild(imageContainer2);
  161. testDiv.appendChild(line3Div);
  162. document.body.appendChild(testDiv);
  163. }
  164. }
  165. setInterval(function () {
  166. if (window.location.href.includes("student.") && window.location.href.includes(".com/")) {
  167. insertDiv();
  168. }
  169. }, 1000);
  170. function startCheckingVideo() {
  171. setInterval(() => {
  172. if (videoElement) {
  173. const currentTime = videoElement.currentTime;
  174. const duration = videoElement.duration;
  175. if (currentTime >= duration) {
  176. if (!alertScheduled) {
  177. alertScheduled = true;
  178. let checksCount = 0;
  179. let allChecksPassed = true;
  180. const intervalId = setInterval(() => {
  181. const homeVideoContainer = document.getElementById("home_video_container");
  182. if (homeVideoContainer && homeVideoContainer.parentNode.style.opacity == 1) {
  183. checksCount++;
  184. } else {
  185. allChecksPassed = false;
  186. }
  187. if (checksCount === 10) {
  188. clearInterval(intervalId);
  189. if (allChecksPassed) {
  190. new Notification("Reload!");
  191. alertTriggered = true;
  192. }
  193. alertScheduled = false;
  194. }
  195. }, 100);
  196. }
  197. } else {
  198. alertTriggered = false;
  199. }
  200. }
  201. }, 550);
  202. }
  203. (function() {
  204. 'use strict';
  205. let completeCount = 0;
  206. const originalConsoleLog = console.log;
  207. console.log = function() {
  208. const message = Array.from(arguments).join(' ');
  209. if (message.includes('complete')) {
  210. completeCount++;
  211. if (completeCount === 2) {
  212. const goRightButton = document.querySelector('li.FrameRight a');
  213. if (goRightButton) {
  214. goRightButton.click();
  215. completeCount = 0;
  216. }
  217. }
  218. }
  219. originalConsoleLog.apply(console, arguments);
  220. };
  221. })();
  222. function checkAutoplay() {
  223. const autoplayCheckbox = document.getElementById('autoplayCheckbox');
  224. // Check if the checkbox exists before accessing its properties
  225. if (autoplayCheckbox && autoplayCheckbox.checked) {
  226. playVideo();
  227. }
  228. }
  229. if (window.top === window.self && window.location.href.includes('core.learn')) {
  230. setInterval(checkAutoplay, 1000);
  231. }
  232. function playVideo() {
  233. var playButton = window.frames[0].document.getElementById("uid1_play");
  234. if (playButton != undefined) {
  235. setTimeout(function() {
  236. if (playButton.className == "play") {
  237. playButton.children[0].click();
  238. }
  239. }, 1000);
  240. }
  241. }
  242. function showColumn() {
  243. try {
  244. window.frames[0].frames[0].document.getElementsByClassName("right-column")[0].children[0].style.display = "block";
  245. } catch (TypeError) {}
  246. try {
  247. window.frames[0].frames[0].document.getElementsByClassName("left-column")[0].children[0].style.display = "block";
  248. } catch (TypeError) {}
  249. }
  250. if (window.top === window.self) {
  251. setInterval(showColumn, 1000);}
  252. function clearLocalStorage() {
  253. try {
  254. localStorage.clear();
  255. } catch (error) {}
  256. }
  257. function removeElementsByClassName(className) {
  258. var elements = document.getElementsByClassName(className);
  259. Array.prototype.forEach.call(elements, function(element) {
  260. try {
  261. element.parentNode.removeChild(element);
  262. } catch (error) {}
  263. });
  264. }
  265. function handleOnload() {
  266. var classNamesToRemove = [
  267. "brn-expanded-bottom-banner",
  268. "brn-brainly-plus-box",
  269. "brn-fullscreen-toplayer",
  270. "sg-overlay sg-overlay--dark"
  271. ];
  272. classNamesToRemove.forEach(function(className) {
  273. removeElementsByClassName(className);
  274. });
  275. }
  276. if (window.location.href.includes("brainly.com")) {
  277. clearLocalStorage();
  278. handleOnload();
  279. }
  280. function redirectToFirstSearchItem() {
  281. if (window.location.href.startsWith('https://brainly.com/app/ask')) {
  282. const searchItem = document.querySelector('[data-testid="search-item-facade-wrapper"]');
  283. if (searchItem) {
  284. const anchorElement = searchItem.querySelector('a');
  285. if (anchorElement) {
  286. const href = anchorElement.getAttribute('href');
  287. const fullUrl = `https://brainly.com${href}`;
  288. window.location.href = fullUrl;
  289. clearInterval(interval);
  290. }
  291. }
  292. }
  293. }
  294. const interval = setInterval(redirectToFirstSearchItem, 1000);
  295. function checkElement() {
  296. const element = document.querySelector('[data-testid="answer_box"][data-test="locked_answer"]');
  297. if (element && document.location.href.includes("brainly.com/question")) {
  298. location.reload();
  299. }
  300. }if (window.top === window.self) {
  301. setInterval(checkElement, 750);}
  302. function extractTextFromIframe() {
  303. var iframeDocument = window.frames[0].document;
  304.  
  305. var targetElements = iframeDocument.getElementsByClassName("Assessment_Main_Body_Content_Question");
  306.  
  307. var visibleElements = Array.from(targetElements).filter(function(element) {
  308. return element.style.display !== "none" && element.id.includes("q_");
  309. });
  310.  
  311. if (visibleElements.length > 0) {
  312. var finalTextOutput = [];
  313.  
  314. var regex = />([^<]+)</g;
  315. var regexSpecial = /»([^«]+)«/g;
  316. var regexCleanUp = /[\n\r]+|<[^>]*>| | /g;
  317.  
  318. visibleElements.forEach(function(targetElement) {
  319. var elementText = "";
  320.  
  321. let matches;
  322. while ((matches = regex.exec(targetElement.innerHTML)) !== null) {
  323. var extractedText = matches[1].trim();
  324. if (extractedText && !/(class|src|align|style)=/i.test(extractedText)) {
  325. elementText += extractedText + " ";
  326. }
  327. }
  328.  
  329. while ((matches = regexSpecial.exec(targetElement.innerHTML)) !== null) {
  330. var extractedText = matches[1].trim();
  331. if (extractedText && !/(class|src|align|style)=/i.test(extractedText)) {
  332. elementText += extractedText + " ";
  333. }
  334. }
  335.  
  336. var imgElements = targetElement.getElementsByTagName("img");
  337. Array.from(imgElements).forEach(function(img) {
  338. if (img.alt) {
  339. elementText += img.alt.trim() + " ";
  340. }
  341. });
  342.  
  343. elementText = elementText.replace(regexCleanUp, ' ').trim();
  344. elementText = elementText.replace(/\u00A0/g, ' ');
  345.  
  346. if (elementText) {
  347. finalTextOutput.push(elementText);
  348. }
  349. });
  350.  
  351. // Using the Clipboard API to copy text
  352. const textToCopy = finalTextOutput.join("\n").replace(/\s+/g, ' ');
  353.  
  354. navigator.clipboard.writeText(textToCopy)
  355. .then(() => {
  356. console.log('Text copied to clipboard');
  357.  
  358. // Optional: Trigger the search clipboard button if it exists
  359. setTimeout(function() {
  360. var buttons = Array.from(document.getElementsByTagName('button'));
  361. var searchClipboardButton = buttons.find(button => button.innerText === "Search Clipboard");
  362. if (searchClipboardButton) {
  363. searchClipboardButton.click();
  364. } else {
  365. alert("Make sure the Search Clipboard button is checked in the options pane.");
  366. }
  367. }, 101);
  368. })
  369. .catch(err => {
  370. console.error('Failed to copy: ', err);
  371. });
  372. }
  373. }
  374. const activityTitleElement = document.getElementById("activity-title");
  375. if (activityTitleElement) {
  376. const activityTitleText = activityTitleElement.textContent || activityTitleElement.innerText;
  377. function handleAssessment() {
  378. setTimeout(() => {
  379. extractTextFromIframe();
  380. }, 250);
  381. const iframe = window.frames[0];
  382. const iframeDocument = iframe.document;
  383. const targetElements = iframeDocument.getElementsByClassName("Assessment_Main_Body_Content_Question");
  384. const visibleElements = Array.from(targetElements).filter(function(element) {
  385. return element.style.display !== "none" && element.id.includes("q_");
  386. });
  387. }
  388. function handleAssignment() {
  389. const nestedIframeDocument = window.frames[0].frames[0].document;
  390. const contentElements = nestedIframeDocument.getElementsByClassName("content");
  391. const altElements = nestedIframeDocument.querySelectorAll('[alt]');
  392. let contentText = '';
  393. if (contentElements.length > 0) {
  394. contentText = Array.from(contentElements)
  395. .map(element => element.innerText)
  396. .join('\n');
  397. }
  398. const altValues = Array.from(altElements)
  399. .map(element => element.getAttribute('alt'))
  400. .join('\n');
  401. const combinedText = contentText + (contentText && altValues ? '\n' : '') + altValues;
  402. if (combinedText) {
  403. navigator.clipboard.writeText(combinedText)
  404. .then(() => {
  405. console.log('Content copied to clipboard!');
  406. setTimeout(() => {
  407. clickSearchClipboard();
  408. }, 100);
  409. });
  410. }
  411. }
  412. document.addEventListener('keydown', function(event) {
  413. if (event.key === '3') {
  414. if (activityTitleText.includes("Test") || activityTitleText.includes("Exam") || activityTitleText.includes("Quiz")) {
  415. handleAssessment();
  416. } else if (activityTitleText.includes("Assignment")) {
  417. handleAssignment();
  418. }
  419. }
  420. });
  421. }
  422. function clickSearchClipboard() {
  423. const buttons = Array.from(document.querySelectorAll('button'));
  424. const buttonToClick = buttons.find(button => button.innerText === 'Search Clipboard');
  425. if (buttonToClick) {
  426. buttonToClick.click();
  427. } else {
  428. alert("Make sure the Search Clipboard button is checked in the options pane.");
  429. }
  430. }
  431. function addKeyListener() {
  432. const frame = window.frames[0];
  433. const initialButtonCheck = document.getElementById('searchActionButton');
  434. if (!window.location.href.includes("nuity")) {
  435. return;
  436. }
  437. if (frame && !frame.keyListenerAdded) {
  438. frame.keyListenerAdded = true;
  439. frame.document.addEventListener('keydown', function(event) {
  440. if (event.key === '3') {
  441. const activityTitleText = document.getElementById('activity-title')?.textContent || '';
  442. if (activityTitleText.includes("Assignment")) {
  443. handleAssignment();
  444. }
  445. if (activityTitleText.includes("Test") || activityTitleText.includes("Exam") || activityTitleText.includes("Quiz")) {
  446. handleAssessment();
  447. }
  448. if (initialButtonCheck) {
  449. initialButtonCheck.click();
  450. }
  451. }
  452. });
  453. }
  454. }
  455. if (window.location.href.includes('core.learn')) {
  456. setInterval(addKeyListener, 1000);
  457. }
  458. function checkForButton() {
  459. const iframeDocument = window.frames[0].document;
  460. const audioEntryButton = iframeDocument.getElementById('btnEntryAudio');
  461. if (audioEntryButton) {
  462. const existingButton = iframeDocument.getElementById('searchActionButton');
  463. if (!existingButton) {
  464. const searchActionButton = iframeDocument.createElement('button');
  465. searchActionButton.innerText = "Search question";
  466. searchActionButton.id = "searchActionButton";
  467. searchActionButton.style.webkitTextSizeAdjust = "100%";
  468. searchActionButton.style.borderSpacing = "0";
  469. searchActionButton.style.borderCollapse = "collapse";
  470. searchActionButton.style.fontFamily = '"Helvetica Neue", Helvetica, Arial, sans-serif';
  471. searchActionButton.style.display = "inline-block";
  472. searchActionButton.style.boxSizing = "border-box";
  473. searchActionButton.style.height = "28px";
  474. searchActionButton.style.border = "1px solid #8d8e8f";
  475. searchActionButton.style.color = "#ffffff";
  476. searchActionButton.style.fontSize = "13px";
  477. searchActionButton.style.lineHeight = "28px";
  478. searchActionButton.style.fontWeight = "bold";
  479. searchActionButton.style.textDecoration = "none";
  480. searchActionButton.style.webkitFontSmoothing = "antialiased";
  481. searchActionButton.style.whiteSpace = "nowrap";
  482. searchActionButton.style.textShadow = "0 0 5px rgba(255, 255, 255, 0.6)";
  483. searchActionButton.style.zoom = "1";
  484. searchActionButton.style.webkitBorderRadius = "3px";
  485. searchActionButton.style.backgroundColor = "#1a1a1a";
  486. searchActionButton.style.backgroundPosition = "center bottom";
  487. searchActionButton.style.backgroundSize = "100% 100%";
  488. searchActionButton.style.boxShadow = "inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1)";
  489. searchActionButton.style.cursor = "pointer";
  490. searchActionButton.style.userSelect = "none";
  491. searchActionButton.style.position = "relative";
  492. searchActionButton.style.padding = "0 40px";
  493. searchActionButton.style.textAlign = "center";
  494. searchActionButton.style.margin = "0 10px";
  495. audioEntryButton.parentElement.appendChild(searchActionButton);
  496. searchActionButton.style.position = "absolute";
  497. searchActionButton.style.left = "50%";
  498. searchActionButton.style.transform = "translateX(-50%)";
  499. const bottomTrayElements = iframeDocument.querySelectorAll('[class*="bottom-tray"]');
  500. bottomTrayElements.forEach(trayElement => {
  501. trayElement.style.position = 'relative';
  502. const buttonClone = searchActionButton.cloneNode(true);
  503. trayElement.appendChild(buttonClone);
  504. buttonClone.style.position = "absolute";
  505. buttonClone.style.left = "50%";
  506. buttonClone.style.transform = "translateX(-50%)";
  507. });
  508. }
  509. }
  510. }
  511. if (window.top === window.self && window.location.href.includes('core.learn')) {
  512. const buttonCheckInterval = setInterval(checkForButton, 500);
  513. }
  514. const observerConfig = {
  515. attributes: false,
  516. childList: true,
  517. subtree: true
  518. };
  519. const mutationCallback = function(mutations, observerInstance) {
  520. for (const mutation of mutations) {
  521. if (mutation.type === 'childList') {
  522. const detectedElements = document.querySelectorAll('.mark-return');
  523. if (detectedElements.length > 0) {
  524. appendSearchButton(detectedElements[0].parentNode);
  525. }
  526. }
  527. }
  528. };
  529. const appendSearchButton = function(parentContainer) {
  530. const existingButton = document.getElementById('uniqueSearchButtonId');
  531. if (existingButton) return;
  532. const searchActionButton = document.createElement('button');
  533. searchActionButton.innerText = "Search question";
  534. searchActionButton.id = "uniqueSearchButtonId";
  535. searchActionButton.style.webkitTextSizeAdjust = "100%";
  536. searchActionButton.style.borderSpacing = "0";
  537. searchActionButton.style.borderCollapse = "collapse";
  538. searchActionButton.style.fontFamily = '"Helvetica Neue", Helvetica, Arial, sans-serif';
  539. searchActionButton.style.display = "inline-block";
  540. searchActionButton.style.boxSizing = "border-box";
  541. searchActionButton.style.height = "28px";
  542. searchActionButton.style.border = "1px solid #8d8e8f";
  543. searchActionButton.style.color = "#ffffff";
  544. searchActionButton.style.fontSize = "13px";
  545. searchActionButton.style.lineHeight = "28px";
  546. searchActionButton.style.fontWeight = "bold";
  547. searchActionButton.style.textDecoration = "none";
  548. searchActionButton.style.webkitFontSmoothing = "antialiased";
  549. searchActionButton.style.whiteSpace = "nowrap";
  550. searchActionButton.style.textShadow = "0 0 5px rgba(255, 255, 255, 0.6)";
  551. searchActionButton.style.zoom = "1";
  552. searchActionButton.style.webkitBorderRadius = "3px";
  553. searchActionButton.style.backgroundColor = "#1a1a1a";
  554. searchActionButton.style.backgroundPosition = "center bottom";
  555. searchActionButton.style.backgroundSize = "100% 100%";
  556. searchActionButton.style.boxShadow = "inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 0 rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1)";
  557. searchActionButton.style.cursor = "pointer";
  558. searchActionButton.style.userSelect = "none";
  559. searchActionButton.style.position = "absolute";
  560. searchActionButton.style.left = "35%";
  561. searchActionButton.style.top = "50%";
  562. searchActionButton.style.transform = "translate(-70%, -50%)";
  563. parentContainer.style.position = "relative";
  564. parentContainer.appendChild(searchActionButton);
  565. };
  566. const targetElement = document.body;
  567. const observerInstance = new MutationObserver(mutationCallback);
  568. observerInstance.observe(targetElement, observerConfig);
  569. (function() {
  570. function checkAndAddListener() {
  571. const frame = window.frames[0];
  572. if (frame && frame.document) {
  573. const button = frame.document.getElementById("searchActionButton");
  574. if (button) {
  575. if (!button.dataset.listenerAdded) {
  576. button.addEventListener('click', handleAssignment);
  577. button.dataset.listenerAdded = true;
  578. console.log("Listener added to the button within the iframe.");
  579. }
  580. }
  581. }
  582. }
  583. if (window.top === window.self && window.location.href.includes('core.learn')) {
  584. setInterval(checkAndAddListener, 500);}
  585. })();
  586. if (window.top === window.self) {
  587. function monitorFrameForButton() {
  588. const frame = window.frames[0];
  589. const checkInterval = setInterval(() => {
  590. if (frame && frame.document) {
  591. const button = frame.document.getElementById('uniqueSearchButtonId');
  592. if (button) {
  593. if (!frame.hasListenerAdded) {
  594. button.addEventListener('click', handleAssessment);
  595. frame.hasListenerAdded = true;
  596. console.log('Listener added to the button.');
  597. clearInterval(checkInterval);
  598. }
  599. }
  600. }
  601. }, 100);
  602. }
  603. monitorFrameForButton();
  604. }
  605. let buttonsClicked = false;
  606. function updateTextareaAndClickButtonsOnce() {
  607. try {
  608. const frame = window.frames[0];
  609. const innerFrame = frame ? frame.frames[0] : null;
  610. if (innerFrame) {
  611. const iframeDoc = innerFrame.document;
  612. if (iframeDoc.readyState === 'complete') {
  613. const textarea = iframeDoc.querySelector('.QuestionTextArea');
  614. // Check if textarea is empty before updating
  615. if (textarea && textarea.value.trim() === '') {
  616. const answerChoices = iframeDoc.querySelectorAll('.answer-choice-label');
  617. let allText = '';
  618. answerChoices.forEach(choice => {
  619. allText += choice.textContent.trim() + '\n';
  620. });
  621. // Update the textarea
  622. textarea.value = allText.trim();
  623. // Call the API check after 1 second
  624. setTimeout(() => {
  625. window.frames[0].API.Frame.check();
  626. }, 1000);
  627. const buttons = iframeDoc.querySelectorAll('.answer-choice-button');
  628. buttons.forEach(button => {
  629. if (button) {
  630. button.click();
  631. }
  632. });
  633. const doneButtons = iframeDoc.querySelectorAll('.done-start');
  634. setTimeout(() => {
  635. doneButtons.forEach(doneButton => {
  636. if (doneButton) {
  637. doneButton.click();
  638. }
  639. });
  640. const retryButtons = iframeDoc.querySelectorAll('.done-retry');
  641. setTimeout(() => {
  642. retryButtons.forEach(retryButton => {
  643. if (retryButton) {
  644. retryButton.click();
  645. }
  646. });
  647. }, 400);
  648. }, 200);
  649. }
  650. }
  651. }
  652. } catch (error) {
  653. console.error("An error occurred:", error); // Optional: Log the error to the console
  654. }
  655. }
  656. function checkUpdateTextareaAndClickButtonsOnce() {
  657. const isAutoWritingChecked = document.getElementById('autoWritingCheckbox').checked;
  658. if (isAutoWritingChecked) {
  659. updateTextareaAndClickButtonsOnce();
  660. }
  661. }
  662. if (window.top === window.self && window.location.href.includes('core.learn')) {
  663. setInterval(checkUpdateTextareaAndClickButtonsOnce, 1000);
  664. }
  665. function checkOpacity() {
  666. if (frames[0] && frames[0].document) {
  667. var homeVideoContainer = frames[0].document.getElementById("home_video_container");
  668. if (homeVideoContainer && homeVideoContainer.parentNode.style.opacity == 1) {
  669. } else {
  670. try {
  671. if (document.getElementById("activity-title").innerText == "Assignment") {}
  672. if (["Instruction", "Summary", "Warm-Up"].includes(document.getElementById("activity-title").innerText)) {
  673. try {
  674. window.options = window.frames[0].frames[0].document.getElementsByClassName("answer-choice-button");
  675. window.options[Math.floor(Math.random() * window.options.length)].click();
  676. } catch (TypeError) {}
  677. try {
  678. window.frames[0].API.Frame.check();
  679. } catch (TypeError) {}
  680. }
  681. } catch (TypeError) {}
  682. }
  683. }
  684. }
  685. function checkcheckOpacity() {
  686. const isGuessingChecked = document.getElementById('guessingCheckbox').checked;
  687. if (isGuessingChecked) {
  688. checkOpacity();
  689. }
  690. }
  691. if (window.top === window.self && window.location.href.includes('core.learn')) {
  692. setInterval(checkcheckOpacity, 1000);
  693. }
  694. function clickOnFootnavWhenGradebarVisible() {
  695. // Function to check if an element is visible
  696. function isElementVisible(element) {
  697. return !!(element && element.offsetWidth && element.offsetHeight);
  698. }
  699.  
  700. // Select the gradebar element
  701. var gradeBar = document.querySelector('.gradebar');
  702.  
  703. // Check if gradeBar is visible and its innerText includes "completed"
  704. if (isElementVisible(gradeBar) && gradeBar.innerText.includes('completed')) {
  705. // Select the element to click
  706. var footNav = document.querySelector('.footnav.goRight');
  707.  
  708. // Check if the footNav element exists
  709. if (footNav) {
  710. footNav.click(); // Simulate a click on the footNav element
  711. }
  712. }
  713. }
  714.  
  715. function clickOnFootnavWhenGradebarVisible() {
  716. // Function to check if an element is visible
  717. function isElementVisible(element) {
  718. return !!(element && element.offsetWidth && element.offsetHeight);
  719. }
  720.  
  721. // Select the gradebar element
  722. var gradeBar = document.querySelector('.gradebar');
  723.  
  724. // Check if gradeBar is visible and its innerText includes "completed"
  725. if (isElementVisible(gradeBar) && gradeBar.innerText.includes('completed')) {
  726. // Select the element to click
  727. var footNav = document.querySelector('.footnav.goRight');
  728.  
  729. // Check if the footNav element exists
  730. if (footNav) {
  731. footNav.click(); // Simulate a click on the footNav element
  732. }
  733. }
  734. }
  735.  
  736. setInterval(function() {
  737. const autoAdvanceCheckbox = document.getElementById('autoAdvanceCheckbox'); // Check for checkbox existence
  738. if (autoAdvanceCheckbox && autoAdvanceCheckbox.checked) { // Only proceed if checkbox exists and is checked
  739. if (frames[0] && frames[0].document) { // Check if frames[0] and its document exist
  740. const homeVideoContainer = frames[0].document.getElementById("home_video_container"); // Access the home video container
  741. if (homeVideoContainer && homeVideoContainer.parentNode && homeVideoContainer.parentNode.style.opacity == 1) {
  742. // Do nothing if the container is visible
  743. } else {
  744. // Call the function to click foot navigation and go to the next frame
  745. clickFootnavAndNextFrame();
  746. clickOnFootnavWhenGradebarVisible();
  747. }
  748. }
  749. }
  750. }, 1000); // Executes every 1000 milliseconds (1 second)
  751. setInterval(function() {
  752. var element = document.getElementById("invis-o-div");
  753. if (element) {
  754. element.remove();
  755. }
  756. }, 1000);
  757. if (window.top === window.self && window.location.href.includes('core.learn')) {
  758. setInterval(() => {
  759. const checkBox = document.getElementById('autoShowCheckbox'); // Check for existence in each interval.
  760. if (checkBox && checkBox.checked) { // Use the presence check before accessing 'checked'.
  761. updateDisplay();
  762. clickShowButtons();
  763. }
  764. }, 1000);
  765. }
  766. function updateDisplay() {
  767. const outerFrame = window.frames[0];
  768. if (outerFrame && outerFrame.frames && outerFrame.frames[0]) {
  769. const elements = outerFrame.frames[0].document.getElementsByClassName("uibtn mathButton");
  770. for (let i = 0; i < elements.length; i++) {
  771. if (elements[i].innerText.includes("Show")) {
  772. elements[i].style.display = "block";
  773. }
  774. }
  775. }
  776. }
  777. function clickShowButtons() {
  778. const outerFrame = window.frames[0];
  779. if (outerFrame && outerFrame.frames && outerFrame.frames[0]) {
  780. const elements = outerFrame.frames[0].document.getElementsByClassName("uibtn mathButton");
  781. for (let i = 0; i < elements.length; i++) {
  782. if (elements[i].innerText.includes("Show")) {
  783. elements[i].click();
  784. }
  785. }
  786. }
  787. }
  788. function clickFootnavAndNextFrame() {
  789. try {
  790. document.getElementsByClassName("footnav goRight")[0].click();
  791. } catch (TypeError) {}
  792. try {
  793. window.frames[0].API.FrameChain.nextFrame();
  794. } catch (TypeError) {}
  795. }
  796. var clipboardButton;
  797. function createClipboardSearchButton() {
  798. try {
  799. var iframe = document.querySelector("iframe");
  800. if (iframe) {
  801. var rect = iframe.getBoundingClientRect();
  802. var iframeTop = rect.top + window.scrollY;
  803. var iframeRight = rect.right + window.scrollX;
  804. var buttonContainer = document.createElement('div');
  805. buttonContainer.style.position = 'fixed';
  806. buttonContainer.style.top = (iframeTop + 10) + 'px';
  807. buttonContainer.style.left = (iframeRight - 150) + 'px';
  808. buttonContainer.style.zIndex = '9999';
  809. document.body.appendChild(buttonContainer);
  810. clipboardButton = document.createElement('button');
  811. clipboardButton.innerText = 'Search Clipboard';
  812. buttonContainer.appendChild(clipboardButton);
  813. }
  814. } catch (error) {
  815. console.error('Error accessing the first iframe:', error);
  816. }
  817. }
  818. function checkClipboardSearchButton() {
  819. const isClipboardChecked = document.getElementById('searchClipboardCheckbox').checked;
  820. if (isClipboardChecked) {
  821. if (!clipboardButton) {
  822. createClipboardSearchButton();
  823. }
  824. } else {
  825. if (clipboardButton) {
  826. clipboardButton.parentElement.removeChild(clipboardButton);
  827. clipboardButton = null;
  828. }
  829. }
  830. }
  831. if (window.top === window.self && window.location.href.includes('core.learn')) {
  832. setInterval(checkClipboardSearchButton, 1000);}
  833. document.addEventListener('click', function(event) {
  834. if (event.target.tagName === 'BUTTON' && event.target.innerText.includes('Clipboard')) {
  835. navigator.clipboard.readText().then(function(clipboardText) {
  836. if (clipboardText) {
  837. var isBrainlyChecked = document.getElementById('searchInBrainlyCheckbox').checked;
  838. var searchUrl = 'https://brainly.com/app/ask?entry=top&q=' + encodeURIComponent(clipboardText);
  839. if (isBrainlyChecked) {
  840. var brainlyIframe = document.getElementById('brainly-chat-iframe');
  841. if (brainlyIframe) {
  842. brainlyIframe.src = searchUrl;
  843. }
  844. } else {
  845. window.open(searchUrl, '_blank');
  846. }
  847. }
  848. }).catch(function(err) {
  849. console.error('Failed to read clipboard contents: ', err);
  850. });
  851. }
  852. });
  853. function addDeepaiIframes() {
  854. const wrapElement = document.getElementById('wrap');
  855. if (!document.getElementById('deepai-chat-iframe')) {
  856. const deepaiIframe = document.createElement('iframe');
  857. deepaiIframe.id = 'deepai-chat-iframe';
  858. deepaiIframe.src = 'https://deepai.org/chat';
  859. deepaiIframe.style.width = '25%';
  860. deepaiIframe.style.height = '100vh';
  861. deepaiIframe.style.border = 'none';
  862. deepaiIframe.style.position = 'absolute';
  863. deepaiIframe.style.top = '0';
  864. deepaiIframe.style.right = '0';
  865. deepaiIframe.style.zIndex = '20000';
  866. wrapElement.style.position = 'relative';
  867. deepaiIframe.style.opacity = '0';
  868. deepaiIframe.style.transition = 'opacity 0.5s';
  869. deepaiIframe.sandbox = 'allow-same-origin allow-scripts';
  870. document.body.appendChild(deepaiIframe);
  871. }
  872. }
  873. function addBrainlyIframes() {
  874. const wrapElement = document.getElementById('wrap');
  875. if (!document.getElementById('brainly-chat-iframe')) {
  876. const brainlyIframe = document.createElement('iframe');
  877. brainlyIframe.id = 'brainly-chat-iframe';
  878. brainlyIframe.src = 'https://brainly.com/search';
  879. brainlyIframe.style.width = '25%';
  880. brainlyIframe.style.height = '100vh';
  881. brainlyIframe.style.border = 'none';
  882. brainlyIframe.style.position = 'absolute';
  883. brainlyIframe.style.top = '0';
  884. brainlyIframe.style.left = '0';
  885. brainlyIframe.style.zIndex = '20000';
  886. wrapElement.style.position = 'relative';
  887. brainlyIframe.style.opacity = '0';
  888. brainlyIframe.style.transition = 'opacity 0.5s';
  889. brainlyIframe.sandbox = 'allow-same-origin allow-scripts';
  890. document.body.appendChild(brainlyIframe);
  891. }
  892. }
  893. addDeepaiIframes();
  894. addBrainlyIframes();
  895. function updateDeepaiIframeVisibility() {
  896. const deepaiIframe = document.getElementById('deepai-chat-iframe');
  897. const isAiChatChecked = document.getElementById('aiChatCheckbox').checked;
  898. if (deepaiIframe) {
  899. if (isAiChatChecked) {
  900. deepaiIframe.style.opacity = '1';
  901. deepaiIframe.style.display = 'block';
  902. } else {
  903. deepaiIframe.style.opacity = '0';
  904. setTimeout(() => deepaiIframe.style.display = 'none', 500);
  905. }
  906. }
  907. }
  908. function updateBrainlyIframeVisibility() {
  909. const brainlyIframe = document.getElementById('brainly-chat-iframe');
  910. const isBrainlyChecked = document.getElementById('searchInBrainlyCheckbox').checked;
  911. if (brainlyIframe) {
  912. if (isBrainlyChecked) {
  913. brainlyIframe.style.opacity = '1';
  914. brainlyIframe.style.display = 'block';
  915. } else {
  916. brainlyIframe.style.opacity = '0';
  917. setTimeout(() => brainlyIframe.style.display = 'none', 500);
  918. }
  919. }
  920. }
  921. if (window.top === window.self && window.location.href.includes('core.learn')) {
  922. setInterval(() => {
  923. updateDeepaiIframeVisibility();
  924. updateBrainlyIframeVisibility();
  925. }, 1000);
  926. }
  927. function createButtonAndPane() {
  928. if (document.querySelector('#tweaksButton')) return;
  929. const mainFootDiv = document.querySelector('.mainfoot');
  930. const toggleButton = document.createElement('button');
  931. toggleButton.id = 'tweaksButton';
  932. toggleButton.textContent = 'Toggle Options';
  933. toggleButton.style.border = "1px solid #5f5f5f";
  934. toggleButton.style.boxShadow = "inset 0 0 5px rgba(0, 0, 0, 0.6)";
  935. toggleButton.style.backgroundColor = "rgb(39, 39, 39)";
  936. toggleButton.style.color = "#f9a619";
  937. toggleButton.style.borderRadius = "3px";
  938. toggleButton.style.marginLeft = "40%";
  939. toggleButton.style.zIndex = "2";
  940. toggleButton.style.padding = '5px 10px';
  941. mainFootDiv.appendChild(toggleButton);
  942. if (!window.pane) {
  943. window.pane = document.createElement('div');
  944. window.pane.style.display = 'none';
  945. document.body.appendChild(window.pane);
  946. const popupMenu = document.createElement('div');
  947. popupMenu.className = 'popup-menu';
  948. const aiChatItem = createMenuItem('AI Chat', 'aiChatCheckbox');
  949. popupMenu.appendChild(aiChatItem);
  950. const searchInBrainlyItem = createMenuItem('Search in Brainly frame', 'searchInBrainlyCheckbox');
  951. popupMenu.appendChild(searchInBrainlyItem);
  952. const autoVocabItem = createMenuItem('Auto Vocab', 'autoVocabCheckbox');
  953. popupMenu.appendChild(autoVocabItem);
  954. const autoWritingItem = createMenuItem('Auto Writing', 'autoWritingCheckbox');
  955. popupMenu.appendChild(autoWritingItem);
  956. const autoplayItem = createMenuItem('Autoplay', 'autoplayCheckbox');
  957. popupMenu.appendChild(autoplayItem);
  958. const searchClipboardItem = createMenuItem('Search Clipboard Button', 'searchClipboardCheckbox');
  959. popupMenu.appendChild(searchClipboardItem);
  960. const guessingItem = createMenuItem('Guessing', 'guessingCheckbox');
  961. popupMenu.appendChild(guessingItem);
  962. // Add new menu items here
  963. const autoAdvanceItem = createMenuItem('AutoAdvance', 'autoAdvanceCheckbox');
  964. popupMenu.appendChild(autoAdvanceItem);
  965. // Add the new 'AutoShow' item
  966. const autoShowItem = createMenuItem('AutoShow', 'autoShowCheckbox');
  967. popupMenu.appendChild(autoShowItem);
  968. window.pane.appendChild(popupMenu);
  969. const footerText = document.createElement('div');
  970. footerText.style.marginTop = '20px';
  971. footerText.style.color = 'rgb(249, 166, 25)';
  972. footerText.style.textAlign = "center";
  973. footerText.textContent = "This was made by me, TallTacoTristan, as a way to make edge-nuity " +
  974. "classes MUCH easier and skip by the tedious bits but it took a long time, over " +
  975. "100 hours of just coding, to write over a thousand lines, it has many features, " +
  976. "the ones above are less than half, just the ones that need a toggle. " +
  977. "So please leave a good review on my page for all the time I spent to save yours, Thank you.";
  978. const discordMessage = document.createElement('div');
  979. discordMessage.textContent = "Join this discord if you have any issues, questions, or suggestions! Or simply to download the newest version which also includes a nicer gui, autoexam, autoassignment, and multitab, as well as more.";
  980. discordMessage.style.marginTop = '10px';
  981. const discordLink = document.createElement('a');
  982. discordLink.textContent = "https://discord.gg/6qJwkYSmrQ";
  983. discordLink.href = "https://discord.gg/6qJwkYSmrQ";
  984. discordLink.target = "_blank";
  985. discordLink.style.marginTop = '5px';
  986. discordLink.style.color = 'cyan';
  987. discordLink.style.textDecoration = 'underline';
  988. footerText.appendChild(discordMessage);
  989. footerText.appendChild(discordLink);
  990. window.pane.appendChild(footerText);
  991. loadCheckboxState('aiChat', 'aiChatCheckbox');
  992. loadCheckboxState('searchInBrainly', 'searchInBrainlyCheckbox');
  993. loadCheckboxState('autoVocab', 'autoVocabCheckbox');
  994. loadCheckboxState('autoWriting', 'autoWritingCheckbox');
  995. loadCheckboxState('autoplay', 'autoplayCheckbox');
  996. loadCheckboxState('searchClipboard', 'searchClipboardCheckbox');
  997. loadCheckboxState('guessing', 'guessingCheckbox');
  998. // Load new checkbox states
  999. loadCheckboxState('autoAssignment', 'autoAssignmentCheckbox');
  1000. loadCheckboxState('autoShow', 'autoShowCheckbox'); // New
  1001. makeDraggable(window.pane);
  1002. }
  1003. toggleButton.addEventListener('click', function() {
  1004. console.log('Button clicked! Toggling pane visibility.');
  1005. if (window.pane.style.display === 'none' || window.pane.style.display === '') {
  1006. window.pane.style.width = "50%";
  1007. window.pane.style.height = "auto";
  1008. window.pane.style.position = "absolute";
  1009. window.pane.style.marginTop = "20vh";
  1010. window.pane.style.marginLeft = "25%";
  1011. window.pane.style.border = "1px solid rgb(95, 95, 95)";
  1012. window.pane.style.borderRadius = "3px";
  1013. window.pane.style.backgroundColor = "rgb(39, 39, 39)";
  1014. window.pane.style.overflow = "hidden";
  1015. window.pane.style.color = "rgb(249, 166, 25)";
  1016. window.pane.style.textAlign = "center";
  1017. window.pane.style.overflowY = "scroll";
  1018. window.pane.style.display = 'block';
  1019. checkCheckboxState('aiChatCheckbox');
  1020. checkCheckboxState('searchInBrainlyCheckbox');
  1021. checkCheckboxState('autoVocabCheckbox');
  1022. checkCheckboxState('autoWritingCheckbox');
  1023. checkCheckboxState('autoplayCheckbox');
  1024. checkCheckboxState('searchClipboardCheckbox');
  1025. checkCheckboxState('guessingCheckbox');
  1026. // Check new checkbox states
  1027. checkCheckboxState('autoAdvanceCheckbox');
  1028. checkCheckboxState('autoShowCheckbox'); // New
  1029. } else {
  1030. window.pane.style.display = 'none';
  1031. }
  1032. });
  1033. }
  1034. function makeDraggable(element) {
  1035. let offsetX, offsetY;
  1036. element.addEventListener('mousedown', function(e) {
  1037. e.preventDefault();
  1038. offsetX = e.clientX - element.getBoundingClientRect().left + element.offsetWidth / 2;
  1039. offsetY = e.clientY - element.getBoundingClientRect().top + element.offsetHeight / 2;
  1040. element.classList.add('dragging');
  1041. document.addEventListener('mousemove', dragElement);
  1042. document.addEventListener('mouseup', stopDragging);
  1043. });
  1044. function dragElement(e) {
  1045. e.preventDefault();
  1046. let x = e.clientX - offsetX;
  1047. let y = e.clientY - offsetY;
  1048. element.style.left = x + 'px';
  1049. element.style.top = y + 'px';
  1050. }
  1051. function stopDragging() {
  1052. element.classList.remove('dragging');
  1053. document.removeEventListener('mousemove', dragElement);
  1054. document.removeEventListener('mouseup', stopDragging);
  1055. }
  1056. }
  1057. function createMenuItem(text, checkboxId) {
  1058. const itemDiv = document.createElement('div');
  1059. itemDiv.className = 'menu-item';
  1060. const checkbox = document.createElement('input');
  1061. checkbox.type = 'checkbox';
  1062. checkbox.id = checkboxId;
  1063. const storedValue = localStorage.getItem(checkboxId);
  1064. if (storedValue !== null) {
  1065. checkbox.checked = (storedValue === 'true');
  1066. }
  1067. const label = document.createElement('label');
  1068. label.innerText = text;
  1069. label.setAttribute('for', checkboxId);
  1070. itemDiv.appendChild(checkbox);
  1071. itemDiv.appendChild(label);
  1072. checkbox.addEventListener('change', () => {
  1073. console.log(`${text} checkbox is now ${checkbox.checked ? 'checked' : 'unchecked'}`);
  1074. localStorage.setItem(checkboxId, checkbox.checked);
  1075. });
  1076. return itemDiv;
  1077. }
  1078. function loadCheckboxState(checkboxId) {
  1079. const storedValue = localStorage.getItem(checkboxId);
  1080. if (storedValue !== null) {
  1081. const checkbox = document.getElementById(checkboxId);
  1082. if (checkbox) {
  1083. checkbox.checked = (storedValue === 'true');
  1084. }
  1085. }
  1086. }
  1087. function checkCheckboxState(checkboxId) {
  1088. const checkbox = document.getElementById(checkboxId);
  1089. const storedValue = localStorage.getItem(checkboxId);
  1090. if (storedValue !== null && checkbox) {
  1091. if (checkbox.checked !== (storedValue === 'true')) {
  1092. checkbox.checked = (storedValue === 'true');
  1093. }
  1094. }
  1095. }
  1096. if (window.top === window.self && window.location.href.includes('core.learn')) {
  1097. setInterval(createButtonAndPane, 1000);
  1098. }
  1099. var checkbox = document.getElementById('searchInBrainlyCheckbox');
  1100. let lastTitle = '';
  1101. function checkForAssignment() {
  1102. const element = document.getElementById('activity-title');
  1103. if (element) {
  1104. const currentTitle = element.textContent || element.innerText;
  1105. const excludedKeywords = [
  1106. "Summary", "Warm-Up", "Instruction", "Quiz",
  1107. "Assignment", "Unit Test",
  1108. "Unit Review", "Cumulative Exam Review",
  1109. "Vocab","Cumulative Exam"
  1110. ];
  1111. const containsExcludedKeyword = excludedKeywords.some(keyword => currentTitle.includes(keyword));
  1112. const currentContainsAssignment = currentTitle.includes("Assignment");
  1113. if (currentTitle !== lastTitle) {
  1114. if (currentContainsAssignment || !containsExcludedKeyword) {
  1115. new Notification("Done!");
  1116. }
  1117. lastTitle = currentTitle;
  1118. }
  1119. }
  1120. }if (window.top === window.self) {
  1121. setInterval(checkForAssignment, 1000);}
  1122. const isAutoVocabChecked = document.getElementById('autoVocabCheckbox').checked;
  1123. function clickSubmitIfVisible() {
  1124. const submitButton = window.frames[0].document.querySelector('a[data-bind="visible:lastWord == currentWord(), click: submit"]');
  1125. if (submitButton && submitButton.style.display !== 'none') {
  1126. submitButton.click();
  1127. }
  1128. }
  1129. function vocabCompleter() {
  1130. if (document.getElementById("activity-title").innerText == "Vocabulary") {
  1131. $("#stageFrame").contents().find(".uibtn.uibtn-blue.uibtn-arrow-next")[0].click()
  1132. var i = 0;
  1133. try{
  1134. var txt = window.frames[0].document.getElementsByClassName("word-background")[0].value
  1135. window.frames[0].document.getElementsByClassName("word-textbox")[0].value = txt;
  1136. $("#stageFrame").contents().find(".word-textbox.word-normal")[0].dispatchEvent(new Event("keyup"));
  1137. } catch{return;}
  1138. var speed = 50;
  1139. output += ("Vocab Completer, ")
  1140. $("#stageFrame").contents().find(".playbutton.vocab-play")[0].click()
  1141. $("#stageFrame").contents().find(".playbutton.vocab-play")[1].click()
  1142. $("#stageFrame").contents().find(".uibtn.uibtn-blue.uibtn-arrow-next")[0].click()
  1143. }
  1144. }
  1145. function checkAndExecuteFunctions() {
  1146. const isAutoVocabChecked = document.getElementById('autoVocabCheckbox').checked;
  1147. if (isAutoVocabChecked) {
  1148. clickSubmitIfVisible();
  1149. vocabCompleter();
  1150. }
  1151. }
  1152. if (window.top === window.self && window.location.href.includes('core.learn')) {
  1153. setInterval(checkAndExecuteFunctions, 1000);
  1154. }

QingJ © 2025

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