Added email replace

This commit is contained in:
James Dinh 2023-01-28 13:59:57 -08:00
parent e1b4a161e6
commit 4651772fda
2 changed files with 15 additions and 1 deletions

View File

@ -13,6 +13,7 @@
<!-- <link rel="icon" href="img/icon.ico"> --> <!-- <link rel="icon" href="img/icon.ico"> -->
<!-- JavaScript Refs --> <!-- JavaScript Refs -->
<script defer src="js/general.js"></script>
<style> <style>
@font-face { @font-face {
font-family: "Queensides"; font-family: "Queensides";
@ -52,7 +53,7 @@
</div> </div>
<main> <main>
<div class="buy-info"> <div class="buy-info">
<h2>Interested in buying a piece? Contact me at<br><a class="email-link" target="_blank" href="mailto:nancypannikkat@gmail.com?subject=Art Purchase Inquiry">nancypannikkat@gmail.com</a></h2><br><br> <h2>Interested in buying a piece? Contact me at<br><a class="email-link" target="_blank" href="mailto:nancypannikkat-at-gmail-dot-com">nancypannikkat (at) gmail (dot) com</a></h2><br><br>
<h2>Or call me at<br><span class="emphasis-text">650-793-3954</span></h2> <h2>Or call me at<br><span class="emphasis-text">650-793-3954</span></h2>
</div> </div>
</main> </main>

View File

@ -25,4 +25,17 @@ document.addEventListener( 'DOMContentLoaded', function() {
function uncheck(id) { function uncheck(id) {
document.getElementById(id).checked = false; document.getElementById(id).checked = false;
} }
//Email Replace
function setAttributes(elem, attrs) {
for(var key in attrs) {
elem.setAttribute(key, attrs[key]);
}
}
const tech_emails = document.querySelectorAll('.email-replace');
tech_emails.forEach(entry => {
setAttributes(entry, {"href": "mailto:nancypannikkat" + "@" + "gmail.com?subject=Art Purchase Inquiry", "target": "_blank"});
entry.innerHTML = "nancypannikkat" + "@" + "gmail.com";
});
}); });