-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.js
37 lines (36 loc) · 1.27 KB
/
start.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
---
permalink: /start.js
---
//UpUp.debug();
UpUp.start({
'cache-version': '1.{{ site.time | date: "%d%m%Y%H%M%S%Z" }}',
{% for section_hash in site.data.offline %}
{% for section in section_hash %}
{% if section[0] == 'content-url' %}
'content-url': '{{ section[1] }}',
{% elsif section[0] == 'assets' %}
'assets': [{% for bullet in section[1] %} '{{ bullet }}'{% unless forloop.last %},{% endunless %}{% endfor %} ]
{% endif %}
{% endfor %}
{% endfor %}
});
// https://stackoverflow.com/questions/13549997/how-to-append-all-href-link-with-redirector-url-via-javascript
var links = document.links;
var i = links.length;
while (i--) {
if (links[i].getAttribute("href").slice(0, 4) != "http" ||
links[i].getAttribute("href").slice(-4) == ".pdf" ||
// fb share link ToDO
links[i].getAttribute("href").search(/facebook.com\/sharer.php/) > -1 ) {
continue;
}
if (links[i].getAttribute("href").slice(-1) == "/") {
links[i].href = links[i].href + "?{{ site.data.config.utm }}";
} else {
if ( links[i].getAttribute("href").search(/\?/) > -1) {
links[i].href = links[i].href + "&{{ site.data.config.utm }}";
} else {
links[i].href = links[i].href + "?{{ site.data.config.utm }}";
}
}
}