Created
June 18, 2018 14:34
-
-
Save bitmvr/2032e0b34908cde0eabc5f29ec1e8cee to your computer and use it in GitHub Desktop.
Facebook Message Deleter
This file contains 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