This script is designed to unlock and enhance all disabled fields on any website. It removes the disabled
and readonly
attributes from input fields, buttons, select elements, and text areas, making them interactive and functional. Additionally, it adds event listeners to ensure the elements respond to user interactions.
-
enableElement(element)
- Purpose: Enable a single element by removing the
disabled
andreadonly
attributes and making it interactive. - Parameters:
element
(HTMLElement): The element to be enabled.
- Behavior: Removes
disabled
andreadonly
attributes from the element and setspointerEvents
toauto
to ensure it is interactive. Logs the element's tag name and id to the console.
- Purpose: Enable a single element by removing the
-
addEventListeners(element)
- Purpose: Add event listeners to an element to handle user interactions.
- Parameters:
element
(HTMLElement): The element to which event listeners are added.
- Behavior: Adds an
input
event listener that logs the element's new value whenever it changes. Additional listeners can be added as needed.
-
enableAndEnhanceAllDisabledElements()
- Purpose: Enable and enhance all disabled elements on the page.
- Behavior: Selects all elements with
disabled
orreadonly
attributes, iterates over them, enables each one, and adds necessary event listeners. Logs a confirmation message to the console when done.
-
removePopups()
- Purpose: Remove or hide popup elements that interfere with user interaction.
- Behavior: Selects popup elements based on their common CSS classes and removes them from the DOM. Logs a message for each removed popup and a confirmation message when done.
To use this script:
- Open the website where you want to unlock and enhance all fields.
- Open the browser console (press
F12
orCtrl+Shift+I
and select the "Console" tab). - Copy and paste the script into the console and press
Enter
.
The script will automatically find and enable all disabled and read-only fields on the page, making them interactive and functional. It also adds event listeners to handle user interactions, ensuring the fields work correctly.
Suppose you have a form with disabled input fields, buttons, and a popup message like this:
<form>
<input type="text" id="name" disabled value="John Doe">
<button id="submitBtn" disabled>Submit</button>
</form>
<div class="absolute right-0 z-10 mt-2 w-64 rounded-lg border bg-token-main-surface-primary p-3 text-sm shadow-lg">
<p class="mb-2">Upgrade to ChatGPT Plus to create and share your GPTs</p>
<button class="btn relative btn-secondary btn-small">Upgrade to Plus</button>
</div>
After running the script, these fields will be enabled and interactive, and the popup will be removed, allowing for smooth user interaction.
This script provides a universal solution for unlocking and enhancing disabled fields on any website. It is especially useful for testing, debugging, or modifying web pages where certain fields are intentionally disabled. By including detailed logging and the ability to add custom event listeners, it ensures that the fields function correctly once they are enabled.