1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-28 01:10:51 +01:00

main.js: format getCookie

This commit is contained in:
Zankaria 2024-08-04 15:07:56 +02:00
parent 8d3bfedc72
commit 990f27e80b

View File

@ -212,12 +212,13 @@ function init_stylechooser() {
document.getElementsByTagName('body')[0].insertBefore(newElement, document.getElementsByTagName('body')[0].lastChild.nextSibling); document.getElementsByTagName('body')[0].insertBefore(newElement, document.getElementsByTagName('body')[0].lastChild.nextSibling);
} }
function get_cookie(cookie_name) { function getCookie(cookie_name) {
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); let results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
if (results) if (results) {
return (unescape(results[2])); return unescape(results[2]);
else } else {
return null; return null;
}
} }
function highlightReply(id) { function highlightReply(id) {
@ -323,9 +324,9 @@ function rememberStuff() {
if (sessionStorage.body) { if (sessionStorage.body) {
var saved = JSON.parse(sessionStorage.body); var saved = JSON.parse(sessionStorage.body);
if (get_cookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')) { if (getCookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')) {
// Remove successful posts // Remove successful posts
var successful = JSON.parse(get_cookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')); var successful = JSON.parse(getCookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}'));
for (var url in successful) { for (var url in successful) {
saved[url] = null; saved[url] = null;
} }