WhatsApp Web Archived Remover

Remove the Archived row from WhatsApp Web

  1. // ==UserScript==
  2. // @name WhatsApp Web Archived Remover
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Remove the Archived row from WhatsApp Web
  6. // @author Dequei
  7. // @match https://web.whatsapp.com/
  8. // @icon https://web.whatsapp.com/img/favicon/1x/favicon.png
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12. (function() {
  13. 'use strict';
  14.  
  15.  
  16. function removeArchivedRow() {
  17.  
  18. console.info('Archived row remove: start');
  19.  
  20. const archivedRow = document.getElementById('pane-side');
  21.  
  22. if (archivedRow) {
  23.  
  24. const buttonArchived = document.getElementById('pane-side').children[0];
  25.  
  26. if (document.getElementById('pane-side').children[0]?.innerText.toLowerCase().includes('archiv')) {
  27.  
  28. document.getElementById('pane-side').children[0].style.display = 'none';
  29.  
  30. console.info('Archived row remove: done');
  31. }
  32.  
  33.  
  34. } else {
  35. failedInfo();
  36. }
  37. }
  38.  
  39. function waitForElement(querySelector, timeout) {
  40. return new Promise((resolve, reject) => {
  41. var timer = false;
  42. if (document.querySelectorAll(querySelector).length) return resolve();
  43. const observer = new MutationObserver(() => {
  44. if (document.querySelectorAll(querySelector).length) {
  45. observer.disconnect();
  46. if (timer !== false) clearTimeout(timer);
  47. return resolve();
  48. }
  49. });
  50. observer.observe(document.body, {
  51. childList: true,
  52. subtree: true
  53. });
  54. if (timeout) timer = setTimeout(() => {
  55. observer.disconnect();
  56. reject();
  57. }, timeout);
  58. });
  59. }
  60.  
  61. function failedInfo() {
  62. console.info('Archived row remove: failed');
  63. }
  64.  
  65. waitForElement("#pane-side", 60000).then(function() {
  66. removeArchivedRow();
  67. }).catch(() => {
  68. failedInfo();
  69. });
  70.  
  71.  
  72.  
  73. })();

QingJ © 2025

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