Weibo Lite (无干扰新浪微博)

Clear the ads and add a toggle button to hide/show bottom bar and side bars.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name            Weibo Lite (无干扰新浪微博)
// @namespace       https://github.com/adelabs
// @description     Clear the ads and add a toggle button to hide/show bottom bar and side bars.
// @version         2.1.1
// @license         GPL version 3
// @include         *://weibo.com/*
// @require         http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @grant           none
// @run-at          document-end
// ==/UserScript==

// Add a button.
var button = $('<button></button>');
$('div.W_main_a').before(button.hide());
// Function the button.
var speed = 250;
button.text('hide').click(function(){
    var bars = $('div.W_main_l, div.W_main_r, div.global_footer');
    if (button.text() == 'hide') {
       bars.hide(speed, function(){button.text('show');});
    } else {
       bars.fadeIn(speed, function(){button.text('hide');});
    }
});
// Show the button and then toggle.
button.show(speed, function(){button.click();});

// Hide ads.
function hide_ads() {
    console.log('hide_ads');
    var ads = $([
        // Tips
        'div.layer_tips_version',
        // Header ads
        'div.pl_content_biztips',
        'div.tips_wrapper',
        'div.tips_player',
        'div.title_area',
        // Left side ads
        // Right side ads
        'div.adver_contB',
        'div#pl_rightmod_ads36',
        'div.M_activities',
        'div.M_abverArea',
        // Mid ads
        'div.W_no_border',
        'div.WB_feed_type[feedtype="ad"]',
        // Footer ads
        'div.footer_adv',
    ].join());
    ads.each(function(){
        if ($(this).css('display') == 'none') { return; }
        console.log('Hide', this);
        $(this).remove();
    });
}
// Observe and repeat
$([
   'body',
   'div.W_miniblog',
   'div.WB_feed',
].join()).each(function(i, o){
    var observer = new MutationObserver(function(mutations) {
        hide_ads();
    });
    observer.observe(o, {childList: true});
});