QQ邮箱增强

Violentmonkey Scripts

目前为 2023-05-06 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name QQ邮箱增强
  3. // @namespace Violentmonkey Scripts
  4. // @match *://mail.qq.com/*
  5. // @grant none
  6. // @version XiaoYing_2023.05.25.13
  7. // @grant GM_info
  8. // @grant GM_getValue
  9. // @grant GM_setValue
  10. // @grant GM_addStyle
  11. // @grant GM_deleteValue
  12. // @grant GM_xmlhttpRequest
  13. // @grant GM_setClipboard
  14. // @grant GM_registerMenuCommand
  15. // @grant GM_unregisterMenuCommand
  16. // @grant GM_getResourceText
  17. // @grant GM_getResourceURL
  18. // @grant GM_openInTab
  19. // @grant unsafeWindow
  20. // @run-at document-start
  21. // @author github.com @XiaoYingYo
  22. // @require https://gf.qytechs.cn/scripts/464929-module-jquery-xiaoying/code/module_jquery_XiaoYing.js
  23. // @require https://gf.qytechs.cn/scripts/464780-global-module/code/global_module.js
  24. // @description Violentmonkey Scripts
  25. // ==/UserScript==
  26.  
  27. var global_module = window['global_module'];
  28.  
  29. var Func = new Map();
  30. Func.set('delMail', async () => {
  31. let op = await global_module.waitForElement("div[class^='dialog_operate']", null, null);
  32. let confirm = $(op).find('a').eq(0);
  33. global_module.clickElement(confirm[0]);
  34. });
  35. Func.set('frame_html.html', async () => {
  36. window.addEventListener(
  37. 'message',
  38. (event) => {
  39. let data = event.data;
  40. if (data.origin !== 'QQ邮箱增强') {
  41. return;
  42. }
  43. let func = data.func;
  44. if (!Func.has(func)) {
  45. return;
  46. }
  47. Func.get(func)();
  48. },
  49. false
  50. );
  51. let clearRecycleBin = async () => {
  52. let folder_5 = $("li[id='folder_5_td']").eq(0);
  53. let a = folder_5.find('a');
  54. if (a.length === 1) {
  55. return;
  56. }
  57. $(a[1]).on('click', async () => {
  58. console.log('delMail');
  59. Func.get('delMail')();
  60. });
  61. };
  62. let observer = new MutationObserver((mutations) => {
  63. for (let mutation of mutations) {
  64. let Element = mutation.target;
  65. let id = $(Element).attr('id');
  66. if (id !== 'navMidBar') {
  67. continue;
  68. }
  69. clearRecycleBin();
  70. return;
  71. }
  72. });
  73. clearRecycleBin();
  74. let navMidBar = await global_module.waitForElement('div#navMidBar', null, null, -1);
  75. observer.observe(navMidBar.eq(0)[0], { childList: true, subtree: true });
  76. });
  77. Func.set('readmail.html', async () => {
  78. let delMail = await global_module.waitForElement("a[ck='delMail'][opt]", null, null, -1);
  79. for (let i = 0; i < delMail.length; i++) {
  80. let Item = delMail[i];
  81. $(Item).on('click', async () => {
  82. window.parent.postMessage({ origin: 'QQ邮箱增强', func: 'delMail' }, '*');
  83. });
  84. }
  85. });
  86. Func.set('mail_list.html', async () => {
  87. let delMail = await global_module.waitForElement("a[id='quick_completelydel'][class]", null, null, -1);
  88. for (let i = 0; i < delMail.length; i++) {
  89. let Item = delMail[i];
  90. $(Item).on('click', async () => {
  91. window.parent.postMessage({ origin: 'QQ邮箱增强', func: 'delMail' }, '*');
  92. });
  93. }
  94. });
  95.  
  96. (async () => {
  97. let path = window.location.pathname;
  98. let last = path.lastIndexOf('/');
  99. let name = path.substring(last + 1) + '.html';
  100. if (!Func.has(name)) {
  101. return;
  102. }
  103. Func.get(name)();
  104. })();

QingJ © 2025

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