Created
May 29, 2018 23:38
-
-
Save wilt00/7b7c0edf80f5837808473b86e639d99f to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name LinkedIn Hide Invite | |
// @version 1 | |
// @match *://www.linkedin.com/mynetwork/ | |
// @grant none | |
// @run-at document-idle | |
// ==/UserScript== | |
(function () { | |
console.log("Started LinkedIn Hide Invite script"); | |
function hideInvites(cards) { | |
Array.prototype.map.call(cards, function(elem) { | |
if (elem.getElementsByClassName("button-secondary-small")[0].children[0].innerText === "Invite") { | |
elem.setAttribute("style", "visibility: collapse;") | |
} | |
}); | |
} | |
var listRoot = document.getElementsByClassName("mn-pymk-list__cards")[0]; | |
console.log("listRoot: " + listRoot); | |
hideInvites(listRoot.children); | |
var config = { | |
childList: true, | |
} | |
/* | |
var observer = new MutationObserver( function(mutationsList) { | |
console.log("Running observer callback (addedNodes2)"); | |
for (var mut of mutationsList) { | |
console.log(mut); | |
hideInvites(mut.addedNodes); | |
globalMut = mut; | |
} | |
}); | |
*/ | |
var observer = new MutationObserver( function(mutationsList) { | |
console.log("Running LinkedIn Hide Invite script observer callback"); | |
hideInvites(listRoot.children); | |
}); | |
observer.observe(listRoot, config); | |
console.log("Finished LinkedIn Hide Invite script"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment