Skip to content

Instantly share code, notes, and snippets.

@junaidkbr
Last active August 30, 2022 12:20
Show Gist options
  • Save junaidkbr/753853632d08ae70db74776b1a43ccc8 to your computer and use it in GitHub Desktop.
Save junaidkbr/753853632d08ae70db74776b1a43ccc8 to your computer and use it in GitHub Desktop.
Unfollow and Remove LinkedIn Connection
/**
* Quickly unfollow and remove from connections
* the LinkedIn connection you're currently viewing
*
* Enter the source code in browser Dev Tools or
* bookmark the bookmarlet version for one-click solution
*/
/* Source Code Start */
const actionsWrapper = document.querySelector('#main .pvs-profile-actions > *:last-child > div');
const actions = document.querySelectorAll('#main .pvs-profile-actions > *:last-child div[role="button"]');
// show the actions wrapper
// a satisfying sight!
actionsWrapper.style.visibility = 'visible';
actionsWrapper.style.opacity = 1;
actionsWrapper.style.zIndex = 1;
// simulate click on Unfollow and Remove Connection actions
// relieved!
actions.forEach(action => {
if (action.textContent.indexOf('Unfollow') !== -1 || action.textContent.indexOf('Remove Connection') !== -1) {
action.click();;
}
});
/* Source Code End */
/**
* Browser bookmarklet; one-liner
* Created with https://mrcoles.com/bookmarklet/
*/
javascript:(function()%7Bconst%20actionsWrapper%20%3D%20document.querySelector('%23main%20.pvs-profile-actions%20%3E%20*%3Alast-child%20%3E%20div')%3Bconst%20actions%20%3D%20document.querySelectorAll('%23main%20.pvs-profile-actions%20%3E%20*%3Alast-child%20div%5Brole%3D%22button%22%5D')%3BactionsWrapper.style.visibility%20%3D%20'visible'%3BactionsWrapper.style.opacity%20%3D%201%3BactionsWrapper.style.zIndex%20%3D%201%3Bactions.forEach(action%20%3D%3E%20%7Bif%20(action.textContent.indexOf('Unfollow')%20!%3D%3D%20-1%20%7C%7C%20action.textContent.indexOf('Remove%20Connection')%20!%3D%3D%20-1)%20%7Baction.click()%3B%7D%7D)%7D)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment