Privacy Policy Generator
} else if (formattedText.charAt(i) === '<') {
var tagEnd = formattedText.indexOf('>', i) + 1;
charToAdd = formattedText.substring(i, tagEnd);
i = tagEnd - 1;
}
message.append(charToAdd);
i++;
setTimeout(typeWriter, speed);
} else {
var copyIcon = $('
📋
').appendTo(container);
copyIcon.click(function() {
var textToCopy = message.text();
navigator.clipboard.writeText(textToCopy).then(function() {
alert('Text copied to clipboard!');
}, function(err) {
console.error('Could not copy text: ', err);
});
});
var regenerateIcon = $('
🔁
').appendTo(container);
regenerateIcon.click(function() {
$('#chatBody').html(''); // Clear the previous messages
generatePrivacyPolicy(); // Call generatePrivacyPolicy function to regenerate the policy
});
}
}
typeWriter();
}
function formatResponseText(text) {
text = text.replace(/(https?:\/\/[^\s]+)/g, '
$1');
text = text.replace(/^##\s?(.+)/gm, '
$1');
text = text.replace(/^(\s*(?:-|\*|\d+\.)\s+.+)$/gm, '$1
');
return text;
}