Last active
September 27, 2016 13:28
-
-
Save Yatoom/707a3329c5d2d42baee66d464ef79886 to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name Autopoker | |
// @namespace jeroenvanhoof.nl | |
// @version 0.1 | |
// @description Pokie poke | |
// @author Jeroen van Hoof | |
// @match https://www.facebook.com/pokes/ | |
// @grant none | |
// ==/UserScript== | |
function clickElement(e) { | |
return e.click(); | |
} | |
function autoClick() { | |
// Select parent of 'new pokes' box, to also include old pokes | |
var parent = document.querySelector("#poke_live_new").parentNode; | |
// Click on the buttons | |
parent.querySelectorAll('.selected').forEach(clickElement); | |
} | |
window.addEventListener('load', function() { | |
// Init script | |
autoClick(); | |
// Watch DOM updates (mutations) | |
new MutationObserver(autoClick).observe( | |
document.querySelector('#poke_live_new'), | |
{attributes: true, childList: true, characterData: true} | |
); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment