Auto delete weibo

自动删除你的所有微博

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);
    });
})();