enesser / vCards-js

Create vCards to import contacts into Outlook, iOS, Mac OS, and Android devices from your website or application.
MIT License
430 stars 158 forks source link

Custom urls and uploading #59

Open kennethbrent opened 3 years ago

kennethbrent commented 3 years ago

Can we add custom urls similar to how we add custom socials? Something like vcard.url[custom] = 'http://mycustomurl.com'. From what I can tell the only options right now are url and work url and in my scenario url is used by their website and 'work' is not the appropriate title or category for the additional url i want to add. Also, what if we had 3 urls?

vijaysolankiii commented 2 years ago

add this following code inside node_modules/vcards-js/lib/vCardFormatter.js if (vCard.socialUrls) { let index = 0; for (var key in vCard.socialUrls) { index++; if (vCard.socialUrls.hasOwnProperty(key) && vCard.socialUrls[key]) { formattedVCardString += "item" + index + ".URL:" + vCard.socialUrls[key] + nl(); formattedVCardString += "item" + index + ".X-ABLabel:" + key + nl(); formattedVCardString += "X-SOCIALPROFILE" + encodingPrefix + ";type=" + key + ":" + e(vCard.socialUrls[key]) + nl(); } } }