{"size": 1403, "ext": "js", "max_stars_repo_path": "scripts/formjQuery.js", "max_stars_repo_name": "Cyrlay/website-template", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "scripts/formjQuery.js", "max_issues_repo_name": "Cyrlay/website-template", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scripts/formjQuery.js", "max_forks_repo_name": "Cyrlay/website-template", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.7605633803, "max_line_length": 73, "alphanum_fraction": 0.4989308624}
const main = () => {
    prepareDOMEvents()
    checkURL()
}

const prepareDOMEvents = () => {
    $('.log').click(() => {
        showLoginPopUp()
    })

    $('.reg').click(() => {
        showRegisterPopUp()
    })

    $('.btn-cancel').click(() => {
        closePopUps()
    })

    $('.btn-add').click(() => {
        console.log('ok')
    })

    $('.burger').click(() => {
        handleNav()
    })
}

const showLoginPopUp = () => {
    closePopUps()
    $('main').addClass('blur-filter')
    setTimeout(() => {
        $('.login-popup').css('display', 'flex')
    }, 100)
}

const showRegisterPopUp = () => {
    closePopUps()
    $('main').addClass('blur-filter')
    setTimeout(() => {
        $('.register-popup').css('display', 'flex')
    }, 100)

}

const closePopUps = () => {
    history.back()
    $('main').removeClass('blur-filter')
    $('.login-popup').css('display', 'none')
    $('.register-popup').css('display', 'none')
}

const checkURL = () => {
    let pageURL = $(location).attr("href")

    if (pageURL.indexOf('#login') > -1) {
        showLoginPopUp()
    } else if (pageURL.indexOf('#register') > -1) {
        showRegisterPopUp()
    } else {
        return null
    }
}

const handleNav = () => {
    $('.nav-bar').toggle('show').attr('style','display: flex !important')
    $('.fa-times').toggle('hide')
    $('.fa-bars').toggle('hide')
}

$(document).ready(main)
