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-10-15 13:12:48 -04:00
|
|
|
xhr.open('POST', api_url + '/set_session', 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-10-15 13:12:48 -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
|
|
|
}
|
|
|
|
}
|
2018-10-15 13:12:48 -04:00
|
|
|
function clear_notification(msg_id) {
|
|
|
|
let xhr = new XMLHttpRequest();
|
|
|
|
xhr.open('POST', api_url + '/clear_notification', true);
|
|
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
|
|
xhr.setRequestHeader('X-CSRFToken', csrf_token);
|
|
|
|
xhr.send('msg_id=' + msg_id);
|
|
|
|
|
|
|
|
let elem = document.getElementById('notification-' + msg_id);
|
|
|
|
elem.parentNode.removeChild(elem);
|
|
|
|
elem = document.getElementById('subbtn');
|
|
|
|
elem.innerText = elem.innerText - 1;
|
2018-10-16 13:09:53 -04:00
|
|
|
if (elem.innerText === '0') {
|
|
|
|
elem.className = 'noNewSubs';
|
|
|
|
}
|
2018-10-15 13:12:48 -04:00
|
|
|
}
|