Skip to content

Instantly share code, notes, and snippets.

@Vlasterx
Last active January 19, 2024 18:33
Show Gist options
  • Save Vlasterx/b244b9b27ade8a6dd7eb2ffd3aae8d99 to your computer and use it in GitHub Desktop.
Save Vlasterx/b244b9b27ade8a6dd7eb2ffd3aae8d99 to your computer and use it in GitHub Desktop.
Delete all LinkedIn posts version for June 2021.
(() => {
let speedMs = 500
setInterval(() => {
let dropdown = document.querySelector('.feed-shared-update-v2__control-menu .artdeco-dropdown button')
dropdown.click()
setTimeout(() => {
let optionDel = dropdown.parentElement.parentElement.parentElement.querySelector('.option-delete .tap-target')
if (optionDel === null) {
setTimeout(() => { window.scrollTo(0,document.body.scrollHeight) }, speedMs * 4)
} else {
optionDel.click()
setTimeout(() => {
document.querySelector('.artdeco-modal .feed-shared-decision-modal__confirm-button').click()
}, speedMs)
}
}, speedMs)
}, speedMs)
})()
@Vlasterx
Copy link
Author

Vlasterx commented Jun 9, 2021

Open your LinkedIn profile, find See all activity, click on posts, open developer tools with F12, find console, paste the code above and press enter.

@Vlasterx
Copy link
Author

Vlasterx commented Jun 14, 2021

This is minified code for the bookmarklet. Create new bookmark and copy this code to URL, then click on it on profile > see all activity > posts page

javascript:(()=>{let speedMs=500;setInterval(()=>{let dropdown=document.querySelector('.feed-shared-update-v2__control-menu .artdeco-dropdown button');dropdown.click();setTimeout(()=>{let optionDel=dropdown.parentElement.parentElement.parentElement.querySelector('.option-delete .tap-target');if(optionDel===null){setTimeout(()=>{window.scrollTo(0,document.body.scrollHeight)},speedMs*4)}else{optionDel.click();setTimeout(()=>{document.querySelector('.artdeco-modal .feed-shared-decision-modal__confirm-button').click()},speedMs)}},speedMs)},speedMs)})();

@KHannibal
Copy link

Works like a charm, thanks ! Could you add a refresh function or a click on the "Show more results" button after X iterations ?

@BilalTariq01
Copy link

BilalTariq01 commented Nov 7, 2023

2023 updated version

(() => {
  let speedMs = 500

  setInterval(() => {
    let dropdown = document.querySelector('.feed-shared-update-v2__control-menu .artdeco-dropdown button')

    dropdown.click()

    setTimeout(() => {
      let optionDel = dropdown.parentElement.parentElement.parentElement.querySelector('.option-delete .tap-target')
      
      if (optionDel === null) {
        // setTimeout(() => { window.scrollTo(0,document.body.scrollHeight) }, speedMs * 4)
      } else {
        optionDel.click()
  
        setTimeout(() => {
          document.querySelector('.artdeco-modal .feed-components-shared-decision-modal__confirm-button').click()
        }, speedMs)
      }
    }, speedMs)
  }, speedMs)
})()

@Rideout421
Copy link

Having to click the delete button each time for the post to remove. One click is much better then the alternative. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment