Skip to content

Instantly share code, notes, and snippets.

@worc
Created December 17, 2019 21:23
Show Gist options
  • Save worc/5cd274a56257e2ddf476b8710ca904ed to your computer and use it in GitHub Desktop.
Save worc/5cd274a56257e2ddf476b8710ca904ed to your computer and use it in GitHub Desktop.
a quick and bashy way to delete all linked in conversations
function openDropdown () {
document.querySelector('li-icon[type="ellipsis-horizontal-icon"]').click()
return new Promise((resolve) => {
setTimeout(() => {
resolve('opened dropdown')
}, 125)
})
}
function clickDelete () {
document.querySelectorAll('.msg-thread-actions__dropdown-container artdeco-dropdown-item')[1].click()
return new Promise((resolve) => {
setTimeout(() => {
resolve('clicked delete')
}, 125)
})
}
function confirm () {
document.querySelector('.artdeco-button--primary').click()
return new Promise((resolve) => {
setTimeout(() => {
resolve('confirmed')
}, 125)
})
}
function conversationListLength () {
return document.querySelectorAll('.msg-conversations-container__conversations-list li').length
}
async function deleteCurrentConversation () {
return openDropdown().then(() => clickDelete().then(() => confirm()))
}
async function deleteAllConversations () {
while (conversationListLength() > 0) {
await deleteCurrentConversation()
}
}
// deleteAllConversations()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment