// ==UserScript== // @name QQ空间自动删除说说 // @description 一键删除QQ空间所有说说 // @namespace https://greasyfork.org/users/197529 // @version 0.7.8 // @author kkocdko // @license Unlicense // @include *://user.qzone.qq.com/* // @noframes // @downloadURL none // ==/UserScript== let FloatButton = initFloatButton(); new FloatButton('删除所有说说', async function() { this.loop = !this.loop; let appIframe = document.querySelector('.app_canvas_frame'); if (!appIframe){ let switchToTag = confirm('未切换到“说说”标签,是否立即切换?'); if (switchToTag){ document.querySelector('.head-nav-menu>.menu_item_311>a').click(); } else { return; } } let iframeDocument = appIframe.contentWindow.document; while (this.loop) { clickAllEl('.del_btn', iframeDocument); await sleepAsync(2000); clickAllEl('.qz_dialog_layer_sub'); await sleepAsync(1500); nextPage(); await sleepAsync(3000); } function nextPage() { iframeDocument.querySelectorAll('.mod_pagenav_main>a').forEach(el => { if (el.innerText == '下一页') el.click(); }); } }); function clickAllEl(selector, parentNode = document) { parentNode.querySelectorAll(selector).forEach(el => el.click()); } async function sleepAsync(time) { return new Promise(resolve => setTimeout(resolve, time)); } function initFloatButton() { let FloatButton = document.FloatButton = document.FloatButton || (() => { let buttonBarShadow = document.createElement('div').attachShadow({ mode: 'open' });; buttonBarShadow.innerHTML = ''; document.body.append(buttonBarShadow.host); return function(text, onclick) { let button = document.createElement('button'); button.innerText = text; button.addEventListener('click', onclick); buttonBarShadow.append(button); return button; }; })(); return FloatButton; }