Greasy Fork

Greasy Fork is available in English.

delete-sina-weibo-posts

删除所有微博,需要进入个人页面才会触发;删除微博代码取自:https://gist.github.com/mariotaku/e00b6b93663f2f420ef9

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         delete-sina-weibo-posts
// @namespace    https://ox0spy.github.io/
// @version      0.2
// @description  删除所有微博,需要进入个人页面才会触发;删除微博代码取自:https://gist.github.com/mariotaku/e00b6b93663f2f420ef9
// @author       ox0spy
// @match        https://weibo.com/*/profile*
// @match        https://www.weibo.com/*/profile*
// @match        https://weibo.com/*/profile*
// @match        https://www.weibo.com/*/profile*
// @match        https://weibo.com/p/*
// @match        https://www.weibo.com/p/*
// @compatible   chrome  支持
// @run-at       document-idle
// @grant        none
// ==/UserScript==

'use strict';

window.setTimeout(deletePosts,1000 * 3);

function deletePosts() {
    var http = new XMLHttpRequest();
    var anchors = document.getElementsByTagName("div");
    var i = 0;
    for (i = 0; i < anchors.length; i++) {
        // 找到有mid属性的div元素
        var mid = anchors[i].getAttribute("mid");
        if (mid) {
            console.log("Deleting " + mid);
            // 这是微博的删除接口
            var url = "/aj/mblog/del?ajwvr=6";
            var params = "mid=" + mid;
            http.open("POST", url, false);
            //Send the proper header information along with the request
            http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            http.send(params);
        }
    }

    window.location.reload();
}