TwitterInstaCleaner

Removes promoted-tweets(ADs), follow suggestions and trending tweets sections

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         TwitterInstaCleaner
// @namespace    https://greasyfork.org/en/scripts/19306-twitterinstacleaner
// @locale       en
// @version      1.3
// @description  Removes promoted-tweets(ADs), follow suggestions and trending tweets sections
// @author       DEP
// @icon         http://deplist.weebly.com/uploads/6/1/9/1/61911901/9557100_orig.png
// @icon64       http://deplist.weebly.com/uploads/6/1/9/1/61911901/9557100_orig.png
// @include      https://twitter.com/*
// @include      https://twitter.com/i/notifications/*
// @include      https://www.instagram.com/*
// @exclude      https://twitter.com/i/moments/*
// @require      https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js
// @license      GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// @grant        none
// ==/UserScript==


this.$ = this.jQuery = jQuery.noConflict(true);



var strWhichPage = document.domain;
switch(strWhichPage) {
    case "twitter.com":
        var garbageRemoval = setInterval(removePromotedTweets, 1000);
        var garbageRemoval2 = setInterval(removeSideBars, 5000);
        break;
    case "www.instagram.com":
        var garbageRemoval3 = setInterval(removeSuggestionsForYou, 3000);
        break;
}

function removeSideBars () {
    var junkClass = ["dashboard-right", "flex-module", "Trends", "ProfileSidebar--withRightAlignment"];
    //var later = new Date();
    //var laterDate = later.setUTCFullYear('2099');
    //var cookieTwitter = getCookie('Twitter');
    //console.log("Current cookie count is at: " + cookieTwitter++);
    for (var j=0;j<junkClass.length;j++){
        var crap = document.getElementsByClassName(junkClass[j]);
        var basura = $(crap);
        if (basura) {
                basura.remove();
            }
        }
}

function removePromotedTweets () {
    //var laters = new Date();
    //var laterDates = laters.setUTCFullYear('2099');
    //var cookieTwitters = getCookie('Twitter');
    var tweetPromoted = $('li[data-item-type="who_to_follow_entry"]');
         if (tweetPromoted) {
             tweetPromoted.remove();
        }
    var garbage = $('.promoted-tweet');
    if (garbage) {
        garbage.remove();
    }
}
function removeSuggestionsForYou () {
    var ulList = document.getElementsByTagName("ul");
    var delSection = $( "h2:contains('Suggestions for You')" );
    if (delSection) { delSection.parentsUntil(ulList, "li").parent().remove(); }
}

/**function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1);
        if (c.indexOf(name) != -1) {
            return c.substring(name.length, c.length);
        }}
    return "";
}**/