TwitterInstaCleaner

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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

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

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

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         TwitterInstaCleaner
// @namespace    https://greatest.deepsurf.us/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 "";
}**/