Last active
January 6, 2016 10:03
-
-
Save mehedihasan/3cb941c98d997fa37ea0 to your computer and use it in GitHub Desktop.
Block/Hide facebook news feed, chat boxes and sidebars with ticker and chat list
This file contains hidden or 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
// ==UserScript== | |
// @name Facebook Blocker | |
// @namespace com.mehedih.fb.blocker | |
// @include *facebook.com* | |
// @version 1 | |
// @grant none | |
// @downloadURL https://gist.github.com/mehedihasan/3cb941c98d997fa37ea0/raw/ | |
// @description Block/Hide facebook news feed, chat boxes and sidebars with ticker and chat list | |
// ==/UserScript== | |
function isHomePage() { | |
// detects if it's fb home page using title | |
// normal title - "Facebook" | |
// title with notification - "(12) Facebook" | |
var re = /^(\(\d+\)\s+)?Facebook$/ | |
return document.title.match(re) != null ? true : false | |
} | |
function hideElementById(id) { | |
var e = document.getElementById(id) | |
if (e != null) { | |
e.style.visibility = 'hidden' | |
} | |
} | |
function hideThings() { | |
// hide the news feed on home page | |
if (isHomePage()) { | |
hideElementById('contentArea') | |
} | |
// hide the ticker and chat, sidebar | |
hideElementById('pagelet_sidebar') | |
// remove chat boxes | |
hideElementById('ChatTabsPagelet') | |
} | |
// check every 1 second | |
var intervalID = window.setInterval(hideThings, 500) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment