Facebook Filter

Minimizes all posts your friends didn't post (friend liked, friend commented, friend attends...)

目前為 2016-01-15 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Facebook Filter
// @namespace    thetom.facebook
// @version      1.3
// @description  Minimizes all posts your friends didn't post (friend liked, friend commented, friend attends...)
// @author       TheTomCZ <[email protected]>
// @match        https://www.facebook.com/*
// @require      https://code.jquery.com/jquery-2.1.4.min.js
// @grant        none
// @homepage     https://gf.qytechs.cn/en/scripts/16232-facebook-filter
// ==/UserScript==

$(function() {
    'use strict';
    var $stream = $("#stream_pagelet > div:last > div");
    
    String.prototype.contains = function(it) { return this.indexOf(it) != -1; };
	
	/*jshint multistr: true */
	$("head").append("<style>.filteredOut .userContentWrapper > div:first-child > div:last-child{\
                              display: none!important;\
					 }\
					.filteredOut {\
                           opacity: 0.5!important;                                             \
                           padding: 0px!important;                                             \
                           margin: 3px 0!important;                                             \
					 }\
                     .filteredOut h5 {\
                               font-size: 12px!important;                    \
					           margin-top: -2px!important;                           \
					           padding: 3px!important;                           \
					 }\
                     .filteredOut .commentableItem, .filteredOut img, .filteredOut .userContentWrapper form, .filteredOut h5 + div{\
                               display: none!important;                         \
					 }\
                     .filteredOut ._1dwg{\
                              display: block!important;\
					 }\
                     .filteredOut *{\
                              height: auto!important;\
                              padding: 0!important;\
                              margin: 0!important;\
					 }</style>");
	
	function minimize($elem){
		var $title = $elem.find("h5");
		if($elem.hasClass("filteredOut")){
			return;
		}
		$elem.addClass("filteredOut");
		var id = $elem.attr("id");
		$title.append(" <a id='showStory_"+id+"'>unhide</a><a id='rehideStory_"+id+"' style='display:none'>rehide</a>");
		var $showLinkBtn = $("#showStory_"+id);
		var $rehideLinkBtn = $("#rehideStory_"+id);
		$showLinkBtn.click(function(){$rehideLinkBtn.show();$showLinkBtn.hide();$elem.removeClass("filteredOut");});
		$rehideLinkBtn.click(function(){$showLinkBtn.show();$rehideLinkBtn.hide();$elem.addClass("filteredOut");});
	}

    function filter(index,elem){
		if(!$(elem).attr){
			return;
		}
		var $elem = $(elem);
		if($elem.attr("id")){
			if($elem.attr("id").substring(0,10)==="substream_"){
				$elem.find("div[data-ft]").map(filter);
				return;
			}
			if($elem.attr("id").substring(0,11)==="more_pager_"){
				return;
			}
			if($elem.attr("id").substring(0,15)==="newsFeedHeading"){
				return;
			}
			if($elem.attr("id").substring(0,16)!=="hyperfeed_story_"){
				return;
			}
		} else {
			return;
		}
		
		var $h5 = $elem.find("h5");
		var title = $h5.text();
        if(
			title.contains("liked this.") ||
			title.contains("liked this post ") ||
			title.contains(" likes ") ||
			title.contains(" replied to a comment on this.") ||
			title.contains(" commented on this.") ||
			title.contains(" commented on a post") ||
			title.contains(" is now friends with ") ||
			title.contains(" is interested in an event") ||
			title.contains(" going to an event") ||
			
			title.contains(" se líbí ") ||
			title.contains("liked this post ") ||
			title.contains(" se líbí uživateli ") ||
			title.contains(" tady odpověděl") ||
			title.contains(" okomentovali uživatelé") ||
			title.contains(" okomentovali příspěvek ") ||
			title.contains(" to okomentoval") ||
			title.contains(" is now friends with ") ||
			title.contains(" má zájem o událost") ||
			title.contains(" se zúčastní události")
		){
             minimize($elem);
		}
    }
    function filterAll(){
		setTimeout(_filterAll,500);
	}
    function _filterAll(){
        $stream.children().map(filter);
    }
    
   filterAll();
    $(document).on("scroll",filterAll);
});

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址