Last active
June 22, 2019 10:50
-
-
Save EgidioCaprino/e482e922b7ec3ba4ba0efac4033eef5a to your computer and use it in GitHub Desktop.
Run this script on https://www.linkedin.com/messaging/compose/ to empty your messages inbox. You might need to run it more than once.
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
(($) => { | |
'use strict'; | |
const click = button => new Promise(resolve => { | |
$(button).click(resolve).trigger('click'); | |
}); | |
const sleep = timeout => new Promise(resolve => setTimeout(resolve, timeout)); | |
const process = async () => { | |
const conversationListItems = $('.msg-conversation-listitem__link.msg-conversations-container__convo-item-link'); | |
if (conversationListItems.length) { | |
await conversationListItems.toArray().reduce( | |
(promise, conversationListItem) => promise.then(async () => { | |
await click(conversationListItem); | |
const dotButton = $('.msg-thread-actions__dropdown.ember-view')[0]; | |
await click(dotButton); | |
const deleteButton = $('.msg-thread-actions__dropdown-options.artdeco-dropdown-with-arrow.ember-view ul artdeco-dropdown-item')[1]; | |
await click(deleteButton); | |
const yesDeleteButton = $('.artdeco-button.artdeco-button--2.artdeco-button--primary.ember-view')[0]; | |
await click(yesDeleteButton); | |
await sleep(500); | |
}), | |
Promise.resolve(), | |
); | |
await sleep(2000); | |
await process(); | |
} | |
}; | |
process(); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment