-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcustom-footer.html
38 lines (33 loc) · 1.51 KB
/
custom-footer.html
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
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-139601399-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-139601399-2');
</script>
<!-- DOM Manipulation -->
<script>
// Inject custom header buttons after the subscribe button
function addButton(name, link, color) {
var a = document.createElement("a");
a.innerText = name;
a.href = link;
a.target = "_blank";
a.className = "flat-button";
a.style.marginLeft = "1em";
if (color) a.style.backgroundColor = color;
document.querySelector(".updates-dropdown-container").appendChild(a);
}
// Custom status twitter button
addButton("@cdnjsStatus on Twitter", "https://twitter.com/cdnjsStatus", "#1da1f2");
// Fix custom masthead subscribe button
document.getElementById("show-updates-dropdown").className += " flat-button";
// Move metrics to components
var metrics = [].slice.call(document.getElementsByClassName('metrics-container')[0].children);
var components = [].slice.call(document.getElementsByClassName('components-container')[0].children);
for (var i = 0; i < metrics.length; i++) {
components[i].appendChild(metrics[i]);
}
document.getElementsByClassName('components-section')[0].appendChild(document.getElementsByClassName('custom-metrics-container')[0]);
</script>