Moodle AutoAttendance

Автоматически отмечает посещяемость в одноимённом элементе Moodle.

安装此脚本
作者推荐脚本

您可能也喜欢Moodle AutoPilot

安装此脚本
  1. // ==UserScript==
  2. // @name Moodle AutoAttendance
  3. // @namespace https://t.me/johannmosin
  4. // @version 1.0.0
  5. // @description Автоматически отмечает посещяемость в одноимённом элементе Moodle.
  6. // @author Johann Mosin
  7. // @match https://edu.vsu.ru/mod/attendance/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. var intervalId = setInterval(function() {
  16. var submitButton = document.querySelector('input[type="submit"][value="Сохранить"].btn.btn-primary');
  17.  
  18. if (submitButton) {
  19. var radioInput = document.querySelector('input[type="radio"].form-check-input[name="status"]');
  20. if (radioInput) {
  21. radioInput.click();
  22. submitButton.click();
  23. clearInterval(intervalId);
  24. }
  25. } else {
  26. var attendanceTd = Array.from(document.querySelectorAll('td')).find(td => td.textContent.includes("Отметить свое присутствие"));
  27.  
  28. if (attendanceTd) {
  29. var attendanceLink = attendanceTd.querySelector('a');
  30. if (attendanceLink) {
  31. window.location.href = attendanceLink.href;
  32. clearInterval(intervalId);
  33. }
  34. } else {
  35. setTimeout(() => {
  36. location.reload();
  37. }, 10000);
  38. }
  39. }
  40. }, 1000);
  41. })();