LinkedIn – Auto 'Send Now' Connect requests for contacts skipping 'Add a Note' prompt

Automatically clicks the 'Send now' button shown in the "You can customize this invitation" box which shows up after clicking Connect button. If you want to Add Note instead for customized request, just temporarily disable this script first. By Dan Moorehead ([email protected]), PowerAccess™ Framework for MS Access (https://www.PowerAccessDB.com/PowerAccess-Framework-MS-Access) and Visual3D Game Engine (https://www.PowerAccessDB.com/Visual3D-Game-Engine) founder.

目前为 2017-07-26 提交的版本。查看 最新版本

// ==UserScript==
// @name		LinkedIn – Auto 'Send Now' Connect requests for contacts skipping 'Add a Note' prompt
// @version		1.0.1
// @description	Automatically clicks the 'Send now' button shown in the "You can customize this invitation" box which shows up after clicking Connect button. If you want to Add Note instead for customized request, just temporarily disable this script first. By Dan Moorehead ([email protected]), PowerAccess™ Framework for MS Access (https://www.PowerAccessDB.com/PowerAccess-Framework-MS-Access) and Visual3D Game Engine (https://www.PowerAccessDB.com/Visual3D-Game-Engine) founder.
// @author		Dan Moorehead ([email protected]), PowerAccess™ Framework for MS Access (https://www.PowerAccessDB.com/PowerAccess-Framework-MS-Access) and Visual3D Game Engine founder
// @copyright	© 2017 Dan Moorehead ([email protected]), PowerAccess™ Framework for MS Access (https://www.PowerAccessDB.com/PowerAccess-Framework-MS-Access) and Visual3D Game Engine (https://www.PowerAccessDB.com/Visual3D-Game-Engine) founder
// @include		/^https?://(www\.)?linkedin\.com/(search/results|in)/.*$/
// @namespace	https://www.PowerAccessDB.com/
// @homepage	https://www.PowerAccessDB.com/PowerAccess-Framework-MS-Access
// @supportURL	https://greasyfork.org/en/scripts/31771-linkedin-auto-send-now-connect-requests-for-contacts-skipping-add-a-note-prompt
// @require		https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @grant       none
// @icon		data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAsSAAALEgHS3X78AAAAFXRFWHRDcmVhdGlvbiBUaW1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Yz2vF5r3hLW3XnUSYjazVojlIVibTowSpUSs1Eol8vhKoUSVLpdOMlQmXBKTRvqgUiItKqhhC+ALfVx6MKijHaAAAAAElFTkSuQmCC
// ==/UserScript==
https://www.linkedin.com/search/results/index/?keywords=AWA%20Access&origin=GLOBAL_SEARCH_HEADER
$(function () {
    'use strict';   //enable function-level strict syntax mode

    //CSS selector to find any button with text "Send now" which is in an Invite actions modal dialog overlay
	var selector = 'section.modal div.send-invite__actions > button.button-primary-large.ml3:contains("Send now")';

    //begin handling late added elements to see if they are a Send now button to click:

	//create alias of MutationObserver class for whatever browser-specific class name is
	var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver ;

	//create observer to inspect elements as added to DOM
	var config = { childList: true, characterData: false, attributes: false, subtree: true };
	var observer = new MutationObserver( function (mutations) {
		mutations.forEach( function (mutation) {
			if (mutation.addedNodes) {
                //find any "Send now" button in descendants of added nodes + then inspect the addedNodes themselves too
                //if found, click them
                 $(mutation.addedNodes).find(selector).addBack(selector).trigger("click");
			}
		});
	});

    //begin observing any node additions anywhere in the document
    observer.observe(document, config);

    //now click any Send now buttons that might already have been loaded before started observing
    $(selector).trigger("click");
});