Skip to content

Instantly share code, notes, and snippets.

@Yatoom
Last active September 27, 2016 13:28
Show Gist options
  • Save Yatoom/707a3329c5d2d42baee66d464ef79886 to your computer and use it in GitHub Desktop.
Save Yatoom/707a3329c5d2d42baee66d464ef79886 to your computer and use it in GitHub Desktop.
// ==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