Enable Disabled Checkbox

Позволяющий включить неактивный чекбокс 18+ на Rutube Studio.

  1. // ==UserScript==
  2. // @name Enable Disabled Checkbox
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Позволяющий включить неактивный чекбокс 18+ на Rutube Studio.
  6. // @author Your Name
  7. // @match studio.rutube.ru/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Function to enable the checkbox
  16. function enableCheckbox() {
  17. // Target the checkbox using its class and name attributes
  18. const checkboxWrapper = document.querySelector('.freyja_pen-checkbox__pen-checkbox_disabled_ImtFI');
  19. const checkbox = document.querySelector('input[name="adult"][id="adult"]');
  20.  
  21. if (checkboxWrapper && checkbox) {
  22. // Remove the 'disabled' class and enable the checkbox
  23. checkboxWrapper.classList.remove('freyja_pen-checkbox__pen-checkbox_disabled_ImtFI');
  24. checkbox.removeAttribute('disabled');
  25. console.log('Checkbox enabled!');
  26. }
  27. }
  28.  
  29. // Create a MutationObserver to watch for changes in the DOM
  30. const observer = new MutationObserver((mutations) => {
  31. mutations.forEach(() => {
  32. enableCheckbox();
  33. });
  34. });
  35.  
  36. // Start observing the document body
  37. observer.observe(document.body, {
  38. childList: true,
  39. subtree: true
  40. });
  41.  
  42. // Initial check in case the element is already loaded
  43. enableCheckbox();
  44. })();