Titivillus/static/base.js
2018-10-02 11:35:39 -04:00

20 lines
715 B
JavaScript

function toggle_cookie(cookie, state) {
let xhr = new XMLHttpRequest();
xhr.open('POST', set_session_url, true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.setRequestHeader('X-CSRFToken', csrf_token);
xhr.send(cookie + '=' + state);
}
function toggle_header() {
if (document.getElementById('header').style.display == 'flex') {
document.getElementById('header').style.display = 'none';
document.getElementById('headerHidden').style.display = 'flex';
toggle_cookie('hide_header', 'on');
}
else {
document.getElementById('header').style.display = 'flex';
document.getElementById('headerHidden').style.display = 'none';
toggle_cookie('hide_header', 'off');
}
}