Skip to content

Instantly share code, notes, and snippets.

@AWare
Created May 16, 2013 17:54
Show Gist options
  • Select an option

  • Save AWare/5593655 to your computer and use it in GitHub Desktop.

Select an option

Save AWare/5593655 to your computer and use it in GitHub Desktop.
Inelegant hack to click all the read more links in google plus.
//https://developer.mozilla.org/en-US/docs/DOM/document.createEvent
function simulateClick(cb) {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
//var cb = document.getElementById("checkbox");
var canceled = !cb.dispatchEvent(evt);
if(canceled) {
// A handler called preventDefault
alert("canceled");
} else {
// None of the handlers called preventDefault
//alert("not canceled");
}
}
readlinks = document.getElementsByClassName("syxni");
for (var i = readlinks.length - 1; i >= 0; i--) {
simulateClick(readlinks[i]);
};
@AWare
Copy link
Author

AWare commented May 16, 2013

Created in response to https://plus.google.com/112482032780181267192/posts/bQApU1yxe39

Unfortunately won't be stable as class names are autogenerated. (See comments)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment