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: Use padding on navbar link, optimise svg Created Nov. 30, 2017, 2 p.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/12/01 16:30:43 Perhaps this should *just* be a collapse component
ire 2017/12/08 10:42:21 I think that depends on what we end up extending i
3 ******************************************************************************/
4
5 document.addEventListener("DOMContentLoaded", function()
6 {
7
8 function Navbar(navbar)
9 {
10 this.navbar = navbar;
11
12 this.navbar
13 .querySelector(".toggle-navbar-collapse")
14 .addEventListener("click", this._onClick.bind(this), false);
15 }
16
17 Navbar.prototype.toggleCollapse = function()
18 {
19 this.navbar.classList.toggle("expanded");
20 };
21
22 Navbar.prototype._onClick = function()
23 {
24 this.toggleCollapse();
25 };
26
27 var navbars = document.getElementsByClassName("navbar");
28 for (var i = 0; i < navbars.length; i++)
29 {
30 new Navbar(navbars[i]);
31 }
32
33 }, false);
OLDNEW

Powered by Google App Engine
This is Rietveld