您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Remove facebook suggested posts and games
- // ==UserScript==
- // @name removeFacebookSuggestedPosts
- // @namespace DT
- // @description Remove facebook suggested posts and games
- // @include https://www.facebook.com/
- // @version 2
- // @grant none
- // ==/UserScript==
- var DT = {};
- DT._ticking = false;
- DT._unwanted = ['Suggested Post', 'Suggested Game'];
- DT.main = function(){
- var spans = document.getElementsByTagName("SPAN");
- var totalSpans = spans.length;
- for(var i = 0; i < totalSpans; i++){
- var item = spans.item(i);
- if(item && DT._unwanted.indexOf(item.textContent) > -1){
- var parent = item.parentNode.parentNode.parentNode.parentNode.parentNode;
- if(parent){
- parent.parentNode.removeChild(parent);
- console.log('Removed suggested post');
- }
- }
- }
- };
- DT._tick = function(){
- if(!DT._ticking){
- window.setTimeout(function(){
- DT.main();
- DT._ticking = false;
- }, 3000);
- }
- DT._ticking = true;
- };
- document.addEventListener("DOMContentLoaded", DT._tick);
- window.addEventListener('scroll', DT._tick);