Created
March 4, 2019 09:59
-
-
Save evianzhow/2c251e6f6859f5599119e977c8d72bde to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const contList = document.querySelector('.contList'); | |
const mailAddresses = []; | |
contList.querySelectorAll('ul').forEach(function(node) { | |
const name = node.querySelector('.firstLine').textContent.trim(); | |
const mail_address = node.querySelector('.mailAddress').textContent.trim(); | |
mailAddresses.push([name, mail_address]); | |
}); | |
let csvContent = "data:text/csv;charset=utf-8,"; | |
let rows = mailAddresses | |
rows.forEach(function(rowArray) { | |
let row = rowArray.join(","); | |
csvContent += row + "\r\n"; | |
}); | |
var encodedUri = encodeURI(csvContent); | |
window.open(encodedUri); | |
// http://phrogz.net/js/csv2vcard_2.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment