@ -10,11 +10,22 @@ navbarList.className = "navbarList"
navigation . appendChild ( navbarList )
document . body . appendChild ( navigation )
// opacity
var opacity = c ( "div" )
opacity . className = "opacityMenu lowerIndex menu"
document . body . appendChild ( opacity )
// Search
d ( "googleSearchBar" ) . addEventListener ( "keyup" , searchGoogleEnter )
function searchGoogleEnter ( key ) {
var search = c ( "input" )
search . className = "searchMove searchBar"
search . placeholder = "Vul een zoek opdracht of url in"
search . type = "text"
document . body . prepend ( search )
g ( ".searchBar" ) . addEventListener ( "keyup" , searchEnter )
function searchEnter ( key ) {
if ( key . key == "Enter" ) {
var search = d ( "googleSearchBar" ) . value ;
var search = g( ".s earchBar") . value ;
var containsDot = search . indexOf ( "." ) ;
if ( search !== "" ) {
if ( containsDot > - 1 ) {
@ -31,7 +42,7 @@ function searchGoogleEnter(key) {
}
function showSearch ( ) {
var open = ! d( "googleS earchBar") . classList . contains ( "searchMove" )
var open = ! g( ".s earchBar") . classList . contains ( "searchMove" )
if ( open ) {
closeSearch ( ) ;
}
@ -41,15 +52,15 @@ function showSearch() {
}
function closeSearch ( ) {
$ ( " # opacityMenu") . addClass ( "lowerIndex" )
d( "googleS earchBar") . blur ( )
d( "googleS earchBar") . classList . add ( "searchMove" )
$ ( " . opacityMenu") . addClass ( "lowerIndex" )
g( ".s earchBar") . blur ( )
g( ".s earchBar") . classList . add ( "searchMove" )
}
function openSearch ( e ) {
$ ( " # opacityMenu") . removeClass ( "lowerIndex" )
d( "googleS earchBar") . classList . remove ( "searchMove" )
d( "googleS earchBar") . focus ( )
$ ( " . opacityMenu") . removeClass ( "lowerIndex" )
g( ".s earchBar") . classList . remove ( "searchMove" )
g( ".s earchBar") . focus ( )
}
// Create Navbar
@ -95,17 +106,6 @@ Navbar.forEach(i=>{
dropdownList . appendChild ( dropdownListItem ) ;
} )
}
$( navList) .appen d( dropdownList )
navList .appen dChil d( dropdownList )
navbarList . appendChild ( navList ) ;
} )
// Appearance changer
var appearanceSwitch = c ( "label" )
appearanceSwitch . className = "appearance"
appearanceSwitch . title = "Dark/Light mode"
var appearanceInput = c ( "input" )
appearanceInput . type = "checkbox"
var appearanceSpan = c ( "span" )
appearanceSpan . className = "appearanceSlider"
$ ( appearanceSwitch ) . append ( appearanceInput , appearanceSpan )
navigation . appendChild ( appearanceSwitch )