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

Unified 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: Rebase Created Jan. 4, 2018, 7:40 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « static/img/svg/eyeo-logo.svg ('k') | static/scss/_navbar.scss » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: static/js/navbar.js
===================================================================
new file mode 100644
--- /dev/null
+++ b/static/js/navbar.js
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Navbar Component
+ ******************************************************************************/
+
+document.addEventListener("DOMContentLoaded", function()
+{
+
+ function Navbar(navbar)
+ {
+ this.navbar = navbar;
+
+ this.navbar
+ .querySelector(".toggle-navbar-collapse")
+ .addEventListener("click", this._onClick.bind(this), false);
+ }
+
+ Navbar.prototype.toggleCollapse = function()
+ {
+ this.navbar.classList.toggle("expanded");
+ };
+
+ Navbar.prototype._onClick = function()
+ {
+ this.toggleCollapse();
+ };
+
+ var navbars = document.getElementsByClassName("navbar");
+ for (var i = 0; i < navbars.length; i++)
+ {
+ new Navbar(navbars[i]);
+ }
+
+}, false);
« no previous file with comments | « static/img/svg/eyeo-logo.svg ('k') | static/scss/_navbar.scss » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld