mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 09:38:19 +08:00
ui: add scoreboard highlight for self & star user (#797)
This commit is contained in:
1 parent
9d4d1b489c
commit
eec828d9a2
2 files changed
+7
-2
No files matched your search
@@ -196,6 +196,9 @@ $highlight-button-color = #F6DF45
|
||||
.col--problem
|
||||
display: none
|
||||
|
||||
.star-highlight
|
||||
background: lighten($primary-color, 90%)
|
||||
|
||||
.page--contest_user
|
||||
.col--uid
|
||||
width: rem(100px)
|
||||
|
||||
@@ -8,7 +8,8 @@ const page = new NamedPage(['contest_scoreboard', 'homework_scoreboard'], () =>
|
||||
const read = () => JSON.parse(localStorage.getItem(key) || '[]');
|
||||
const write = (data) => localStorage.setItem(key, JSON.stringify(data));
|
||||
|
||||
read().forEach((uid) => $(`.star.user--${uid}`).addClass('activated'));
|
||||
$(`.star.user--${UserContext._id}`).closest('tr').addClass('star-highlight');
|
||||
read().forEach((uid) => $(`.star.user--${uid}`).addClass('activated').closest('tr').addClass('star-highlight'));
|
||||
$('.star').on('click', (e) => {
|
||||
const star = read();
|
||||
const $target = $(e.currentTarget);
|
||||
@@ -27,9 +28,10 @@ const page = new NamedPage(['contest_scoreboard', 'homework_scoreboard'], () =>
|
||||
const val = $(e.target).val();
|
||||
if (val === 'all') {
|
||||
$('.data-table tbody tr').show();
|
||||
read().forEach((uid) => $(`.star.user--${uid}`).closest('tr').addClass('star-highlight'));
|
||||
} else if (val === 'star') {
|
||||
$('.data-table tbody tr').hide();
|
||||
read().forEach((uid) => $(`.star.user--${uid}`).closest('tr').show());
|
||||
read().forEach((uid) => $(`.star.user--${uid}`).closest('tr').show().removeClass('star-highlight'));
|
||||
} else if (val === 'rank') {
|
||||
$('.data-table tbody tr').show();
|
||||
$('.rank--unrank').closest('tr').hide();
|
||||
|
||||
Reference in new issue
Block a user