Last active
January 13, 2024 03:46
-
-
Save devinschumacher/c1361b8928e2717f9de03c1b2c7eb0ba to your computer and use it in GitHub Desktop.
SERP Clapper - New Code /latest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// keeps clapping in viewport | |
(async function() { | |
const events = ['mousedown', 'mouseup', 'click']; | |
function randomDelay(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
async function scrollToBottom() { | |
let lastHeight = document.body.scrollHeight; | |
while (true) { | |
window.scrollTo(0, document.body.scrollHeight); | |
await new Promise(resolve => setTimeout(resolve, 2000)); // Wait for 2 seconds | |
let newHeight = document.body.scrollHeight; | |
if (newHeight === lastHeight) { | |
break; // Break the loop if no new content was loaded | |
} | |
lastHeight = newHeight; | |
} | |
} | |
async function performClaps(clapButton) { | |
clapButton.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); | |
for (let i = 0; i < 50; i++) { // Clap 50 times | |
if (Math.random() < 0.1) continue; // 10% chance to skip a clap | |
const rect = clapButton.getBoundingClientRect(); | |
const baseX = window.scrollX + rect.left + rect.width / 2; | |
const baseY = window.scrollY + rect.top + rect.height / 2; | |
for (let eventType of events) { | |
let event = new MouseEvent(eventType, { | |
'view': window, | |
'bubbles': true, | |
'cancelable': true, | |
'clientX': baseX + Math.random() * 10 - 5, // Random coordinate near the button | |
'clientY': baseY + Math.random() * 10 - 5 | |
}); | |
clapButton.dispatchEvent(event); | |
} | |
await new Promise(resolve => setTimeout(resolve, randomDelay(50, 200))); // Random delay between 50ms and 200ms | |
} | |
} | |
await scrollToBottom(); // Scroll to the bottom of the page to load all content | |
let multipleClapButtons = document.querySelectorAll('.clapButton'); | |
let categoryPageClapButtons = document.querySelectorAll('button:has(svg[aria-label="clap"])'); | |
let clapButtons = [...multipleClapButtons, ...categoryPageClapButtons]; | |
for (const clapButton of clapButtons) { | |
await performClaps(clapButton); | |
// No longer scrolls to the top after each clapping session | |
await new Promise(resolve => setTimeout(resolve, randomDelay(500, 1000))); // Wait 0.5 to 1 second before next button | |
} | |
console.log("Clapping completed for all buttons!"); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// clapping does not stay in viewport | |
(async function() { | |
const events = ['mousedown', 'mouseup', 'click']; | |
function randomDelay(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
async function scrollToBottom() { | |
let lastHeight = 0; | |
let newHeight = document.body.scrollHeight; | |
while (lastHeight !== newHeight) { | |
window.scrollTo(0, document.body.scrollHeight); | |
await new Promise(resolve => setTimeout(resolve, 2000)); // Wait for 2 seconds to load new content | |
lastHeight = newHeight; | |
newHeight = document.body.scrollHeight; | |
} | |
} | |
async function performClaps(clapButton) { | |
for (let i = 0; i < 50; i++) { // Clap 50 times | |
if (Math.random() < 0.1) continue; // 10% chance to skip a clap | |
const rect = clapButton.getBoundingClientRect(); | |
const baseX = window.scrollX + rect.left + rect.width / 2; | |
const baseY = window.scrollY + rect.top + rect.height / 2; | |
for (let eventType of events) { | |
let event = new MouseEvent(eventType, { | |
'view': window, | |
'bubbles': true, | |
'cancelable': true, | |
'clientX': baseX + Math.random() * 10 - 5, // Random coordinate near the button | |
'clientY': baseY + Math.random() * 10 - 5 | |
}); | |
clapButton.dispatchEvent(event); | |
} | |
await new Promise(resolve => setTimeout(resolve, randomDelay(50, 200))); // Random delay between 50ms and 200ms | |
} | |
} | |
await scrollToBottom(); // Scroll to the bottom of the page to load all content | |
let multipleClapButtons = document.querySelectorAll('.clapButton'); | |
let categoryPageClapButtons = document.querySelectorAll('button:has(svg[aria-label="clap"])'); | |
let clapButtons = [...multipleClapButtons, ...categoryPageClapButtons]; | |
for (const clapButton of clapButtons) { | |
await performClaps(clapButton); | |
window.scrollTo(0, 0); // Scroll to the top of the page after each button | |
await new Promise(resolve => setTimeout(resolve, randomDelay(500, 1000))); // Wait 0.5 to 1 second before next button | |
} | |
console.log("Clapping completed for all buttons!"); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// keeps clapping in viewport | |
(async function() { | |
const events = ['mousedown', 'mouseup', 'click']; | |
function randomDelay(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
async function scrollToBottom() { | |
let lastHeight = document.body.scrollHeight; | |
while (true) { | |
window.scrollTo(0, document.body.scrollHeight); | |
await new Promise(resolve => setTimeout(resolve, 2000)); // Wait for 2 seconds | |
let newHeight = document.body.scrollHeight; | |
if (newHeight === lastHeight) { | |
break; // Break the loop if no new content was loaded | |
} | |
lastHeight = newHeight; | |
} | |
} | |
async function performClaps(clapButton) { | |
clapButton.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); | |
for (let i = 0; i < 50; i++) { // Clap 50 times | |
if (Math.random() < 0.1) continue; // 10% chance to skip a clap | |
const rect = clapButton.getBoundingClientRect(); | |
const baseX = window.scrollX + rect.left + rect.width / 2; | |
const baseY = window.scrollY + rect.top + rect.height / 2; | |
for (let eventType of events) { | |
let event = new MouseEvent(eventType, { | |
'view': window, | |
'bubbles': true, | |
'cancelable': true, | |
'clientX': baseX + Math.random() * 10 - 5, // Random coordinate near the button | |
'clientY': baseY + Math.random() * 10 - 5 | |
}); | |
clapButton.dispatchEvent(event); | |
} | |
await new Promise(resolve => setTimeout(resolve, randomDelay(50, 200))); // Random delay between 50ms and 200ms | |
} | |
} | |
await scrollToBottom(); // Scroll to the bottom of the page to load all content | |
let multipleClapButtons = document.querySelectorAll('.clapButton'); | |
let categoryPageClapButtons = document.querySelectorAll('button:has(svg[aria-label="clap"])'); | |
let clapButtons = [...multipleClapButtons, ...categoryPageClapButtons]; | |
for (const clapButton of clapButtons) { | |
await performClaps(clapButton); | |
// No longer scrolls to the top after each clapping session | |
await new Promise(resolve => setTimeout(resolve, randomDelay(500, 1000))); // Wait 0.5 to 1 second before next button | |
} | |
console.log("Clapping completed for all buttons!"); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// keeps clapping in viewport | |
// starts at top, scrolls down as it goes, waits for more page loads and keeps going | |
(async function() { | |
const events = ['mousedown', 'mouseup', 'click']; | |
function randomDelay(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
async function performClaps(clapButton) { | |
clapButton.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); | |
for (let i = 0; i < 50; i++) { // Clap 50 times | |
if (Math.random() < 0.03) continue; // 3% chance to skip a clap | |
const rect = clapButton.getBoundingClientRect(); | |
const baseX = window.scrollX + rect.left + rect.width / 2; | |
const baseY = window.scrollY + rect.top + rect.height / 2; | |
for (let eventType of events) { | |
let event = new MouseEvent(eventType, { | |
'view': window, | |
'bubbles': true, | |
'cancelable': true, | |
'clientX': baseX + Math.random() * 10 - 5, // Random coordinate near the button | |
'clientY': baseY + Math.random() * 10 - 5 | |
}); | |
clapButton.dispatchEvent(event); | |
} | |
await new Promise(resolve => setTimeout(resolve, randomDelay(100, 400))); // Random delay between 50ms and 200ms | |
} | |
} | |
let clapButtons, previousLength; | |
do { | |
previousLength = clapButtons ? clapButtons.length : 0; | |
clapButtons = document.querySelectorAll('.clapButton, button:has(svg[aria-label="clap"])'); | |
for (const clapButton of clapButtons) { | |
await performClaps(clapButton); | |
await new Promise(resolve => setTimeout(resolve, randomDelay(500, 1500))); // Wait 0.5 to 1 second before next button | |
} | |
// Scroll down and wait for potential new content | |
window.scrollBy(0, window.innerHeight); | |
await new Promise(resolve => setTimeout(resolve, 3000)); // Wait for 3 seconds | |
// Recheck for new clap buttons | |
clapButtons = document.querySelectorAll('.clapButton, button:has(svg[aria-label="clap"])'); | |
} while (clapButtons.length > previousLength); | |
console.log("Clapping completed for all buttons!"); | |
alert("Clapping complete! 👏 Thank you for spreading the clap!"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment