-
-
Save andysdesigns/1a2002e3265e663004bff404bc546707 to your computer and use it in GitHub Desktop.
Facebook Message Deleter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript: (function () { | |
| const log = function (msg) { | |
| const d = new Date(); | |
| const n = d.toISOString(); | |
| console.log(`${n} - ${msg}`); | |
| }; | |
| const clickMenu = function() { | |
| document | |
| .querySelector('[aria-label="Conversation actions"]') | |
| .click(); | |
| log('Opening the dropdown menu'); | |
| }; | |
| const clickDeleteFromMenu = function () { | |
| document | |
| .getElementsByClassName('uiContextualLayer')[0] | |
| .getElementsByTagName('ul')[0] | |
| .getElementsByClassName('__MenuItem')[3] | |
| .click(); | |
| log('Clicking Delete'); | |
| }; | |
| const clickDeleteButton = function () { | |
| document | |
| .querySelector('[aria-label="Dialog content"]') | |
| .getElementsByTagName('button')[1] | |
| .click(); | |
| log('Confirming Delete'); | |
| }; | |
| const deleteFacebookMessages = function() { | |
| setTimeout(clickMenu, 500); | |
| setTimeout(clickDeleteFromMenu, 800); | |
| setTimeout(clickDeleteButton, 1000); | |
| }; | |
| const messageExist = function () { | |
| return document.querySelector('[aria-label="Conversation List"] li [role="gridcell"]'); | |
| }; | |
| const run = function () { | |
| if ( messageExist !== null || messageExist !== undefined ){ | |
| deleteFacebookMessages(); | |
| } | |
| }; | |
| run(); | |
| })(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment