Arch-A Auto Answer

Auto-answer and search assistant with a customizable UI for Brainly and Apex Learning websites.

  1. // ==UserScript==
  2. // @name Arch-A Auto Answer
  3. // @namespace https://github.com/DevilGlitch/ArchA
  4. // @version A.4.0.0
  5. // @description Auto-answer and search assistant with a customizable UI for Brainly and Apex Learning websites.
  6. // @author TheLostMoon
  7. // @license MIT
  8. // @match https://course.apexlearning.com/*
  9. // @match https://brainly.com/question/*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15.  
  16. // UI Initialization
  17. const initUI = () => {
  18. const container = document.createElement('div');
  19. container.id = 'archAUI';
  20. container.style.position = 'fixed';
  21. container.style.bottom = '20px';
  22. container.style.right = '20px';
  23. container.style.padding = '10px';
  24. container.style.backgroundColor = '#ffffff';
  25. container.style.border = '2px solid #333';
  26. container.style.borderRadius = '8px';
  27. container.style.boxShadow = '0px 0px 10px rgba(0, 0, 0, 0.2)';
  28. container.style.zIndex = '1000';
  29. container.style.fontFamily = 'Arial, sans-serif';
  30.  
  31. // UI Title
  32. const title = document.createElement('h3');
  33. title.textContent = 'Arch-A Auto Answer';
  34. title.style.marginBottom = '10px';
  35. container.appendChild(title);
  36.  
  37. // Toggle Auto Answer Feature
  38. const toggleLabel = document.createElement('label');
  39. toggleLabel.textContent = 'Enable Auto Answer';
  40. toggleLabel.style.marginRight = '8px';
  41.  
  42. const toggleAutoAnswer = document.createElement('input');
  43. toggleAutoAnswer.type = 'checkbox';
  44. toggleAutoAnswer.id = 'autoAnswerToggle';
  45.  
  46. toggleLabel.appendChild(toggleAutoAnswer);
  47. container.appendChild(toggleLabel);
  48.  
  49. document.body.appendChild(container);
  50. };
  51.  
  52. // Auto-answer function for Brainly.com
  53. const autoAnswer = () => {
  54. if (window.location.host === 'brainly.com') {
  55. document.addEventListener('DOMContentLoaded', function () {
  56. const question = document.querySelector('.brn-qpage-next-question-box-content .sg-text');
  57. if (question) {
  58. const query = question.textContent.trim().replace(/\s+/g, '+');
  59. const searchUrl = `https://www.google.com/search?q=${query}`;
  60. window.open(searchUrl, '_blank');
  61. }
  62. });
  63. }
  64. };
  65.  
  66. // Event listener for auto answer toggle
  67. const setupAutoAnswer = () => {
  68. const toggle = document.getElementById('autoAnswerToggle');
  69. toggle.addEventListener('change', (event) => {
  70. if (event.target.checked) {
  71. autoAnswer();
  72. }
  73. });
  74. };
  75.  
  76. // Google Search for Apex Learning
  77. if (window.location.host === 'course.apexlearning.com') {
  78. let highlightedText = '';
  79. window.addEventListener('mouseup', () => {
  80. highlightedText = window.getSelection().toString();
  81. if (!highlightedText) return;
  82.  
  83. const query = highlightedText.replace(/\s+/g, '+');
  84. const searchUrl = `https://www.google.com/search?q=${query}`;
  85. window.open(searchUrl, '_blank');
  86. window.getSelection().removeAllRanges();
  87. });
  88. }
  89.  
  90. // Brainly.com Cleanup
  91. if (window.location.host === 'brainly.com') {
  92. document.addEventListener('DOMContentLoaded', () => {
  93. const unwantedElements = [
  94. '.brn-expanded-bottom-banner',
  95. '.brn-brainly-plus-box',
  96. '.brn-fullscreen-toplayer',
  97. '.sg-overlay.sg-overlay--dark',
  98. ];
  99.  
  100. unwantedElements.forEach(selector => {
  101. const element = document.querySelector(selector);
  102. if (element) {
  103. element.remove();
  104. }
  105. });
  106. });
  107. }
  108.  
  109. // Initialize UI and auto-answer setup
  110. initUI();
  111. setupAutoAnswer();
  112. })();