DeleteAllWeibo

DeleteAllWeibo.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         DeleteAllWeibo
// @namespace    http://www.n0tyet.com/
// @version      0.2
// @description  DeleteAllWeibo.
// @author       n0tyet
// @match        https://weibo.com/p/*
// @grant        unsafeWindow
// @require      https://code.jquery.com/jquery-3.3.1.min.js
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';
    let autoDelete = 1;
    window.setTimeout(function(){
        let hInterval = null;
        let deletedCount = 0;
        function updateDeletingText() {
            button.text('Deleting...[' + deletedCount.toString() + ']');
        }
        function setWaitForDeleteText(){
            button.text('Delete[' + deletedCount.toString() + ']');
        }
        function doDelete(){
            updateDeletingText();
            hInterval = window.setInterval(function() {
                if ($('a[action-type="feed_list_delete"]').length === 0) {
                    setWaitForDeleteText();
                    window.clearInterval(hInterval);
                } else {
                    deletedCount++;
                    updateDeletingText();
                    $('a[action-type="feed_list_delete"]')[0].click();
                    $('a[action-type="ok"]')[0].click();
                    if (autoDelete) {
                        $('html, body').animate({ scrollTop: $(document).height() }, 'slow');
                    }
                }
            }, 700);
        }
        let button = $('<button>Delete</button>')
        .attr('type', 'button')
        .click(doDelete)
        .appendTo('div.gn_header');
        if (autoDelete) {
            doDelete();
        }
    }, 500);
})();