From 9595c26519f064579330cd39c13d48fea5a22c3c Mon Sep 17 00:00:00 2001 From: Trung Le Date: Mon, 9 Dec 2024 02:46:51 -0800 Subject: [PATCH] Update rt-html-abs.js --- js/rt-html-abs.js | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/js/rt-html-abs.js b/js/rt-html-abs.js index 9822d22..6eca978 100644 --- a/js/rt-html-abs.js +++ b/js/rt-html-abs.js @@ -276,44 +276,6 @@ function openChat(element) { App.callActionButton(json); } -// rt-html-abs.js -(function(global) { - 'use strict'; - - // Create namespace - global.rtlib = global.rtlib || {}; - - // Add function to namespace - global.rtlib.downloadVCard = function() { - try { - const vCardContent = document.getElementById('vcardTemplate')?.textContent; - if (!vCardContent) { - throw new Error('VCard template not found'); - } - - const fnMatch = vCardContent.match(/FN;CHARSET=utf-8:(.*)/); - const filename = fnMatch ? fnMatch[1].trim() : 'contact'; - - const blob = new Blob([vCardContent], { - type: 'text/vcard;charset=utf-8' - }); - - const downloadUrl = URL.createObjectURL(blob); - const downloadLink = document.createElement('a'); - downloadLink.href = downloadUrl; - downloadLink.download = `${filename}.vcf`; - - document.body.appendChild(downloadLink); - downloadLink.click(); - document.body.removeChild(downloadLink); - - URL.revokeObjectURL(downloadUrl); - } catch (error) { - console.error('Error downloading VCard:', error); - } - }; -})(typeof window !== 'undefined' ? window : global); - document.addEventListener('DOMContentLoaded', () => { const buttons = document.querySelectorAll('.btn'); buttons.forEach(button => {