Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ryan778
GitHub Repository: Ryan778/Ryan778.github.io
Path: blob/master/about-me/script.js
574 views
1
/* Peeking into the code of the webpage? Don't expect too much. seriously.
2
At least it's not a huge mess and somewhat organized :D
3
*/
4
5
function handleOutboundLinkClicks(url) {
6
ga('send', 'event', {
7
eventCategory: 'Outbound Link',
8
eventAction: 'click',
9
eventLabel: url,
10
transport: 'beacon'
11
});
12
}
13
14
function handleInternalLinkClicks(url) {
15
ga('send', 'event', {
16
eventCategory: 'Internal Link',
17
eventAction: 'click',
18
eventLabel: url,
19
transport: 'beacon'
20
});
21
}
22
23
function initialize(){
24
$('.sm-desc').each(function(i, ele){
25
ele.dataset.name = ele.parentNode.getElementsByTagName('button')[0].getElementsByTagName('span')[0].innerText;
26
ele.dataset.text = ele.innerHTML;
27
})
28
window.onresize();
29
$('a').each(function(i, e){
30
if(e.parentNode){
31
if(e.parentNode.className === 'social'){
32
let lnk = e.href;
33
e.parentNode.onclick = function(){
34
handleOutboundLinkClicks(lnk);
35
window.open(lnk, '_blank')
36
this.blur();
37
}
38
e.removeAttribute('href');
39
}
40
}
41
})
42
43
$('.social').each(function(i, e){
44
e.onmouseenter = function(){
45
if($('#'+e.id.replace('btn', 'btnp')).html() !== e.dataset.usrn){
46
e.dataset.name = $('#'+e.id.replace('btn', 'btnp')).html();
47
let t = $('#'+e.id.replace('btn', 'btnp'));
48
t.css('opacity', '0');
49
setTimeout(function(){
50
t.html(e.dataset.usrn);
51
t.css('opacity', '1');
52
}, 100)
53
}
54
}
55
e.onfocus = e.onmouseenter;
56
e.onmouseleave = function(){
57
if($('#'+e.id.replace('btn', 'btnp')).html() === e.dataset.usrn){
58
let t = $('#'+e.id.replace('btn', 'btnp'));
59
t.css('opacity', '0');
60
setTimeout(function(){
61
t.html(e.dataset.name);
62
t.css('opacity', '1');
63
}, 100)
64
}
65
}
66
e.onblur = e.onmouseleave;
67
})
68
$('#intro_me').css({'opacity': '1', 'bottom': '0px'})
69
}
70
71
window.onresize = function(){
72
if(window.innerHeight < 1080){
73
let wh = window.innerHeight;
74
if(wh < 320){wh = 320};
75
$('#intro').css('height', wh+'px');
76
}
77
else{
78
$('#intro').css('height', '1080px');
79
}
80
if(window.innerWidth < 600){
81
//Make text just a little bit easier to read (and a little bit shorter)
82
$('#intro_me').css('padding', '10px');
83
$('.div-inner').css('padding', '10px');
84
let n = 0;
85
$('.sm-desc').each(function(i, ele){
86
n ++;
87
ele.innerHTML = '<a id="mi_'+n+'">More Info</a>';
88
$('#mi_'+n).on('click', function(){
89
alertify.alert("<b>"+ele.dataset.name+"</b><br><i>&ldquo;"+ele.dataset.text+"&rdquo;</i>")
90
})
91
})
92
}
93
else{
94
$('#intro_me').css('padding', '20px');
95
$('.div-inner').css('padding', '20px');
96
$('.sm-desc').each(function(i, ele){
97
ele.innerHTML = ele.dataset.text;
98
})
99
}
100
}
101
102
$(document).ready(function(){
103
initialize();
104
})
105
106
function notPublic(){
107
alertify.alert('<b>Private Account</b><br>This profile is not open to the public.')
108
}
109