58 lines
1.6 KiB
JavaScript
58 lines
1.6 KiB
JavaScript
|
// ==UserScript==
|
||
|
// @name Hide Facebook Comments
|
||
|
// @version 1
|
||
|
// @grant none
|
||
|
// @run-at document-start
|
||
|
// @match https://*.facebook.com/*
|
||
|
// ==/UserScript==
|
||
|
|
||
|
"use strict";
|
||
|
|
||
|
|
||
|
function hideComments() {
|
||
|
setInterval(doCommentHiding, 10000);
|
||
|
}
|
||
|
|
||
|
function doCommentHiding(){
|
||
|
hideElementsByClassName("UFIList"); // page comment box
|
||
|
hideElementsByClassName("comment_link"); // page comment link
|
||
|
hideElementsByClassName("_ipm");
|
||
|
hideElementsByClassName("_3w53");
|
||
|
hideElementsByClassName("_68wo");
|
||
|
hideElementsByClassName("_666h"); // profile comment box
|
||
|
hideElementsByClassName("_1bqu"); // <user> commented on your post.
|
||
|
hideElementById("pagelet_ego_pane");
|
||
|
hideElementById("pagelet_dock"); // bottom dock and notifications
|
||
|
hideElementsBySelector("fbNotificationsFlyout li[data-gt*='feed_comment']"); // comment notifications
|
||
|
hideElementsBySelector("div[data-testid='fbSnowliftUFI/feedbackSummary']"); // gallery comment count
|
||
|
hideElementsBySelector("div[data-testid='UFI2CommentsList/root_depth_0']"); // gallery comments
|
||
|
//console.log("Hid");
|
||
|
}
|
||
|
|
||
|
function hideElementById(id) {
|
||
|
var e = document.getElementById(id);
|
||
|
if (e) {
|
||
|
e.style = "display: none;";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function hideElementsByClassName(name) {
|
||
|
var e = document.getElementsByClassName(name);
|
||
|
for (var i=0;i<e.length;i++) {
|
||
|
e[i].style = "display: none;";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function hideElementsBySelector(selector) {
|
||
|
var e = document.getElementById(id);
|
||
|
if (e) {
|
||
|
var f = e.querySelectorAll(selector);
|
||
|
for (var i=0;i<f.length;i++) {
|
||
|
f[i].style = "display: none;";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
hideComments();
|
||
|
|
||
|
window.addEventListener("load", hideComments);
|