Greasy Fork

Greasy Fork is available in English.

汤不热首页只显示视频,并去掉推荐内容(Tumblr Show only video on the Dashboard and remove the recommended content)

首页只显示视频,并去掉推荐内容(Tumblr Show only video on the Dashboard and remove the recommended content)

当前为 2018-08-08 提交的版本,查看 最新版本

// ==UserScript==
// @name         汤不热首页只显示视频,并去掉推荐内容(Tumblr Show only video on the Dashboard and remove the recommended content)
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  首页只显示视频,并去掉推荐内容(Tumblr Show only video on the Dashboard and remove the recommended content)
// @author       Frank
// @match        https://www.tumblr.com/dashboard
// @grant        none
// ==/UserScript==

var $ = window.jQuery;

var liAmount = 0;

$(document).ready(function(){
    hidePhotoDiv();
    showVpnTutorial();
    $(window).scroll(function(event){
        var newLiAmount = $( "#posts li.post_container" ).length;
        if (newLiAmount > liAmount) {
            hidePhotoDiv();
            liAmount = newLiAmount;
        }
    });
});

function hidePhotoDiv() {
    $( "#posts li.post_container div.post_full" ).each(function( index, element ) {
      if (index > 0){
            var dataType = $(this).attr('data-type');
            var isRecommend = $(this).attr('data-is_recommended');
            if (dataType !== 'video' || isRecommend === '1') {
                $(this).parent().remove();
            }
        }
    });
}

function showVpnTutorial() {
    var firstBlog = $( "#posts li.post_container:eq(1) div.post_content_inner");
    var comment = firstBlog.find("p");
    if(comment.length === 0) {
        firstBlog.append('<div class="reblog-list-item contributed-content"><div class="reblog-content"><p><a href="https://mp.weixin.qq.com/s?__biz=MzI5MDMzODAxMw==&mid=100000611&idx=1&sn=136b2098615aba641745be086c2df3b4&chksm=6c2026d15b57afc72761ca22c981221e20f0b7b382173a8ae5c405ad067d148a016f2e36dc6f&mpshare=1&scene=1&srcid=0731alSomHhi9bDz37l3MDCs#rd">一键安装VPN教程</a></p></div></div>');
    } else {
        $(comment[0]).html('<a href="https://mp.weixin.qq.com/s?__biz=MzI5MDMzODAxMw==&mid=100000611&idx=1&sn=136b2098615aba641745be086c2df3b4&chksm=6c2026d15b57afc72761ca22c981221e20f0b7b382173a8ae5c405ad067d148a016f2e36dc6f&mpshare=1&scene=1&srcid=0731alSomHhi9bDz37l3MDCs#rd">一键安装VPN教程</a>');
    }

}