// ==UserScript==
// @name QQ空间自动删除说说
// @description 一键删除QQ空间所有说说
// @namespace https://greasyfork.org/users/197529
// @version 0.7.4
// @author kkocdko
// @include *://user.qzone.qq.com/*
// @noframes
// @downloadURL none
// ==/UserScript==
let FloatButton = document.FloatButton = document.FloatButton || (() => {
let buttonBarShadow = document.createElement('div').attachShadow({ mode: 'open' });;
buttonBarShadow.innerHTML = '';
document.body.appendChild(buttonBarShadow.host);
return function(text, onclick) {
let button = document.createElement('button');
button.innerText = text;
button.addEventListener('click', onclick);
buttonBarShadow.appendChild(button);
return button;
};
})();
async function sleepAsync(time) {
return new Promise(resolve => setTimeout(resolve, time));
}
function clickAll(selector, parentNode = document) {
parentNode.querySelectorAll(selector).forEach(el => el.click());
}
new FloatButton('删除所有说说', async () => {
let iframeDocument = document.querySelector('.app_canvas_frame').contentWindow.document;
while (true) {
clickAll('.del_btn', iframeDocument);
await sleepAsync(1000);
clickAll('.qz_dialog_layer_sub', iframeDocument);
await sleepAsync(1000);
nextPage();
await sleepAsync(1000);
}
function nextPage() {
iframeDocument.querySelector('.mod_pagenav_main>a').forEach(el => {
if (el.innerText == '下一页') {
el.click();
return;
}
});
}
});