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

Side by Side Diff: static/js/main.js

Issue 29488555: Issue 5406 - Create Site Footer Component for Help Center (Closed)
Patch Set: Fix spacing in custom-select-options li Created Sept. 12, 2017, 3:03 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
« no previous file with comments | « settings.ini ('k') | static/scss/base/_utilities.scss » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Toggle Navbar Collapse 8 // Toggle Navbar Collapse
9 function toggleNavbarCollapse() 9 function toggleNavbarCollapse()
10 { 10 {
11 var navbarCollapseEls = this.parentElement.getElementsByClassName("navbar- collapse"); 11 var navbarCollapseEls = this.parentElement.getElementsByClassName("navbar- collapse");
12 for (var i = 0; i < navbarCollapseEls.length; i++) 12 for (var i = 0; i < navbarCollapseEls.length; i++)
13 { 13 {
14 navbarCollapseEls[i] 14 navbarCollapseEls[i]
15 .classList.toggle("open") 15 .classList.toggle("open")
16 } 16 }
17 } 17 }
18 18
19 var toggleNavbarCollapseEls = document.getElementsByClassName("toggle-navbar -collapse"); 19 var toggleNavbarCollapseEls = document.getElementsByClassName("toggle-navbar -collapse");
20 for (var i = 0; i < toggleNavbarCollapseEls.length; i++) 20 for (var i = 0; i < toggleNavbarCollapseEls.length; i++)
21 { 21 {
22 toggleNavbarCollapseEls[i] 22 toggleNavbarCollapseEls[i]
23 .addEventListener("click", toggleNavbarCollapse, false); 23 .addEventListener("click", toggleNavbarCollapse, false);
24 } 24 }
25 25
26 // Custom Select
27 function onClickCustomSelect()
28 {
29 var options = this.nextElementSibling;
30 if (options.getAttribute("aria-hidden") == "true")
31 {
32 options.removeAttribute("aria-hidden");
33 this.setAttribute("aria-expanded", "true");
34 }
35 else
36 {
37 options.setAttribute("aria-hidden", "true");
38 this.setAttribute("aria-expanded", "false");
39 }
40 }
41
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");
50 }
51
26 }, false); 52 }, false);
27 }()); 53 }());
OLDNEW
« no previous file with comments | « settings.ini ('k') | static/scss/base/_utilities.scss » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld