// ==UserScript==
// @name 汤不热首页只显示视频,并去掉推荐内容(Tumblr Show only video on the Dashboard and remove the recommended content)
// @namespace http://tampermonkey.net/
// @version 1.2
// @description 首页只显示视频,并去掉推荐内容(Tumblr Show only video on the Dashboard and remove the recommended content)
// @author Frank
// @match https://www.tumblr.com/dashboard
// @grant none
// @downloadURL none
// ==/UserScript==
var $ = window.jQuery;
var liAmount = 0;
var tutorial1 = '翻墙教程一(使用VPN)';
var tutorial2 = '翻墙教程二(搭建ssr)';
var tutorial = '
'+tutorial1+'
'+tutorial2+'
';
$(document).ready(function(){
hidePhotoDiv();
$(window).scroll(function(event){
var newLiAmount = $( "#posts li.post_container" ).length;
if (newLiAmount > liAmount) {
liAmount = newLiAmount;
hidePhotoDiv();
}
});
});
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') {
// remove有时会失效,使用hide
$(this).parent().hide();
}
}
});
showVpnTutorial();
}
function showVpnTutorial() {
var firstBlog = $( "#posts li.post_container div.is_video:eq(0) div.post_content_inner");
var comment = firstBlog.find("div.reblog-content");
if(comment.length === 0) {
firstBlog.append('');
} else {
$(comment[0]).html(tutorial);
}
}