Discussions » Creation Requests

Facebook archive all messages

§
Posted: 2019-03-28

Facebook archive all messages

Hello Everybody!

This is a simple script:

(function run() {
  let all = document.querySelectorAll('div[aria-label="Beszélgetésműveletek"]');
  if (all.length == 0) return;
  let a = all[0];
  a.click();
  setTimeout(() => {
    document.querySelectorAll('a[role=menuitem]').forEach(act => {
      if (act.innerText.match(/Archiválás/)) act.click();
    });
    run();
  }, 250);
})();

If the Facebook option is set to Hungarian, then with this script I can archive all messages at once when Messenger is open. I currently have to use the Developer Console to run it, I have to paste it into it, and then press an enter.

Set to Facebook in English, this is the correct code:

(function run() {
  let all = document.querySelectorAll('div[aria-label="Conversation actions"]');
  if (all.length == 0) return;
  let a = all[0];
  a.click();
  setTimeout(() => {
    document.querySelectorAll('a[role=menuitem]').forEach(act => {
      if (act.innerText.match(/Archive/)) act.click();
    });
    run();
  }, 250);
})();

I would like someone to write this to see a new button in Messenger, called Archive All. Solved?

wOxxOmMod
§
Posted: 2019-03-29
Edited: 2019-03-29

FWIW you can save the code in devtools snippets - https://developers.google.com/web/tools/chrome-devtools/snippets - which can be later invoked using a mouse or keyboard (ctrl-shift-p, then type the snippet's name).

Post reply

Sign in to post a reply.