Skip to content

Instantly share code, notes, and snippets.

@bzmw
Last active November 26, 2020 00:38
Show Gist options
  • Save bzmw/f2e8e4aaad743de14fc6c3af187e5a9b to your computer and use it in GitHub Desktop.
Save bzmw/f2e8e4aaad743de14fc6c3af187e5a9b to your computer and use it in GitHub Desktop.
Scrape and Horse
const script = document.currentScript;
setTimeout(() => {
const activityItem = document.querySelector('#__next > div > div > div > div > div > div.pusher > div.chimpLayout > div.GivingGroupProfileWapper > div > div.row > div > div.eleven.wide.computer.sixteen.wide.mobile.ten.wide.tablet.column > div:nth-child(5) > div > div > div > div.ui.pointing.secondary.menu > a.active.item');
console.log(activityItem);
const scrollToMe = activityItem.getBoundingClientRect().top;
console.log(scrollToMe);
window.scrollTo(0, scrollToMe);
activityItem.click();
const latestDonation = document.querySelector('div.ui.segment.active.tab div.c-comment.ActivityComment div.content div.actions .metadata').textContent;
if (latestDonation.indexOf('seconds') !== -1 || latestDonation.indexOf('now') !== -1) {
window.setTimeout(() => {
script.dispatchEvent(new CustomEvent('play-sound', {
detail: 'https://www.w3schools.com/html/horse.ogg'
}));
}, 500);
}
console.log('hi');
}, 2000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment