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

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

Issue 29587584: Issue 5635 - Implement website-default navbar component (Closed) Base URL: https://hg.adblockplus.org/website-defaults
Left Patch Set: Rebased Created Oct. 31, 2017, 2:07 p.m.
Right Patch Set: Rebase Created Jan. 4, 2018, 7:40 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 | « static/img/svg/eyeo-logo.svg ('k') | static/scss/_navbar.scss » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /******************************************************************************* 1 /*******************************************************************************
2 * Navbar Component 2 * Navbar Component
juliandoucette 2017/10/31 15:18:37 Are you planning to add accessibility features lik
ire 2017/11/02 11:15:25 I haven't done much research either, but I would p
3 ******************************************************************************/ 3 ******************************************************************************/
4 (function() 4
juliandoucette 2017/10/31 15:18:37 TOL: I'm not sure that we have to worry about poll
ire 2017/11/02 11:15:26 You're probably right. I'll remove it.
ire 2017/11/02 11:15:26 Done.
5 document.addEventListener("DOMContentLoaded", function()
5 { 6 {
6 document.addEventListener("DOMContentLoaded", function() 7
8 function Navbar(navbar)
7 { 9 {
10 this.navbar = navbar;
8 11
9 function Navbar(navbar) 12 this.navbar
10 { 13 .querySelector(".toggle-navbar-collapse")
11 this.navbar = navbar; 14 .addEventListener("click", this._onClick.bind(this), false);
15 }
12 16
13 this.navbar 17 Navbar.prototype.toggleCollapse = function()
14 .querySelector(".toggle-navbar-collapse") 18 {
15 .addEventListener("click", this._onClick.bind(this), false); 19 this.navbar.classList.toggle("expanded");
16 } 20 };
17 21
18 Navbar.prototype.toggleCollapse = function() 22 Navbar.prototype._onClick = function()
19 { 23 {
20 this.navbar.classList.toggle("expanded"); 24 this.toggleCollapse();
21 }; 25 };
22 26
23 Navbar.prototype._onClick = function() 27 var navbars = document.getElementsByClassName("navbar");
24 { 28 for (var i = 0; i < navbars.length; i++)
25 this.toggleCollapse(); 29 {
26 }; 30 new Navbar(navbars[i]);
31 }
27 32
28 var navbars = document.getElementsByClassName("navbar"); 33 }, false);
29 for (var i = 0; i < navbars.length; i++)
30 {
31 new Navbar(navbars[i]);
32 }
33
34 }, false);
35 }());
LEFTRIGHT

Powered by Google App Engine
This is Rietveld