Twitter TL Like Remover

Likes are not shares. If you don't want to see on your homepage what the people you follow is liking, this script is for you.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Twitter TL Like Remover
// @namespace    http://carlostdev.com/
// @version      0.2
// @description  Likes are not shares. If you don't want to see on your homepage what the people you follow is liking, this script is for you.
// @author       carlostdev
// @match        https://twitter.com/
// @grant        none
// @require      http://code.jquery.com/jquery-latest.min.js
// ==/UserScript==

(function() {
    'use strict';

    var MutationObserver    = window.MutationObserver || window.WebKitMutationObserver;
    var myObserver          = new MutationObserver (mutationHandler);
    var obsConfig           = { childList: true, characterData: true, attributes: true, subtree: true };

    function likeDeleter ( )
    {
        $("li[data-item-type='tweet']").each(function(index){
            var json = $(this).attr('data-suggestion-json');
            var arr = $.parseJSON(json);
            var len = Object.keys(arr.suggestion_details).length;
            if(len > 0)
            {
                if(arr.suggestion_details.suggestion_type != "RankedOrganicTweet")
                {
                    $(this).remove();
                }
            }
        });
    }

    likeDeleter();
    myObserver.observe ($(".stream").get(0),obsConfig);

    function mutationHandler (mutationRecords) {
        likeDeleter();
    }

})();