Videoele Complete Modifier

Simple VideoEle Modifier

  1. // ==UserScript==
  2. // @name Videoele Complete Modifier
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @author ToneTest
  6. // @match https://videoele.com/*
  7. // @description Simple VideoEle Modifier
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. let savedQuestionCount = 0;
  15. let countHasBeenSet = false;
  16.  
  17. function modifyElements() {
  18. if (!countHasBeenSet) {
  19. let questionCount = 0;
  20. const tableRows = document.querySelectorAll('tr');
  21. tableRows.forEach(row => {
  22. const cells = row.querySelectorAll('td');
  23. if (cells.length === 4) {
  24. if (cells[2] && cells[2].textContent === '⚫') {
  25. questionCount++;
  26. }
  27. }
  28. });
  29. if (questionCount > 0) {
  30. savedQuestionCount = questionCount;
  31. countHasBeenSet = true;
  32. }
  33. }
  34.  
  35. const paragraphs = document.querySelectorAll('p.clinf-c.clinf-n');
  36. paragraphs.forEach(p => {
  37. p.classList.remove('clinf-n');
  38. p.classList.add('clinf-b');
  39. });
  40.  
  41. const spans = document.querySelectorAll('span.clinf-cn');
  42. spans.forEach(span => {
  43. if (span.textContent.includes('%')) {
  44. span.textContent = ' 100%';
  45. }
  46. });
  47.  
  48. const checkSpans = document.querySelectorAll('span.clinf-cn.clinf-b');
  49. checkSpans.forEach(span => {
  50. if (span.textContent.includes('✔') || span.textContent.match(/\b0\b/) || span.textContent.trim() === '0') {
  51. span.textContent = savedQuestionCount + ' ✔ ';
  52. }
  53. });
  54.  
  55. const tableRows = document.querySelectorAll('tr');
  56. tableRows.forEach(row => {
  57. const cells = row.querySelectorAll('td');
  58. if (cells.length === 4) {
  59. if (cells[2] && cells[2].textContent === '⚫') {
  60. cells[2].innerHTML = '<strong>✔</strong>';
  61. cells[3].textContent = Math.floor(Math.random() * 4) + 1;
  62. }
  63. }
  64. });
  65. }
  66.  
  67. let lastUrl = location.href;
  68. new MutationObserver(() => {
  69. if (location.href !== lastUrl) {
  70. lastUrl = location.href;
  71. countHasBeenSet = false;
  72. setTimeout(modifyElements, 1000);
  73. }
  74. }).observe(document, {subtree: true, childList: true});
  75.  
  76. modifyElements();
  77.  
  78. window.addEventListener('load', () => {
  79. modifyElements();
  80. if (!countHasBeenSet) {
  81. setTimeout(modifyElements, 1500);
  82. }
  83. });
  84.  
  85. setInterval(modifyElements, 2000);
  86. })();