Skip to content

Instantly share code, notes, and snippets.

@youpy
Created July 19, 2010 20:43
Show Gist options
  • Save youpy/481973 to your computer and use it in GitHub Desktop.
Save youpy/481973 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name I like Facebook
// @namespace http://d.hatena.ne.jp/youpy/
// @include http://www.facebook.com/*
// ==/UserScript==
if(window.location.href.match(/facebook\.com\/(plugins|widgets)/)) {
unsafeWindow.onloadRegister(function() {
click(document.querySelector('a.like_button_no_like'));
});
}
function click(e) {
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
evt.element = function (){ return evt.target; };
e.dispatchEvent(evt);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment