-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
42 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,43 @@ | ||
export default copyEmail = () => { | ||
function copyToClipboard(copyText) { | ||
// copies text to keyboard by creating then deleting selectable text area | ||
const el = document.createElement('textarea'); | ||
el.value = copyText; | ||
document.body.appendChild(el); | ||
el.select(); | ||
document.execCommand('copy'); | ||
document.body.removeChild(el); | ||
|
||
// change text of header | ||
$('.footer-title-roller-down').each(function() { | ||
$(this).html('E-mail copied to clipboard'); | ||
}) | ||
|
||
// reset text of header after 1000 ms | ||
setTimeout(function() { | ||
$('.footer-title-roller-down').each(function() { | ||
$(this).html('Copy email'); | ||
}) | ||
}, 1400); | ||
}; | ||
|
||
var helloBlock = document.getElementById("email-block-hello"); | ||
helloBlock.addEventListener('click', function() { | ||
copyToClipboard("[email protected]"); | ||
}) | ||
|
||
var remoteHelloBlock = document.getElementById("remote-hello"); | ||
remoteHelloBlock.addEventListener('click', function() { | ||
copyToClipboard("[email protected]"); | ||
}) | ||
var careersBlock = document.getElementById("careers"); | ||
careersBlock.addEventListener('click', function() { | ||
copyToClipboard("[email protected]"); | ||
}) | ||
|
||
var internBlock = document.getElementById("intern"); | ||
internBlock.addEventListener('click', function() { | ||
copyToClipboard("[email protected]"); | ||
}) | ||
} | ||
function copyToClipboard(copyText) { | ||
// copies text to keyboard by creating then deleting selectable text area | ||
const el = document.createElement("textarea"); | ||
el.value = copyText; | ||
document.body.appendChild(el); | ||
el.select(); | ||
document.execCommand("copy"); | ||
document.body.removeChild(el); | ||
|
||
// change text of header | ||
$(".footer-title-roller-down").each(function () { | ||
$(this).html("E-mail copied to clipboard"); | ||
}); | ||
|
||
// reset text of header after 1000 ms | ||
setTimeout(function () { | ||
$(".footer-title-roller-down").each(function () { | ||
$(this).html("Copy email"); | ||
}); | ||
}, 1400); | ||
} | ||
|
||
var remoteHelloBlock = document.getElementById("hello"); | ||
remoteHelloBlock.addEventListener("click", function () { | ||
copyToClipboard("[email protected]"); | ||
}); | ||
|
||
var careersBlock = document.getElementById("careers"); | ||
careersBlock.addEventListener("click", function () { | ||
copyToClipboard("[email protected]"); | ||
}); | ||
|
||
// var helloBlock = document.getElementById("email-block-hello"); | ||
// helloBlock.addEventListener('click', function() { | ||
// copyToClipboard("[email protected]"); | ||
// }) | ||
|
||
// var internBlock = document.getElementById("intern"); | ||
// internBlock.addEventListener('click', function() { | ||
// copyToClipboard("[email protected]"); | ||
// }) | ||
}; |