diff --git a/web/app/controllers/index.php b/web/app/controllers/index.php index 0f43c03..f349a93 100644 --- a/web/app/controllers/index.php +++ b/web/app/controllers/index.php @@ -3,7 +3,7 @@ $countdowns = DB::selectAll("select * from countdowns order by endtime asc"); $friend_links = DB::selectAll("select * from friend_links order by level desc, id asc"); - if (!isset($_COOKIE['bootstrap4'])){ + if (!isset($_COOKIE['bootstrap4'])) { $REQUIRE_LIB['bootstrap5'] = ''; } ?> diff --git a/web/app/controllers/problem_set.php b/web/app/controllers/problem_set.php index 92c8f33..3910045 100644 --- a/web/app/controllers/problem_set.php +++ b/web/app/controllers/problem_set.php @@ -10,6 +10,10 @@ if (!isNormalUser($myUser)) { become403Page(); } + + if (!isset($_COOKIE['bootstrap4'])) { + $REQUIRE_LIB['bootstrap5'] = ''; + } if (isSuperUser($myUser) || isProblemManager($myUser) || isProblemUploader($myUser)) { $new_problem_form = new UOJForm('new_problem'); @@ -30,7 +34,8 @@ } function echoProblem($problem) { - global $myUser; + global $myUser, $REQUIRE_LIB; + if (isProblemVisibleToUser($problem, $myUser)) { echo ''; if ($problem['submission_id']) { @@ -39,27 +44,47 @@ echo ''; } echo '#', $problem['id'], ''; - echo ''; + if (isset($REQUIRE_LIB['bootstrap5'])) { + echo ''; + } else { + echo ''; + } if ($problem['is_hidden']) { echo ' [隐藏] '; } if ($problem['uploader'] == $myUser['username']) { echo ' [我的题目] '; } - echo '', $problem['title'], ''; + echo '', $problem['title'], ''; if (isset($_COOKIE['show_tags_mode'])) { echo ' ' . $problem["uploader"] . ' '; foreach (queryProblemTags($problem['id']) as $tag) { - echo '', '', HTML::escape($tag), '', ''; + if (isset($REQUIRE_LIB['bootstrap5'])) { + echo ''; + echo ''; + } else { + echo ''; + echo ''; + } + echo HTML::escape($tag), ''; + echo ' '; } } echo ''; if (isset($_COOKIE['show_submit_mode'])) { + $a_class = ''; + if (isset($REQUIRE_LIB['bootstrap5'])) { + $a_class .= ' text-decoration-none '; + } $perc = $problem['submit_num'] > 0 ? round(100 * $problem['ac_num'] / $problem['submit_num']) : 0; echo <<×{$problem['ac_num']} - ×{$problem['submit_num']} + ×{$problem['ac_num']} + ×{$problem['submit_num']}
{$perc}%
@@ -125,24 +150,77 @@ EOD; $pag_config['tail'] = "order by id asc"; $pag = new Paginator($pag_config); - $div_classes = array('table-responsive'); - $table_classes = array('table', 'table-bordered', 'table-hover', 'table-striped'); + $div_classes = isset($REQUIRE_LIB['bootstrap5']) + ? array('card', 'mb-3') + : array('table-responsive'); + $table_classes = isset($REQUIRE_LIB['bootstrap5']) + ? array('table', 'uoj-problem-list-table', 'mb-0') + : array('table', 'table-bordered', 'table-hover', 'table-striped'); ?> -printHTML(); - } - ?> + + +
+ + printHTML(); ?> + +
+ +
-
- - +
+ +
+ +
+ + + +
+ +
+
-
+
pagination(); ?>
diff --git a/web/app/controllers/submissions_list.php b/web/app/controllers/submissions_list.php index d99fbe7..ddc4acc 100644 --- a/web/app/controllers/submissions_list.php +++ b/web/app/controllers/submissions_list.php @@ -39,7 +39,7 @@ } - if (!isset($_COOKIE['bootstrap4'])){ + if (!isset($_COOKIE['bootstrap4'])) { $REQUIRE_LIB['bootstrap5'] = ''; } ?> diff --git a/web/app/libs/uoj-html-lib.php b/web/app/libs/uoj-html-lib.php index 8b76315..2d3baf9 100644 --- a/web/app/libs/uoj-html-lib.php +++ b/web/app/libs/uoj-html-lib.php @@ -63,7 +63,7 @@ function becomeMsgPage($msg, $title = '消息') { if (UOJContext::isAjax()) { die($msg); } else { - if (!isset($_COOKIE['bootstrap4'])){ + if (!isset($_COOKIE['bootstrap4'])) { $REQUIRE_LIB['bootstrap5'] = ''; } diff --git a/web/app/views/page-header.php b/web/app/views/page-header.php index 89f8f20..d84134f 100644 --- a/web/app/views/page-header.php +++ b/web/app/views/page-header.php @@ -91,6 +91,7 @@ + diff --git a/web/css/uoj-bs5.css b/web/css/uoj-bs5.css index 2a01b3d..b1bcd05 100644 --- a/web/css/uoj-bs5.css +++ b/web/css/uoj-bs5.css @@ -43,6 +43,40 @@ label { float: right; } +.uoj-problem-list-table > tbody > tr:last-child, .uoj-submissions-table > tbody > tr:last-child { border-bottom-color: transparent; } + +.uoj-click-zan-block { + display: inline-block; + min-width: 140px; + text-align: left; +} + +.uoj-click-zan-up, .uoj-click-zan-down, .uoj-click-zan-cnt { + margin-left: 5px; + margin-right: 5px; +} + +.uoj-click-zan-block-cur-up .uoj-click-zan-up { + color: green; + font-weight: 700; +} +.uoj-click-zan-block-cur-down .uoj-click-zan-down { + color: red; + font-weight: 700; +} +.uoj-click-zan-block-cur-down .uoj-click-zan-up, .uoj-click-zan-block-cur-up .uoj-click-zan-down { + color: gray; +} + +.uoj-click-zan-block-positive .uoj-click-zan-cnt { + color: green; +} +.uoj-click-zan-block-neutral .uoj-click-zan-cnt { + color: gray; +} +.uoj-click-zan-block-negative .uoj-click-zan-cnt { + color: red; +} diff --git a/web/js/uoj.js b/web/js/uoj.js index 4516bf5..0f6af74 100644 --- a/web/js/uoj.js +++ b/web/js/uoj.js @@ -297,15 +297,22 @@ $.fn.click_zan_block = function() { $(this).addClass('uoj-click-zan-block-negative'); } + var up_icon_html = isBootstrap5Page + ? '' + : ''; + var down_icon_html = isBootstrap5Page + ? '' + : ''; + var node = this; - var up_node = $(''+uojLocale('click-zan::good')+'').click(function(e) { + var up_node = $(''+up_icon_html+uojLocale('click-zan::good')+'').click(function(e) { e.preventDefault(); click_zan(id, type, 1, node); - }); - var down_node = $(''+uojLocale('click-zan::bad')+'').click(function(e) { + }).addClass(isBootstrap5Page ? 'text-decoration-none' : ''); + var down_node = $(''+down_icon_html+uojLocale('click-zan::bad')+'').click(function(e) { e.preventDefault(); click_zan(id, type, -1, node); - }); + }).addClass(isBootstrap5Page ? 'text-decoration-none' : ''); $(this) .append(up_node)