-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
53 lines (49 loc) · 1.8 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import './main.sass'
import 'loading-attribute-polyfill/loading-attribute-polyfill.js'
var links = document.getElementsByTagName("a");
var sites = ['yourlabs.org', 'yourlabs.fr', window.location.hostname]
for (var i = 0, linksLength = links.length; i < linksLength; i++) {
if (sites.indexOf(links[i].hostname) < 0) {
links[i].target = '_blank';
}
if (links[i].pathname == window.location.pathname && links[i].hostname == window.location.hostname) {
if (links[i].childNodes.length > 1) continue // it's an image or something we don't want to underline
links[i].classList.add('active')
}
}
// this breaks some anchor links
// import InstantClick from 'instantclick'
// InstantClick.init()
var dnt = (navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack);
var doNotTrack = (dnt == "1" || dnt == "yes");
if (!doNotTrack) {
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-169189134-1', 'auto');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
}
var headerScroll = function() {
if (window.scrollY > 50 && header.classList.contains('transparent')) {
window.requestAnimationFrame(
() => {
header.classList.remove('transparent')
document.querySelector('header.main-header img').src = '/img/yourlabs-transparent.png'
}
)
}
else if (window.scrollY < 50 && !header.classList.contains('transparent')) {
window.requestAnimationFrame(() => {
header.classList.add('transparent')
document.querySelector('header.main-header img').src = '/img/yourlabs-transparent-whitetext.png'
})
}
}
try {
var header = document.querySelector('header.hero-header')
if (header) {
window.addEventListener('scroll', headerScroll)
headerScroll()
}
} catch {
console.log('u 1337 ? -> contact us')
}