Skip to content

Instantly share code, notes, and snippets.

@qqii
Last active May 22, 2017 01:38
Show Gist options
  • Save qqii/73c59374f961b24282a3a34943ca7c6d to your computer and use it in GitHub Desktop.
Save qqii/73c59374f961b24282a3a34943ca7c6d to your computer and use it in GitHub Desktop.
Facebook Timeline Hider (22/05/17)
// Hides all posts on the timeline
// 1. Navitage to timeline
// 2. Run in console
// click the little down arrows next to posts
// gives hide elements their text
function clickDown() {
var d = document.getElementsByClassName("_4xev _p");
for (var i = 0; i < d.length && i < 5; i++) {
d[i].click();
}
}
// clicks hide
function clickHide() {
var hs = document.getElementsByClassName("_54nh");
for (var i = 0; i < hs.length; i++) {
if (hs[i].innerText == "Hide from Timeline") {
hs[i].click();
}
}
setTimeout(clickHideYes, 500);
}
// click the confirmation popup
// also clicks another button (i think post)
function clickHideYes() {
var bs = document.getElementsByTagName("button");
for (var i = 0; i < bs.length; i++) {
if (bs[i].value == 1) {
bs[i].click();
}
}
setTimeout(clickClose, 500);
}
// closes the post button clicked by clickHideYes
function clickClose() {
var cs = document.getElementsByClassName("_4qba");
for (var i = 0; i < cs.length; i++) {
if (cs[i].innerText == "Close") {
cs[i].click();
}
}
}
function scrollDown() {
window.scrollTo(0,document.body.scrollHeight);
}
setInterval(clickDown, 1000);
setInterval(clickHide, 700);
//setInterval(scrollDown, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment