diff --git a/js/rt-html-abs.js b/js/rt-html-abs.js
index 906809a..bbc0b3c 100644
--- a/js/rt-html-abs.js
+++ b/js/rt-html-abs.js
@@ -160,7 +160,7 @@ function openLocation(element) {
App.callActionButton(json);
}
-function shareContent(element) {
+function (element) {
const actionData = {
actionID: 9004,
orderNumber: 1,
@@ -276,6 +276,34 @@ function openChat(element) {
App.callActionButton(json);
}
+function downloadVCard() {
+ // Get VCard content and ensure proper line endings
+ const vCardContent = document.getElementById('vcardTemplate').textContent;
+
+ // Extract FN field for filename
+ const fnMatch = vCardContent.match(/FN;CHARSET=utf-8:(.*)/);
+ const filename = fnMatch ? fnMatch[1].trim() : 'contact';
+
+ // Create blob with proper encoding
+ const blob = new Blob([vCardContent], {
+ type: 'text/vcard;charset=utf-8'
+ });
+
+ // Create download link
+ const downloadUrl = URL.createObjectURL(blob);
+ const downloadLink = document.createElement('a');
+ downloadLink.href = downloadUrl;
+ downloadLink.download = `${filename}.vcf`;
+
+ // Trigger download
+ document.body.appendChild(downloadLink);
+ downloadLink.click();
+ document.body.removeChild(downloadLink);
+
+ // Cleanup
+ URL.revokeObjectURL(downloadUrl);
+}
+
document.addEventListener('DOMContentLoaded', () => {
const buttons = document.querySelectorAll('.btn');
buttons.forEach(button => {