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

Side by Side Diff: static/js/navbar.js

Issue 29587584: Issue 5635 - Implement website-default navbar component (Closed) Base URL: https://hg.adblockplus.org/website-defaults
Patch Set: Created Oct. 24, 2017, 10:32 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*******************************************************************************
2 * Navbar Component
juliandoucette 2017/10/26 15:55:56 suggest: keyboard and aria functionality from [exa
3 ******************************************************************************/
4 (function()
5 {
6 document.addEventListener("DOMContentLoaded", function()
7 {
8
9 function Navbar(navbar)
10 {
11 this.navbar = navbar;
12
13 this.navbar
14 .querySelector(".toggle-navbar-collapse")
15 .addEventListener("click", this._onClick.bind(this), false);
juliandoucette 2017/10/26 15:55:56 suggest: Allow click away to close?
16 }
17
18 Navbar.prototype.toggleCollapse = function()
19 {
20 this.navbar.classList.toggle("expanded");
21 };
22
23 Navbar.prototype._onClick = function()
24 {
25 this.toggleCollapse();
26 };
27
28 var navbars = document.getElementsByClassName("navbar");
juliandoucette 2017/10/26 15:55:56 NIT: separate var and for by one line
29 for (var i = 0; i < navbars.length; i++)
30 {
31 new Navbar(navbars[i]);
32 }
33
34 }, false);
35 }());
OLDNEW

Powered by Google App Engine
This is Rietveld