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

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

Issue 29488555: Issue 5406 - Create Site Footer Component for Help Center (Closed)
Left Patch Set: Created July 13, 2017, 7:57 a.m.
Right Patch Set: Remove langnames commit, use website-default breakpoint variables Created Sept. 18, 2017, 3:09 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
LEFTRIGHT
1 (function(){ 1 (function(){
2 document.addEventListener("DOMContentLoaded", function() { 2 document.addEventListener("DOMContentLoaded", function()
3 {
3 4
4 // Change html class name from "no-js" to "js" 5 // Change html class name from "no-js" to "js"
5 document.documentElement.className = "js"; 6 document.documentElement.className = "js";
6 7
8 // Toggle Navbar Collapse
9 function toggleNavbarCollapse()
10 {
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
7 // Custom Select 26 // Custom Select
8 var customSelects = document.getElementsByClassName('custom-select-selected' ); 27 function onClickCustomSelect()
9 function onClickCustomSelect(e) { 28 {
10 var options = e.target.nextElementSibling; 29 var options = this.nextElementSibling;
11 if (options.getAttribute("aria-hidden") == "true") 30 if (options.getAttribute("aria-hidden") == "true")
12 { 31 {
13 options.removeAttribute("aria-hidden"); 32 options.removeAttribute("aria-hidden");
14 e.target.setAttribute("aria-expanded", "true"); 33 this.setAttribute("aria-expanded", "true");
15 } 34 }
16 else 35 else
17 { 36 {
18 options.setAttribute("aria-hidden", "true"); 37 options.setAttribute("aria-hidden", "true");
19 e.target.setAttribute("aria-expanded", "false"); 38 this.setAttribute("aria-expanded", "false");
20 } 39 }
21 } 40 }
22 for (var i = 0; i < customSelects.length; i++) { 41
23 customSelects[i].addEventListener("click", onClickCustomSelect, false); 42 var customSelectEls = document.getElementsByClassName('custom-select-selecte d');
43 for (var i = 0; i < customSelectEls.length; i++)
44 {
45 customSelectEls[i]
46 .addEventListener("click", onClickCustomSelect, false);
47 customSelectEls[i]
48 .nextElementSibling
49 .setAttribute("aria-hidden", "true");
24 } 50 }
25 51
26 }, false); 52 }, false);
27 }()); 53 }());
LEFTRIGHT

Powered by Google App Engine
This is Rietveld