Auto delete weibo

自动删除你的所有微博

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Auto delete weibo
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  自动删除你的所有微博
// @author       ihipop
// @match        https://www.weibo.com/p/*/home?is_all=1&delete=yes
// @grant        none
// @require http://libs.baidu.com/jquery/2.1.1/jquery.min.js
// ==/UserScript==

(function() {
    'use strict';
    $(function($) {
        var deleteTimer = setInterval(function() { //使用一个定时器来防止操作频繁的提示
            if (!$('a[action-type="feed_list_delete"]').length) {
                clearInterval(deleteTimer) //在重载页面的时候不反复发起页面重载
                if (parseInt($('#Pl_Core_T8CustomTriColumn__3 span:contains("微博")').parent().text()) >= 10) { //判断是否还剩余微博 微博后期更新页面结构可能需要更改此处
                    setInterval(function() {
                        location.href = location.href; //在删除很老的微博的时候,加载会很慢 这里设置一个超时避免频繁刷新或者刷新失败
                    }, 10 * 1000)
                } else {
                    alert('清理结束');
                }
            } else {
                $('a[action-type="feed_list_delete"]')[0].click();
                $('a[action-type="ok"]')[0].click();
                try {
                    $('.W_layer_close a')[0].click(); //如果出现操作频繁提示就关掉她
                } catch (error) {
                    console.log(error)
                }
            }
        }, 800);
    });
})();