Titivillus/static/base.js

20 lines
715 B
JavaScript
Raw Normal View History

2018-09-20 13:09:24 -04:00
function toggle_cookie(cookie, state) {
2018-09-19 15:56:59 -04:00
let xhr = new XMLHttpRequest();
2018-09-20 13:09:24 -04:00
xhr.open('POST', set_session_url, true);
2018-09-19 15:56:59 -04:00
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
2018-09-20 13:09:24 -04:00
xhr.setRequestHeader('X-CSRFToken', csrf_token);
xhr.send(cookie + '=' + state);
2018-09-19 15:56:59 -04:00
}
2018-09-20 13:09:24 -04:00
function toggle_header() {
2018-09-30 01:30:50 -04:00
if (document.getElementById('header').style.display == 'flex') {
2018-09-19 15:56:59 -04:00
document.getElementById('header').style.display = 'none';
2018-10-02 11:35:39 -04:00
document.getElementById('headerHidden').style.display = 'flex';
2018-09-20 13:09:24 -04:00
toggle_cookie('hide_header', 'on');
2018-09-19 15:56:59 -04:00
}
else {
2018-09-30 01:30:50 -04:00
document.getElementById('header').style.display = 'flex';
2018-09-19 15:56:59 -04:00
document.getElementById('headerHidden').style.display = 'none';
2018-09-20 13:09:24 -04:00
toggle_cookie('hide_header', 'off');
2018-09-19 15:56:59 -04:00
}
}