Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: static/js/main.js

Issue 29564555: Issue 5824 - Refactor CustomSelect on help.eyeo.com (Closed) Base URL: https://hg.adblockplus.org/help.eyeo.com
Left Patch Set: Created Oct. 4, 2017, 8:05 a.m.
Right Patch Set: Update comment style Created Oct. 10, 2017, 11:54 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « includes/layout/footer.tmpl ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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 }());
LEFTRIGHT

Powered by Google App Engine
This is Rietveld