微博 - 自动批量删除微博 2019-09-02 可用

批量删除微博

目前為 2019-09-02 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         微博 - 自动批量删除微博 2019-09-02 可用
// @namespace    http://tuite.fun
// @version      1.8
// @description  批量删除微博
// @author       tuite
// @match        https://weibo.com/*/profile*
// @match        https://weibo.com/p/*/home*
// @grant        none
// ==/UserScript==
(function() {
    'use strict';

    /**
     * 【微博】自动批量删除微博
     * 1.搜索想要删除的微博(可不搜索)
     * 2.将页面滑到最底部加载完本页全部微博
     * 3.点击浏览器页面最右端的开始删除按钮
     * 4.弹出提示框,点击确认按钮(不可逆,可停止,需谨慎)
     * 
     * * 本脚本默认从本页面第一条微博开始删除,直到本页微博全部删除;
     * * 中途停止删除请按浏览器最右端的停止删除按钮;
     * * 已删除的微博不可恢复,请谨慎操作;
     * * 点击确认后一秒执行,请耐心等待
     *
     * coder Email: [email protected]
     */
    
    // 定时器id
    var intervalIndex = document.createElement('input');
    intervalIndex.style.cssText = 'display:none';
    intervalIndex.id = 'hao_jiu.intervalIndex';
    document.body.appendChild(intervalIndex);
    
    // 开始按钮
    var startBtn = document.createElement('button');
    startBtn.style.cssText = 'position: fixed; right:0; top: 40%;';
    startBtn.innerHTML = '开始删除';
    startBtn.onclick = function () {
        if(confirm("【微博】自动批量删除微博\n说明:\n1.搜索想要删除的微博(可不搜索)\n2.将页面滑到最底部加载完本页全部微博\n3.点击浏览器页面最右端的开始删除按钮\n4.弹出提示框,点击确认按钮(不可逆,可停止,需谨慎)\n\n* 本脚本默认从本页面第一条微博开始删除,直到本页微博全部删除;\n* 中途停止删除请按浏览器最右端的停止删除按钮;\n* 已删除的微博不可恢复,请谨慎操作;")) {
            initDel()
        }
    };
    document.body.appendChild(startBtn);
    
    // 停止按钮
    var endBtn = document.createElement('button');
    endBtn.style.cssText = 'position: fixed; right:0; top: 45%;';
    endBtn.innerHTML = '停止删除';
    endBtn.onclick = function () {window.clearInterval(document.getElementById('hao_jiu.intervalIndex').value);};
    document.body.appendChild(endBtn);
})();

// 初始化定时器
function initDel() {
    //1.35秒执行一次删除
    var intervalInt = self.setInterval(function(){
            if (document.querySelector('a[action-type="feed_list_delete"]')) {
                document.querySelector('a[action-type="feed_list_delete"]').click();
                document.querySelector('a[node-type="ok"]').click();
            } else {
                window.clearInterval(document.getElementById('hao_jiu.intervalIndex').value)
            }
         }, 1350);
    var intervalIntInput = document.getElementById('hao_jiu.intervalIndex');
    intervalIntInput.value = intervalInt;
}