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

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

Issue 29485575: Issue 5385 - Create Site Header Component for Help Center (Closed)
Left Patch Set: Unfix header, implement standard spacing units Created Aug. 16, 2017, 2:37 p.m.
Right Patch Set: Include site variables before website-defaults Created Sept. 1, 2017, 12:11 p.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/search-icon.svg ('k') | static/js/vendor/classList.min.js » ('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 (function(){ 1 (function(){
2 document.addEventListener("DOMContentLoaded", function() 2 document.addEventListener("DOMContentLoaded", function()
3 { 3 {
4 4
5 // Change html class name from "no-js" to "js" 5 // Change html class name from "no-js" to "js"
6 document.documentElement.className = "js"; 6 document.documentElement.className = "js";
7 7
8 document.getElementById('toggle-search-form').addEventListener('click', func tion(e) { 8 // Toggle Navbar Collapse
juliandoucette 2017/08/18 15:03:56 NIT: This doesn't seem to fit on one line.
ire 2017/08/21 15:23:20 Is it supposed to? That depends on the size of the
juliandoucette 2017/08/21 16:28:40 We follow Mozilla's rule regarding the line length
ire 2017/08/22 12:15:15 Okay. I will switch to your style of new lines the
9 e.preventDefault(); 9 function toggleNavbarCollapse()
10 document.getElementById('site-search').classList.toggle('open'); 10 {
juliandoucette 2017/08/18 15:03:56 NIT: I usually chain on newlines e.g. document
juliandoucette 2017/08/18 15:03:56 NIT: Our code style specifies double quotes :( (I
ire 2017/08/21 15:23:20 Okay. I like to use new lines like that for things
ire 2017/08/21 15:23:20 Done.
11 }, false); 11 var navbarCollapseEls = this.parentElement.getElementsByClassName("navbar- collapse");
12 for (var i = 0; i < navbarCollapseEls.length; i++)
13 {
14 navbarCollapseEls[i]
15 .classList.toggle("open")
16 }
17 }
18
19 var toggleNavbarCollapseEls = document.getElementsByClassName("toggle-navbar -collapse");
20 for (var i = 0; i < toggleNavbarCollapseEls.length; i++)
21 {
22 toggleNavbarCollapseEls[i]
23 .addEventListener("click", toggleNavbarCollapse, false);
24 }
25
12 }, false); 26 }, false);
13 }()); 27 }());
LEFTRIGHT

Powered by Google App Engine
This is Rietveld