Skip to content

Instantly share code, notes, and snippets.

@Technetium1
Last active October 11, 2019 01:22
Show Gist options
  • Save Technetium1/0ebee3babc4bebd7a20c79801fdc46a1 to your computer and use it in GitHub Desktop.
Save Technetium1/0ebee3babc4bebd7a20c79801fdc46a1 to your computer and use it in GitHub Desktop.
Don't scroll too fast or it won't be able to keep up. Results can be retrieved from local storage.
// ==UserScript==
// @name Export Google Domain Directory Contacts
// @version 1.0
// @description Export Google Contacts Domain Directory to LocalStorage
// @match *://contacts.google.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
//- The @grant directive is needed to restore the proper sandbox.
waitForKeyElements (".PDfZbf", printNodeText2name);
waitForKeyElements (".hUL4le", printNodeTextEmail);
function printNodeTextEmail (jNode) {
var bacon = jNode.text().trim();
appendToStorage('emails', bacon);
console.log("PROCESSED!");
}
function printNodeText2name (jNode) {
//console.log ("NAME: ", jNode.text().trim() );
var eggs = jNode.text().trim();
appendToStorage('names', eggs);
}
function appendToStorage(name, data){
var old = localStorage.getItem(name);
if(old === null) old = "";
localStorage.setItem(name, old + ", " + data);
}
//for(var i =0; i < localStorage.length; i++){
// console.log(localStorage.getItem(localStorage.key(i)));
//}
//sleep(50);
//window.scrollBy(0, 80);
//setTimeout(function(){".yDmH0d".scrollBy(0, 100);},500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment