Skip to content

Instantly share code, notes, and snippets.

@timiles
Last active October 20, 2023 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timiles/5607605 to your computer and use it in GitHub Desktop.
Save timiles/5607605 to your computer and use it in GitHub Desktop.
Hide from timeline: javascript to hide all displayed posts from your facebook timeline. Doesn't delete anything, only hides from timeline.
/*---------------------
INSTRUCTIONS:
1. open https://www.facebook.com/me
2. run script*
3. refresh if necessary, goto 2.
* to save as bookmarklet, create new bookmark in your browser of choice -
Name: "hide from timeline"
URL: "javascript: <content of gist below>"
-----------------------*/
function clickByClassName(className, innerText) {
var els = document.getElementsByClassName(className);
for (var i=0; i<els.length; i++) {
if (innerText == undefined || els[i].innerText == innerText) {
els[i].click();
}
}
}
clickByClassName('_5cg _4__7');
clickByClassName('_54nh', 'Hide from timeline');
@anthonymonori
Copy link

Made an update to your gist, fixing two small bugs.

  1. The text is case sensitive, and Facebook (probably) changed the text form 'Hide from timeline' to 'Hide from Timeline'
  2. The first class that it needs to click (the arrow) was also changed as it looks like to -> _dxs _p

Here's the updated gist: https://gist.github.com/anthonymonori/6428045

@gialloporpora
Copy link

Great scrippt.
Is it possible to dellete all my posts permanently instead of only hiding them?

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