LinkedIn - Hide Invite-only Email Contacts in People You May Know

Hides the fake email-only contact cards to "Invite" which are mixed in with real profiles you can "Connect" to for LinkedIn.com - My Network - "People You May Know"

目前為 2017-07-25 提交的版本,檢視 最新版本

// ==UserScript==
// @name		LinkedIn - Hide Invite-only Email Contacts in People You May Know
// @namespace	https://www.PowerAccessDB.com/
// @homepage	https://www.PowerAccessDB.com/
// @version		1.0.1
// @description	Hides the fake email-only contact cards to "Invite" which are mixed in with real profiles you can "Connect" to for LinkedIn.com - My Network - "People You May Know"
// @match		https://www.linkedin.com/mynetwork/*
// @match		http://www.linkedin.com/mynetwork/*
// @iconUrl		https://www.linkedin.com/favicon.ico
// @copyright	© 2017 Dan Moorehead ([email protected]), developer of PowerAccess™ Framework (https://www.PowerAccessDB.com)
// @author		Dan Moorehead ([email protected]), developer of PowerAccess™ Framework (https://www.PowerAccessDB.com)
// @require		https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @supportURL	https://gf.qytechs.cn/en/scripts/31736-linkedin-hide-invite-only-email-contacts-in-people-you-may-know
// ==/UserScript==

$(function () {

	var selector = 'li.mn-person-info--card > div.pt3';
	var listSelector = 'ul.mn-pymk-list__cards'
	
	// LinkedIn People You May Know DOM structure:
	//	ul.mn-pymk-list__cards > li.mn-pymk-list__card.display-flex.flex-column 
	//		> div.mn-person-info.mn-person-info--card.ember-view
	//			>  a.pt3 (for existing Profiles to Connect to) OR
	//		OR 	> div.pt3 (for emails to Invite)

    $(selector).parent().remove();

    // Remove any email-only contacts which get delay/auto-loaded in the background
	
	//create alias of MutationObserver class for whatever browser-specific class name is
    var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver ;
    
	//create observer to handle new elements being added later
	var config = { childList: true, characterData: false, attributes: false, subtree: true };
    var observer = new MutationObserver( function (mutations) {
        mutations.forEach( function (mutation) {
            if (mutation.addedNodes) { 
                $(mutation.addedNodes).each( function () {
				
					//remove fake invite-only contact card if was just inserted on delay load here
                    
					$(this).find(selector).parent().remove();
					
					//OR: $(this).find(selector).each( function () { console.log("LinkedIn fake connect (email only invite) contact card removed by user script: ", $(this).find('span.mn-person-info__guest-handle').text() );  $(this).remove(); }
                } );
            }
        });
    });

	//have observer watch the ul parent to handle when any li list item contact card are dynamically inserted / paged into it / delay loaded
    $(listSelector).each( function () { observer.observe(this, config); } );
	
	//MAYBE: If list ul gets delay loaded too, can check if list not found yet (via listSelector), and, if not, observe for entire document and add the item observer to any dynamically inserted list
});

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址