增加只显示未完成题目的按钮
This commit is contained in:
@@ -76,6 +76,42 @@
|
|||||||
<label><?php echo $MSG_SHOW_TAGS; ?></label>
|
<label><?php echo $MSG_SHOW_TAGS; ?></label>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="ui toggle checkbox" id="show_solved" style="margin-left: 10px;">
|
||||||
|
<style id="show_solved_style"></style>
|
||||||
|
<script>
|
||||||
|
if (localStorage.getItem('show_solved') != '0') {
|
||||||
|
document.write('<input type="checkbox" checked>');
|
||||||
|
document.getElementById('show_solved_style').innerHTML = '';
|
||||||
|
} else {
|
||||||
|
document.write('<input type="checkbox">');
|
||||||
|
document.getElementById('show_solved_style').innerHTML = '.solved-problem { display: none; }';
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
$('#show_solved').checkbox('setting', 'onChange', function () {
|
||||||
|
let checked = $('#show_solved').checkbox('is checked');
|
||||||
|
localStorage.setItem('show_solved', checked ? '1' : '0');
|
||||||
|
if (checked) {
|
||||||
|
document.getElementById('show_solved_style').innerHTML = '';
|
||||||
|
// 显示所有题目
|
||||||
|
document.querySelectorAll('.solved-problem').forEach(function(row) {
|
||||||
|
row.style.display = '';
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
document.getElementById('show_solved_style').innerHTML = '.solved-problem { display: none; }';
|
||||||
|
// 隐藏已解决的题目
|
||||||
|
document.querySelectorAll('.solved-problem').forEach(function(row) {
|
||||||
|
row.style.display = 'none';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<label>显示已正确题目</label>
|
||||||
|
</div>
|
||||||
<div style="margin-left: 10px; display: inline-block; ">
|
<div style="margin-left: 10px; display: inline-block; ">
|
||||||
<a style="margin-left: 10px; " href="category.php" class="ui labeled icon mini green button"><i
|
<a style="margin-left: 10px; " href="category.php" class="ui labeled icon mini green button"><i
|
||||||
class="plus icon"></i> <?php echo $MSG_SHOW_ALL_TAGS; ?></a>
|
class="plus icon"></i> <?php echo $MSG_SHOW_ALL_TAGS; ?></a>
|
||||||
@@ -199,7 +235,11 @@
|
|||||||
$tcolor = 0;
|
$tcolor = 0;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($result as $row) {
|
foreach ($result as $row) {
|
||||||
echo "<tr>";
|
$solved_class = '';
|
||||||
|
if (isset($_SESSION[$OJ_NAME . '_' . 'user_id']) && isset($acc_arr[$row['problem_id']])) {
|
||||||
|
$solved_class = 'solved-problem';
|
||||||
|
}
|
||||||
|
echo "<tr class=\"$solved_class\">";
|
||||||
if (isset($_SESSION[$OJ_NAME . '_' . 'user_id'])) {
|
if (isset($_SESSION[$OJ_NAME . '_' . 'user_id'])) {
|
||||||
|
|
||||||
if (isset($sub_arr[$row['problem_id']])) {
|
if (isset($sub_arr[$row['problem_id']])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user