Skip to content

Instantly share code, notes, and snippets.

@yattom
Last active October 28, 2019 00:25
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 yattom/6ffc5cee8a6cddb9134bae6f3561901b to your computer and use it in GitHub Desktop.
Save yattom/6ffc5cee8a6cddb9134bae6f3561901b to your computer and use it in GitHub Desktop.
small greasemonkey script to make facebook more productive (i.e. less counterproductive)
// ==UserScript==
// @name Facebook cleaner
// @namespace http://yattom.jp
// @include https://www.facebook.com/
// @version 2
// @grant GM_addStyle
// ==/UserScript==
// 右側の、上から3番目のエリアに、People You May Knowや、広告が表示される。それを非表示にする。
var ego_section = document.getElementsByClassName("ego_section");
for (i=0; i<ego_section.length; i++) {
ego_section[i].style.display = "none";
}
// 長時間だらだら読まないようにする
var stop_reading_function = function() {
alert("だらだら読まない!");
setTimeout(stop_reading_function, 100); // 永遠に出続ける
};
setTimeout(stop_reading_function, 5 * 60 * 1000);
// "Create"を消す
var create = document.getElementById("u_0_d");
create.style.display = "none";
// 記事の時刻を目にとまりやすくする
// facebookが古い記事も表示するようになってきたため
// see https://stackoverflow.com/questions/19385698/how-to-change-a-class-css-with-a-greasemonkey-tampermonkey-script
GM_addStyle ( `
.g_5_nw3_m5k.s_5_nw3_m5h.b_5_nw3_m53 {
font-size: 16pt !important;
}
.z_5_nw3_j85 {
font-size: 16pt;
}
`);
function GM_addStyle (cssStr) {
var D = document;
var newNode = D.createElement ('style');
newNode.textContent = cssStr;
var targ = D.getElementsByTagName ('head')[0] || D.body || D.documentElement;
targ.appendChild (newNode);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment