diff options
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'); + } + } + } +} |
