Last active
November 8, 2019 12:29
-
-
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.
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
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(); |
Thanks @mdusenne. Very kind of you to put it all in the open.
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...
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
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 :)