Greasy Fork

Greasy Fork is available in English.

微博去除推荐内容

try to take over the world!

当前为 2020-09-24 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         微博去除推荐内容
// @namespace    http://tampermonkey.net/
// @version      0.5.7
// @description  try to take over the world!
// @author       You
// @match        *://*.weibo.com/*
// @match        *://*.weibo.cn/*
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.1.1/jquery.min.js
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var change=0;
    if(change==1)
    {
        if(window.location.href.indexOf("https://weibo.com/u/")!=-1)
        {
            let uid = window.location.pathname.substring(window.location.pathname.indexOf("/u/")+3);
            let phoneUrl="https://m.weibo.cn/u/"+uid;
            window.location.href=phoneUrl;
        }
    }
    else if(change==2)
    {
        if(window.location.href.indexOf("/profile/")!=-1)
        {
            let uid = window.location.pathname.substring(window.location.pathname.indexOf("/profile/")+9);
            let PCUrl="https://weibo.com/u/"+uid;
            window.location.href=PCUrl;
        }
        else if(window.location.href.indexOf("https://weibo.cn/u/")!=-1 || window.location.href.indexOf("https://m.weibo.cn/u/")!=-1)
        {
            let uid = window.location.pathname.substring(window.location.pathname.indexOf("/u/")+3);
            let PCUrl="https://weibo.com/u/"+uid;
            window.location.href=PCUrl;
        }
    }


    var style='.PlayInfo_boxout_3UBS0.theatre{'+
        '	height:calc(100%-58px);'+
        '}'+
        '.Detail_wrap_IZQWz.hide{'+
        '	display:none!important;'+
        '}'+
        '.Frame_side2_xRwuq.hide{'+
        '	display:none!important;'+
        '}'


    var timer = setInterval(function(){
        $(".wbpv-star-theatre-control.wbpv-control.wbpv-button").click(function(){
            $(".PlayInfo_boxout_3UBS0").toggleClass("theatre");
            $(".Detail_wrap_IZQWz").toggleClass("hide");
            $(".Frame_side2_xRwuq").toggleClass("hide");
            clearInterval(timer);
        })
    })


    setInterval(function(){

        //新版微博
        //隐藏可能感兴趣的人
        $('[curcarddata="[object Object]"]').hide();

        //隐藏个人主页的关注推荐
        $(".wbpro-side-tit.woo-box-flex.woo-box-alignCenter").each(function(){
            if($(this).text().indexOf("关注推荐")!= -1)
            {
                $(this).closest(".wbpro-side-main").hide();
            }
        })


        //首页展开全文
        $('.Feed_body_3R0rO').each(function(){
            if(!$(this).hasClass("unfold"))
            {
                if($(this).find('.expand').length>0)
                {
                    $(this).find('.expand').removeAttr("href");
                    $(this).find('.expand').get(0).click();
                    let t = $(this);
                    setTimeout(function(){
                        if(t.find('.collapse').length>0)
                        {
                            t.addClass("unfold");
                        }
                    },800)
                }
                else
                {
                    $(this).addClass("unfold");
                }
            }
        })

        //首页展开全文
        $('.WB_feed_detail').each(function(){
            if(!$(this).hasClass("unfold"))
            {
                if($(this).find('[node-type="feed_list_content"] .WB_text_opt[action-type="fl_unfold"]').length>0)
                {
                    $(this).find('[node-type="feed_list_content"] .WB_text_opt[action-type="fl_unfold"]').removeAttr("href");
                    $(this).find('[node-type="feed_list_content"] .WB_text_opt[action-type="fl_unfold"]').get(0).click();
                    let t = $(this);
                    setTimeout(function(){
                        if(t.find('[node-type="feed_list_content_full"]').length>0)
                        {
                            t.addClass("unfold");
                        }
                    },800)
                }
                else
                {
                    $(this).addClass("unfold");
                }
            }
        })

        //转发内嵌的原微博展开全文
        $('.WB_feed_expand').each(function(){
            if(!$(this).hasClass("unfold"))
            {
                if($(this).find('[node-type="feed_list_reason"] .WB_text_opt[action-type="fl_unfold"]').length>0)
                {
                    $(this).find('[node-type="feed_list_reason"] .WB_text_opt[action-type="fl_unfold"]').removeAttr("href");
                    $(this).find('[node-type="feed_list_reason"] .WB_text_opt[action-type="fl_unfold"]').get(0).click();
                    let t = $(this);
                    setTimeout(function(){
                        if(t.find('[node-type="feed_list_reason_full"]').length>0)
                        {
                            t.addClass("unfold");
                        }
                    },800)
                }
                else
                {
                    $(this).addClass("unfold");
                }
            }
        })

        //搜索结果页展开全文
        $('.card-feed').each(function(){
            if(!$(this).hasClass("unfold"))
            {
                if($(this).find('a[action-type="fl_unfold"]').length>0)
                {
                    $(this).find('a[action-type="fl_unfold"]').removeAttr("href");
                    $(this).find('a[action-type="fl_unfold"]').get(0).click();
                    let t = $(this);
                    setTimeout(function(){
                        if(t.find('[node-type="feed_list_content_full"]').length>0)
                        {
                            t.addClass("unfold");
                        }
                    },800)
                }
                else
                {
                    $(this).addClass("unfold");
                }
            }
        })

        if(window.location.href.indexOf("d.weibo.com")!=-1) //发现页
        {
            //发现页展开全文
            $(".content").each(function(){
                if(!$(this).hasClass("unfold"))
                {
                    $(this).addClass("unfold");
                    $(this).find(".txt:nth-of-type(1)").hide();
                    $(this).find(".txt:nth-of-type(2)").show();
                }
            })

            //发现页的话题显示全部文字
            $(".pt_li.S_line2").each(function(){
                if($(this).find(".info_box .S_txt1").text() != $(this).find(".pic_box .pic").attr("alt") )
                {
                    $(this).find(".info_box .S_txt1").text($(this).find(".pic_box .pic").attr("alt"));
                }
            })
        }

        $("h4.title").each(function(){
            if($(this).text().indexOf("广告") >-1)
            {
                $(this).parent().parent().parent().hide();
            }
        })
        $(".W_layer.W_translateZ").each(function(){
            if($(this).text().indexOf("网络繁忙")>-1)
            {
                $(this).hide();
                $(".outer").hide()
            }
        })

        //单条微博评价页居中
        if(!isNaN(parseInt(window.location.pathname.substr(1,10))) && window.location.href.indexOf("d.weibo.com")==-1) //非发现页
        {
            $(".WB_frame").attr("style","display:table; margin:0 auto;");
            $(".WB_frame_c").attr("style","display:table; margin:0 auto;");
            $(".WB_frame_b").hide();
        }


        if(window.location.href.indexOf("d.weibo.com")!=-1) //发现页
        {
            $("#plc_discover").width($("#plc_main").width())
            $(".WB_tab_a .tab_box").attr("style","background: white");
        }
        else
            $("#plc_discover").attr("style","display:table; margin:0 auto;");

        $(".pt_ul.clearfix").width("845px")

        $(".key").hide();
        $(".Slide_show_3dpDk").parent().hide();
        $(".PCD_feed").parent().parent().hide();
        $("#v6_pl_rightmod_hongbao").hide();
        $("#v6_pl_rightmod_rank").hide();
        $("#v6_pl_rightmod_recominfo").hide();
        $("#v6_pl_rightmod_ads36").hide();
        $("#v6_pl_rightmod_attfeed").hide();
        $("#v6_trustPagelet_recom_member").hide();
        $("#v6_pl_rightmod_noticeboard").hide();
        $("#v6_pl_ad_bigday").hide();
        $("#v6_pl_ad_forfqy").hide();
        $("#Pl_Discover_TextList__4").hide();
        $('[node-type="follow_recommend_box"]').hide();
        $('[node-type="recommend"]').hide();
        $('li[node-type="recom_tab"]').hide();
        $(".WB_empty").hide();

        if($('div[node-type="info_unfold"]').length>0 && $('div[node-type="info_unfold"]').css("display")!="none" && !$('div[node-type="info_unfold"]').hasClass("unfold"))
        {
            console.log($('div[node-type="info_unfold"]').css("display"))
            $('div[node-type="info_unfold"]').addClass("unfold");
            $('div[node-type="info_unfold"]').find("a").get(0).click();
        }
        if(!$('li[node-type="comment_tab"]').hasClass("curr"))
        {
            $('li[node-type="comment_tab"]').click();
        }
    },1000)
})();