Titivillus/static/base.js
2018-09-20 13:09:24 -04:00

20 lines
724 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 == 'initial') {
document.getElementById('header').style.display = 'none';
document.getElementById('headerHidden').style.display = 'initial';
toggle_cookie('hide_header', 'on');
}
else {
document.getElementById('header').style.display = 'initial';
document.getElementById('headerHidden').style.display = 'none';
toggle_cookie('hide_header', 'off');
}
}