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: Demo - Use table layout Created Nov. 2, 2017, 11:08 a.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
3 ******************************************************************************/ 3 ******************************************************************************/
4 4
5 document.addEventListener("DOMContentLoaded", function() 5 document.addEventListener("DOMContentLoaded", function()
6 { 6 {
7 7
8 function Navbar(navbar) 8 function Navbar(navbar)
9 { 9 {
10 this.navbar = navbar; 10 this.navbar = navbar;
11 11
12 this.navbar 12 this.navbar
13 .querySelector(".toggle-navbar-collapse button") 13 .querySelector(".toggle-navbar-collapse")
14 .addEventListener("click", this._onClick.bind(this), false); 14 .addEventListener("click", this._onClick.bind(this), false);
15 } 15 }
16 16
17 Navbar.prototype.toggleCollapse = function() 17 Navbar.prototype.toggleCollapse = function()
18 { 18 {
19 this.navbar.classList.toggle("expanded"); 19 this.navbar.classList.toggle("expanded");
20 }; 20 };
21 21
22 Navbar.prototype._onClick = function() 22 Navbar.prototype._onClick = function()
23 { 23 {
24 this.toggleCollapse(); 24 this.toggleCollapse();
25 }; 25 };
26 26
27 var navbars = document.getElementsByClassName("navbar"); 27 var navbars = document.getElementsByClassName("navbar");
28 for (var i = 0; i < navbars.length; i++) 28 for (var i = 0; i < navbars.length; i++)
29 { 29 {
30 new Navbar(navbars[i]); 30 new Navbar(navbars[i]);
31 } 31 }
32 32
33 }, false); 33 }, false);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld