Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 (function(){ | 1 (function(){ |
2 document.addEventListener("DOMContentLoaded", function() | 2 document.addEventListener("DOMContentLoaded", function() |
3 { | 3 { |
4 | 4 |
5 /* ****************************************** | 5 /************************************************************************** |
ire
2017/10/04 08:07:40
The document was starting to get really long so I
juliandoucette
2017/10/09 23:14:15
Acknowledged.
We should be consistent about how w
ire
2017/10/10 11:54:18
I think I actually prefer your way so updating tha
| |
6 * | |
7 * General | 6 * General |
8 * | 7 **************************************************************************/ |
9 * ****************************************** */ | |
10 | 8 |
11 // Change html class name from "no-js" to "js" | 9 // Change html class name from "no-js" to "js" |
12 document.documentElement.className = "js"; | 10 document.documentElement.className = "js"; |
13 | 11 |
14 /* ****************************************** | 12 /************************************************************************** |
15 * | |
16 * Navbar | 13 * Navbar |
17 * | 14 **************************************************************************/ |
18 * ****************************************** */ | |
19 | 15 |
20 function toggleNavbarCollapse() | 16 function toggleNavbarCollapse() |
21 { | 17 { |
22 var navbarCollapseEls = this.parentElement.getElementsByClassName("navbar- collapse"); | 18 var navbarCollapseEls = this.parentElement.getElementsByClassName("navbar- collapse"); |
23 for (var i = 0; i < navbarCollapseEls.length; i++) | 19 for (var i = 0; i < navbarCollapseEls.length; i++) |
24 { | 20 { |
25 navbarCollapseEls[i] | 21 navbarCollapseEls[i] |
26 .classList.toggle("open") | 22 .classList.toggle("open") |
27 } | 23 } |
28 } | 24 } |
29 | 25 |
30 var toggleNavbarCollapseEls = document.getElementsByClassName("toggle-navbar -collapse"); | 26 var toggleNavbarCollapseEls = document.getElementsByClassName("toggle-navbar -collapse"); |
31 for (var i = 0; i < toggleNavbarCollapseEls.length; i++) | 27 for (var i = 0; i < toggleNavbarCollapseEls.length; i++) |
32 { | 28 { |
33 toggleNavbarCollapseEls[i] | 29 toggleNavbarCollapseEls[i] |
34 .addEventListener("click", toggleNavbarCollapse, false); | 30 .addEventListener("click", toggleNavbarCollapse, false); |
35 } | 31 } |
36 | 32 |
37 /* ****************************************** | 33 /************************************************************************** |
38 * | |
39 * CustomSelect | 34 * CustomSelect |
40 * | 35 **************************************************************************/ |
41 * ****************************************** */ | |
42 | 36 |
43 function CustomSelect(select) | 37 function CustomSelect(select) |
44 { | 38 { |
45 this.select = select; | 39 this.select = select; |
46 this.close(); | 40 this.close(); |
47 select.addEventListener("click", this._onClick.bind(this), false); | 41 select.addEventListener("click", this._onClick.bind(this), false); |
48 } | 42 } |
49 | 43 |
50 CustomSelect.prototype._onClick = function(event) | 44 CustomSelect.prototype._onClick = function(event) |
51 { | 45 { |
(...skipping 30 matching lines...) Expand all Loading... | |
82 | 76 |
83 this.select | 77 this.select |
84 .querySelector(".custom-select-options") | 78 .querySelector(".custom-select-options") |
85 .setAttribute("aria-hidden", "true"); | 79 .setAttribute("aria-hidden", "true"); |
86 } | 80 } |
87 | 81 |
88 new CustomSelect(document.getElementById("language-select")); | 82 new CustomSelect(document.getElementById("language-select")); |
89 | 83 |
90 }, false); | 84 }, false); |
91 }()); | 85 }()); |
LEFT | RIGHT |