Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ryan778
GitHub Repository: Ryan778/Ryan778.github.io
Path: blob/master/linktree/script.js
574 views
1
let a = document.getElementsByTagName('a');
2
function handleClick(e, a){
3
e.preventDefault();
4
e.srcElement.style.backgroundColor = '#93fdb077';
5
e.srcElement.style.borderColor = '#00dd3c';
6
let l = e.srcElement.parentElement.href;
7
function redir(){
8
window.open(l, '_self')}
9
ga('send', 'event', 'Link', 'click', 'Linktree (link id: '+e.srcElement.parentElement.dataset.linkid+')', {hitCallback: redir});
10
setTimeout(redir, 750);
11
}
12
for(let i = 0; i < a.length; i++){
13
if(a[i].className.includes('nl')){continue;}
14
a[i].addEventListener('click', handleClick);
15
}
16
17
function spc(n){//Show photo credits
18
if(n === 0){
19
document.getElementById('pc').style.display = 'none';
20
}
21
else{
22
document.getElementById('pc').style.display = 'initial';
23
}
24
}
25