diff options
| author | Jacob McDonnell <jacob@simplelittledream.com> | 2020-06-22 10:13:40 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@simplelittledream.com> | 2020-06-22 10:13:40 -0400 |
| commit | fb4c9e80239275055711141c4a56226fa1c4b32b (patch) | |
| tree | b8b3ef3c2fd531be5ce33679fbd674e6a125c0bd /JS/main.js | |
| parent | a66aebc02bd4593d94f39e462ee9ff5578ab4583 (diff) | |
Updated side bar to have drop downs
Diffstat (limited to 'JS/main.js')
| -rw-r--r-- | JS/main.js | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -1,9 +1,9 @@ function searchDuck(event){ var x = document.getElementById('Search').value; - if (event.keyCode == 13 || event.which == 13) { + if (event.keyCode == 13 || event.which == 13) { if (x == '/4chan'){ fourChan() - } + } else if (x == '/help'){ help() } @@ -11,4 +11,19 @@ function searchDuck(event){ } function FocusOnInput(){ document.getElementById("Search").focus(); -}
\ No newline at end of file +} +function dropdown(theID) { + document.getElementById(theID).classList.toggle("show"); +} +window.onclick = function(event) { //when the user clicks anywhere else on the screen the menu disappears + if (!event.target.matches('.dropbtn')) { + var dropdowns = document.getElementsByClassName("dropdown-content"); + var i; + for (i = 0; i < dropdowns.length; i++) { + var openDropdown = dropdowns[i]; + if (openDropdown.classList.contains('show')) { + openDropdown.classList.remove('show'); + } + } + } +} |
