simplify the shareus.io script

This commit is contained in:
Amm0ni4 2024-02-13 22:06:21 +01:00
parent 42fd4b36c8
commit f6e8b03dc6
2 changed files with 10 additions and 26 deletions

View file

@ -1675,25 +1675,17 @@
(function() { (function() {
'use strict'; 'use strict';
if (window.location.hostname === 'shareus.io') { if (window.location.hostname === 'shareus.io') {
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() { // Wait for the page to be loaded
// Define the button selector
const buttonSelector = "#root > div > main > div.main-container-1 > div.main-container-2 > div:nth-child(1) > div.adunit-container > button";
// Function to click the button
function clickButton() { function clickButton() {
// Find the button element const button = document.querySelector("#root > div > main > div.main-container-1 > div.main-container-2 > div:nth-child(1) > div.adunit-container > button");
const button = document.querySelector(buttonSelector);
if (button) { if (button) {
button.click(); button.click();
console.log("Button clicked!");
//clearInterval(intervalId); // Stop attempting once clicked //clearInterval(intervalId); // Stop attempting once clicked
} else {
console.log("Button not found!");
} }
} }
const intervalId = setInterval(clickButton, 1000); // Set interval to attempt clicking every 1 second
// Set interval to attempt clicking every 1 second
const intervalId = setInterval(clickButton, 1000);
}); });
} }
})(); })();

View file

@ -8,25 +8,17 @@
(function() { (function() {
'use strict'; 'use strict';
if (window.location.hostname === 'shareus.io') { if (window.location.hostname === 'shareus.io') {
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() { // Wait for the page to be loaded
// Define the button selector
const buttonSelector = "#root > div > main > div.main-container-1 > div.main-container-2 > div:nth-child(1) > div.adunit-container > button";
// Function to click the button
function clickButton() { function clickButton() {
// Find the button element const button = document.querySelector("#root > div > main > div.main-container-1 > div.main-container-2 > div:nth-child(1) > div.adunit-container > button");
const button = document.querySelector(buttonSelector);
if (button) { if (button) {
button.click(); button.click();
console.log("Button clicked!");
//clearInterval(intervalId); // Stop attempting once clicked //clearInterval(intervalId); // Stop attempting once clicked
} else {
console.log("Button not found!");
} }
} }
const intervalId = setInterval(clickButton, 1000); // Set interval to attempt clicking every 1 second
// Set interval to attempt clicking every 1 second
const intervalId = setInterval(clickButton, 1000);
}); });
} }
})(); })();