summaryrefslogtreecommitdiff
path: root/JS/main.js
blob: e541d5f12f27e5ae4dcf582e6ac36aca599d6597 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function searchDuck(event){
    var x = document.getElementById('Search').value;
    if (event.keyCode == 13 || event.which == 13) {
        if (x == '/4chan'){
            fourChan()
        }
        else if (x == '/help'){
            help()
        }
        else{location='https://duckduckgo.com/?q=' + encodeURIComponent(document.getElementById('Search').value);}}//13 = enter
}
function FocusOnInput(){
    document.getElementById("Search").focus();
}
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');
      }
    }
  }
}