fix(web): show_mode cookie

This commit is contained in:
Baoshuo Ren 2022-12-03 14:58:06 +08:00
parent f12b3cf84e
commit 2a63f17a14
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 25 additions and 16 deletions

View File

@ -166,11 +166,12 @@ $pag = new Paginator($pag_config);
$('#input-show_tags_mode').click(function() {
if (this.checked) {
$.cookie('show_tags_mode', '', {
path: '/'
path: '/list',
expires: 365,
});
} else {
$.removeCookie('show_tags_mode', {
path: '/'
path: '/list',
});
}
location.reload();
@ -178,11 +179,12 @@ $pag = new Paginator($pag_config);
$('#input-show_submit_mode').click(function() {
if (this.checked) {
$.cookie('show_submit_mode', '', {
path: '/'
path: '/list',
expires: 365,
});
} else {
$.removeCookie('show_submit_mode', {
path: '/'
path: '/list',
});
}
location.reload();
@ -190,11 +192,12 @@ $pag = new Paginator($pag_config);
$('#input-show_difficulty').click(function() {
if (this.checked) {
$.cookie('show_difficulty', '', {
path: '/'
path: '/list',
expires: 365,
});
} else {
$.removeCookie('show_difficulty', {
path: '/'
path: '/list',
});
}
location.reload();

View File

@ -45,9 +45,11 @@ function getListTR($info) {
if ($list->info['is_hidden']) {
$html .= ' <span class="badge text-bg-danger"><i class="bi bi-eye-slash-fill"></i> ' . UOJLocale::get('hidden') . '</span> ';
}
if (isset($_COOKIE['show_tags_mode'])) {
foreach ($list->queryTags() as $tag) {
$html .= ' <a class="uoj-list-tag"><span class="badge text-bg-secondary">' . HTML::escape($tag) . '</span></a> ';
}
}
$html .= HTML::tag('td', [], max(0, $accepted));
$html .= HTML::tag('td', [], count($problems));
$html .= HTML::tag_end('td');
@ -121,11 +123,12 @@ $pag = new Paginator([
$('#input-show_tags_mode').click(function() {
if (this.checked) {
$.cookie('show_tags_mode', '', {
path: '/'
path: '/lists',
expires: 365,
});
} else {
$.removeCookie('show_tags_mode', {
path: '/'
path: '/lists',
});
}
location.reload();

View File

@ -288,11 +288,12 @@ $pag = new Paginator([
$('#input-show_tags_mode').click(function() {
if (this.checked) {
$.cookie('show_tags_mode', '', {
path: '/'
path: '/problems',
expires: 365,
});
} else {
$.removeCookie('show_tags_mode', {
path: '/'
path: '/problems',
});
}
location.reload();
@ -300,11 +301,12 @@ $pag = new Paginator([
$('#input-show_submit_mode').click(function() {
if (this.checked) {
$.cookie('show_submit_mode', '', {
path: '/'
path: '/problems',
expires: 365,
});
} else {
$.removeCookie('show_submit_mode', {
path: '/'
path: '/problems'
});
}
location.reload();
@ -312,11 +314,12 @@ $pag = new Paginator([
$('#input-show_difficulty').click(function() {
if (this.checked) {
$.cookie('show_difficulty', '', {
path: '/'
path: '/problems',
expires: 365,
});
} else {
$.removeCookie('show_difficulty', {
path: '/'
path: '/problems'
});
}
location.reload();