Created
December 17, 2019 21:23
-
-
Save worc/5cd274a56257e2ddf476b8710ca904ed to your computer and use it in GitHub Desktop.
a quick and bashy way to delete all linked in conversations
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
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