Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
Last active November 8, 2019 12:29
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save woodwardtw/951fe0d14081f822ea9b to your computer and use it in GitHub Desktop.
Save woodwardtw/951fe0d14081f822ea9b to your computer and use it in GitHub Desktop.
This bookmarklet opens up FB comments via http://www.alecjacobson.com/weblog/?p=4074 and http://mikakesensei.com/perso/javascript/fb_expander.js - Just make a new bookmark and cut/paste this into the URL field.
javascript: var cur_arr = [];
function what_to_click() {
if (cur_arr.length) {
return cur_arr.pop();
} else {
cur_arr = [].slice.call(document.getElementsByClassName("UFIPagerLink"));
if (cur_arr.length) {
return cur_arr.pop();
} else {
cur_arr = [].slice.call(document.getElementsByClassName("UFIReplySocialSentenceLinkText UFIReplySocialSentenceVerified")).filter(function(k) {
return !~k.textContent.indexOf("Masquer");
});
}
if (cur_arr.length) {
return cur_arr.pop();
} else {
cur_arr = [].slice.call(document.getElementsByClassName("fss")).filter(function(k) {
return !~k.textContent.indexOf("Masquer");
});
}
if (cur_arr.length) {
return cur_arr.pop();
} else {
cur_arr = [].slice.call(document.getElementsByClassName("see_more_link")).filter(function(k) {
return !~k.textContent.indexOf("Masquer");
});
}
if (cur_arr.length) {
return cur_arr.pop();
}
}
}
function auto_callback() {
var i = what_to_click();
if (!i) {
console.log("-------- done --------");
alert("Done!");
return;
} else {
console.log("click '" + i.textContent + "'");
i.click();
window.setTimeout(function() {
auto_callback();
}, 10);
}
}
auto_callback();
@mdusenne
Copy link

Hi! hehe, thanks a lot for your attention, I'm glad to see you find it helpful.
I felt guilty, because this first version is actually not a really good one, and the code is ugly. so I made a new one, that is completely language independent, and is encapsulated so that there can be no conflict with other javascript codes on the page.
And also, added comments so people can understand what this does.

the update is available at the same address, http://mikakesensei.com/perso/javascript/fb_expander.js

thanks again :)

@woodwardtw
Copy link
Author

Thanks @mdusenne. Very kind of you to put it all in the open.

@cvetad
Copy link

cvetad commented Nov 25, 2015

Hi woodwardtw, the code does work, but it has some issues:

  • it does not open all "replies of comments"
  • it takes you back on top of the page

The second one is crucial, as I cannot scroll and load older posts. Every time facebook tries to load an old post, the code takes me back to the header, so it is really impossible to read old posts.

Is it possible to fix these issues, it is a great function...

@Oleggue
Copy link

Oleggue commented Jul 28, 2016

woodwardtw, thank you!
Your code works pretty well!
Can you please include expanding this type of things "*** replied · *** Replies"?

Thank you in advance!

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