QQ空间自动删除主页内容

一键删除QQ空间主页内容。不可恢复,慎用!

  1. // ==UserScript==
  2. // @name QQ空间自动删除主页内容
  3. // @description 一键删除QQ空间主页内容。不可恢复,慎用!
  4. // @version 0.0.2
  5. // @author ListeningLTG
  6. // @license Unlicense
  7. // @match *://user.qzone.qq.com/*
  8. // @noframes
  9. // @namespace https://gf.qytechs.cn/users/239917
  10. // ==/UserScript==
  11. 'use strict'
  12. var appIframe=null,iframeDocument=null
  13. addFloatButton('删除所有主页内容', async function () {
  14. this.loop = !this.loop
  15. appIframe = document.querySelector('#QM_Feeds_Container>#QM_Feeds_Iframe')
  16. const qzGrid=document.querySelector('#pageContent')
  17. if (!appIframe||window.getComputedStyle(qzGrid).display=='none') {
  18. const switchToTag = window.confirm('未切换到“主页”标签,是否立即切换?')
  19. if (switchToTag) {
  20. document.querySelector('.head-nav-menu>.menu_item_N1>a').click()
  21. } else {
  22. return
  23. }
  24. return
  25. }
  26. iframeDocument = appIframe.contentWindow.document
  27. while (this.loop) {
  28. clickEl('.arrow-down', iframeDocument)
  29. clickAllEl('.qz_fop_delete', iframeDocument)
  30. clickAllEl('.item', iframeDocument)
  31. await sleepAsync(2000)
  32. clickAllEl('.qz-dark-button')
  33. await sleepAsync(1500)
  34. nextPage()
  35. await sleepAsync(3000)
  36. }
  37.  
  38. function nextPage () {
  39. const btnMore= iframeDocument.querySelector('.data_btn_more')
  40. if(btnMore&&window.getComputedStyle(btnMore).display!='none'){
  41. btnMore.click()
  42. }
  43. const btnNoMore= iframeDocument.querySelector('.data_no_more')
  44. if(btnNoMore&&window.getComputedStyle(btnNoMore).display=='block'){
  45. document.querySelector('#QM_Feeds_Container>#QM_Feeds_Iframe').contentWindow.location.reload();
  46. appIframe = document.querySelector('#QM_Feeds_Container>#QM_Feeds_Iframe')
  47. iframeDocument = appIframe.contentWindow.document
  48. }
  49.  
  50. }
  51. })
  52.  
  53. function clickAllEl (selector, parentNode = document) {
  54. parentNode.querySelectorAll(selector).forEach(el => el.click())
  55. }
  56.  
  57. function clickEl (selector, parentNode = document) {
  58. parentNode.querySelector(selector)&&parentNode.querySelector(selector).dispatchEvent(new MouseEvent('mouseover', { 'bubbles': true }));
  59. }
  60. async function sleepAsync (time) {
  61. return new Promise(resolve => setTimeout(resolve, time))
  62. }
  63.  
  64. function addFloatButton (text, onclick) {
  65. if (!document.addFloatButton) {
  66. const buttonContainer = document.body.appendChild(document.createElement('div')).attachShadow({ mode: 'open' })
  67. buttonContainer.innerHTML = '<style>:host{position:fixed;top:3px;left:3px;z-index:2147483647;height:0}#i{display:none}*{float:left;margin:4px;padding:1em;outline:0;border:0;border-radius:5px;background:#1e88e5;box-shadow:0 1px 4px rgba(0,0,0,.1);color:#fff;font-size:14px;line-height:0;transition:.3s}:active{background:#42a5f5;box-shadow:0 2px 5px rgba(0,0,0,.2)}button:active{transition:0s}:checked~button{visibility:hidden;opacity:0;transform:translateY(-3em)}label{border-radius:50%}:checked~label{opacity:.3;transform:translateY(3em)}</style><input id=i type=checkbox><label for=i></label>'
  68. document.addFloatButton = (text, onclick) => {
  69. const button = document.createElement('button')
  70. button.textContent = text
  71. button.addEventListener('click', onclick)
  72. return buttonContainer.appendChild(button)
  73. }
  74. }
  75. return document.addFloatButton(text, onclick)
  76. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址