feat: problem lists

This commit is contained in:
Baoshuo Ren 2022-09-18 19:34:17 +08:00
parent 3b5e29f417
commit 0d97897d92
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
12 changed files with 530 additions and 48 deletions

View File

@ -591,6 +591,49 @@ LOCK TABLES `problems_tags` WRITE;
/*!40000 ALTER TABLE `problems_tags` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `lists`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `lists` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` text NOT NULL,
`is_hidden` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `lists_problems`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `lists_problems` (
`list_id` int(11) NOT NULL,
`problem_id` int(11) NOT NULL,
PRIMARY KEY (`list_id`, `problem_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `lists_tags`
--
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `lists_tags` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`list_id` int(11) NOT NULL,
`tag` varchar(30) NOT NULL,
PRIMARY KEY (`id`),
KEY `list_id` (`list_id`),
KEY `tag` (`tag`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `search_requests`
--

View File

@ -0,0 +1,279 @@
<?php
if (!Auth::check()) {
become403Page(UOJLocale::get('need login'));
}
requirePHPLib('form');
requirePHPLib('judger');
requirePHPLib('data');
$list_id = $_GET['id'];
if (!validateUInt($list_id) || !($list = queryProblemList($list_id))) {
become404Page();
}
if (isSuperUser($myUser)) {
$list_tags = queryProblemListTags($list_id);
$list_editor = new UOJBlogEditor();
$list_editor->name = 'list';
$list_editor->blog_url = null;
$list_editor->cur_data = array(
'title' => $list['title'],
'tags' => $list_tags,
'is_hidden' => $list['is_hidden']
);
$list_editor->label_text = array_merge($list_editor->label_text, array(
'view blog' => '保存题单信息',
'blog visibility' => '题单可见性'
));
$list_editor->show_editor = false;
$list_editor->save = function($data) {
global $list_id, $list;
DB::update("update lists set title = '" . DB::escape($data['title']) . "' where id = {$list_id}");
if ($data['tags'] !== $list_tags) {
DB::delete("delete from lists_tags where list_id = {$list_id}");
foreach ($data['tags'] as $tag) {
DB::insert("insert into lists_tags (list_id, tag) values ({$list_id}, '" . DB::escape($tag) . "')");
}
}
if ($data['is_hidden'] != $list['is_hidden'] ) {
DB::update("update lists set is_hidden = {$data['is_hidden']} where id = {$list_id}");
}
};
$list_editor->runAtServer();
}
function removeFromProblemListForm($problem_id) {
$res_form = new UOJForm("remove_problem_{$problem_id}");
$input_name = "problem_id_delete_{$problem_id}";
$res_form->addHidden($input_name, $problem_id, function($problem_id) {
global $myUser;
if (!isSuperUser($myUser)) {
return '只有超级用户可以编辑题单';
}
}, null);
$res_form->handle = function() use ($input_name) {
global $list_id;
$problem_id = $_POST[$input_name];
DB::query("delete from lists_problems where problem_id={$problem_id} and list_id={$list_id}");
};
$res_form->submit_button_config['class_str'] = 'btn btn-danger';
$res_form->submit_button_config['text'] = '删除';
$res_form->submit_button_config['align'] = 'inline';
return $res_form;
}
$removeProblemForms = array();
if (isSuperUser($myUser)) {
$problem_ids = DB::query("select problem_id from lists_problems where list_id = {$list_id}");
while ($row = DB::fetch($problem_ids)) {
$problem_id = $row['problem_id'];
$removeForm = removeFromProblemListForm($problem_id);
$removeForm->runAtServer();
$removeProblemForms[$problem_id] = $removeForm;
}
}
if (isSuperUser($myUser)) {
$add_new_problem_form = new UOJForm('add_new_problem');
$add_new_problem_form->addInput('problem_id', 'text', '题目 ID', '',
function ($x) {
global $myUser, $list_id;
if (!isSuperUser($myUser)) {
return '只有超级用户可以编辑题单';
}
if (!validateUInt($x)) {
return 'ID 不合法';
}
$problem = queryProblemBrief($x);
if (!$problem) {
return '题目不存在';
}
if (queryProblemInList($list_id, $x)) {
return '该题目已经在题单中';
}
return '';
},
null
);
$add_new_problem_form->submit_button_config['align'] = 'compressed';
$add_new_problem_form->submit_button_config['text'] = '添加到题单';
$add_new_problem_form->handle = function() {
global $list_id, $myUser;
$problem_id = $_POST['problem_id'];
DB::insert("insert into lists_problems (list_id, problem_id) values ({$list_id}, {$problem_id})");
};
$add_new_problem_form->runAtServer();
}
function echoProblem($problem) {
global $myUser, $removeProblemForms;
if (isProblemVisibleToUser($problem, $myUser)) {
echo '<tr class="text-center">';
if ($problem['submission_id']) {
echo '<td class="success">';
} else {
echo '<td>';
}
echo '#', $problem['id'], '</td>';
echo '<td class="text-left">';
if (isSuperUser($myUser)) {
$form = $removeProblemForms[$problem['id']];
$form->printHTML();
}
if ($problem['is_hidden']) {
echo ' <span class="text-danger">[隐藏]</span> ';
}
if ($problem['uploader'] == $myUser['username']) {
echo ' <span class="text-info">[我的题目]</span> ';
}
echo '<a href="/problem/', $problem['id'], '">', $problem['title'], '</a>';
if (isset($_COOKIE['show_tags_mode'])) {
echo ' <span class="text-info" style="font: 10px">' . $problem["uploader"] . '</span> ';
foreach (queryProblemTags($problem['id']) as $tag) {
echo '<a class="uoj-problem-tag">', '<span class="badge badge-pill badge-secondary">', HTML::escape($tag), '</span>', '</a>';
}
}
echo '</td>';
if (isset($_COOKIE['show_submit_mode'])) {
$perc = $problem['submit_num'] > 0 ? round(100 * $problem['ac_num'] / $problem['submit_num']) : 0;
echo <<<EOD
<td><a href="/submissions?problem_id={$problem['id']}&min_score=100&max_score=100">&times;{$problem['ac_num']}</a></td>
<td><a href="/submissions?problem_id={$problem['id']}">&times;{$problem['submit_num']}</a></td>
<td>
<div class="progress bot-buffer-no">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="$perc" aria-valuemin="0" aria-valuemax="100" style="width: $perc%; min-width: 20px;">{$perc}%</div>
</div>
</td>
EOD;
}
if (isset($_COOKIE['show_difficulty'])) {
$extra_config = getProblemExtraConfig($problem);
if ($extra_config['difficulty'] == 0) {
echo "<td></td>";
} else {
echo "<td>{$extra_config['difficulty']}</td>";
}
}
echo '<td class="text-left">', getClickZanBlock('P', $problem['id'], $problem['zan']), '</td>';
echo '</tr>';
}
}
$header = '<tr>';
$header .= '<th class="text-center" style="width:5em;">ID</th>';
$header .= '<th>'.UOJLocale::get('problems::problem').'</th>';
if (isset($_COOKIE['show_submit_mode'])) {
$header .= '<th class="text-center" style="width:5em;">'.UOJLocale::get('problems::ac').'</th>';
$header .= '<th class="text-center" style="width:5em;">'.UOJLocale::get('problems::submit').'</th>';
$header .= '<th class="text-center" style="width:150px;">'.UOJLocale::get('problems::ac ratio').'</th>';
}
if (isset($_COOKIE['show_difficulty'])) {
$header .= '<th class="text-center" style="width:7em;">'.UOJLocale::get('problems::difficulty').'</th>';
}
$header .= '<th class="text-center" style="width:180px;">'.UOJLocale::get('appraisal').'</th>';
$header .= '</tr>';
$pag_config = array('page_len' => 40);
$pag_config['col_names'] = array('best_ac_submissions.submission_id as submission_id', 'problems.id as id', 'problems.is_hidden as is_hidden', 'problems.title as title', 'problems.submit_num as submit_num', 'problems.ac_num as ac_num', 'problems.zan as zan', 'problems.extra_config as extra_config', 'problems.uploader as uploader');
$pag_config['table_name'] = "problems left join best_ac_submissions on best_ac_submissions.submitter = '{$myUser['username']}' and problems.id = best_ac_submissions.problem_id inner join lists_problems lp on lp.list_id = {$list_id} and lp.problem_id = problems.id";
$pag_config['cond'] = '1';
$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');
?>
<?php echoUOJPageHeader(UOJLocale::get('problems lists')); ?>
<?php
if (isSuperUser($myUser)) {
echo '<h5>编辑题单信息</h5>';
echo '<div class="mb-4">';
$list_editor->printHTML();
echo '</div>';
echo '<h5>添加题目到题单</h5>';
$add_new_problem_form->printHTML();
}
?>
<div class="row">
<div class="col-sm-4">
<h5>"<?= $list['title'] ?>" 中的题目: </h5>
<p>(题单 ID: #<?= $list['id'] ?>)</p>
</div>
<div class="col-sm-4 order-sm-9 checkbox text-right fine-tune-down">
<label class="checkbox-inline" for="input-show_tags_mode"><input type="checkbox" id="input-show_tags_mode" <?= isset($_COOKIE['show_tags_mode']) ? 'checked="checked" ': ''?>/> <?= UOJLocale::get('problems::show tags') ?></label>
<label class="checkbox-inline" for="input-show_submit_mode"><input type="checkbox" id="input-show_submit_mode" <?= isset($_COOKIE['show_submit_mode']) ? 'checked="checked" ': ''?>/> <?= UOJLocale::get('problems::show statistics') ?></label>
</div>
<div class="col-sm-4 order-sm-5">
<?php echo $pag->pagination(); ?>
</div>
</div>
<div class="top-buffer-sm"></div>
<script type="text/javascript">
$('#input-show_tags_mode').click(function() {
if (this.checked) {
$.cookie('show_tags_mode', '', {path: '/'});
} else {
$.removeCookie('show_tags_mode', {path: '/'});
}
location.reload();
});
$('#input-show_submit_mode').click(function() {
if (this.checked) {
$.cookie('show_submit_mode', '', {path: '/'});
} else {
$.removeCookie('show_submit_mode', {path: '/'});
}
location.reload();
});
$('#input-show_difficulty').click(function() {
if (this.checked) {
$.cookie('show_difficulty', '', {path: '/'});
} else {
$.removeCookie('show_difficulty', {path: '/'});
}
location.reload();
});
</script>
<?php
echo '<div class="', join($div_classes, ' '), '">';
echo '<table class="', join($table_classes, ' '), '">';
echo '<thead>';
echo $header;
echo '</thead>';
echo '<tbody>';
foreach ($pag->get() as $idx => $row) {
echoProblem($row);
echo "\n";
}
if ($pag->isEmpty()) {
echo '<tr><td class="text-center" colspan="233">'.UOJLocale::get('none').'</td></tr>';
}
echo '</tbody>';
echo '</table>';
echo '</div>';
echo $pag->pagination();
?>
<?php echoUOJPageFooter() ?>

View File

@ -0,0 +1,107 @@
<?php
if (!Auth::check()) {
become403Page(UOJLocale::get('need login'));
}
requirePHPLib('form');
requirePHPLib('judger');
requirePHPLib('data');
if (isSuperUser($myUser)) {
$new_list_form = new UOJForm('new_list');
$new_list_form->handle = function() {
DB::query("insert into lists (title, is_hidden) values ('未命名题单', 1)");
};
$new_list_form->submit_button_config['align'] = 'right';
$new_list_form->submit_button_config['class_str'] = 'btn btn-primary';
$new_list_form->submit_button_config['text'] = UOJLocale::get('problems::add new list');
$new_list_form->submit_button_config['smart_confirm'] = '';
$new_list_form->runAtServer();
}
function echoList($list) {
global $myUser;
echo '<tr class="text-center">';
if ($list['problem_count'] == $list['accepted'] && $list['problem_count'] > 0) {
echo '<td class="success">';
} else {
echo '<td>';
}
echo '#', $list['list_id'], '</td>';
echo '<td class="text-left">';
if ($list['is_hidden']) {
echo ' <span class="text-danger">[隐藏]</span> ';
}
echo '<a href="/problem_list/', $list['list_id'], '">', $list['title'], '</a>';
foreach (queryProblemListTags($list['list_id']) as $tag) {
echo '<a class="uoj-list-tag">', '<span class="badge badge-pill badge-secondary">', HTML::escape($tag), '</span>', '</a>';
}
echo '</td>';
echo "<td>{$list['accepted']}</td>";
echo "<td>{$list['problem_count']}</td>";
echo '</tr>';
}
?>
<?php echoUOJPageHeader(UOJLocale::get('problems lists')) ?>
<?php
if (isSuperUser($myUser)) {
global $new_list_form;
$new_list_form->printHTML();
}
$problem_list_caption = UOJLocale::get('problems::problem list');
$ac_caption = UOJLocale::get('problems::ac');
$total_caption = UOJLocale::get('problems::total');
$header = <<<EOD
<tr>
<th class="text-center" style="width:5em;">ID</th>
<th>{$problem_list_caption}</th>
<th class="text-center" style="width:5em;">{$ac_caption}</th>
<th class="text-center" style="width:5em;">{$total_caption}</th>
</tr>
EOD;
$cond = array();
$search_tag = null;
if (isset($_GET['tag'])) {
$search_tag = $_GET['tag'];
}
if ($search_tag) {
$cond[] = "'" . DB::escape($search_tag) . "' in (select tag from lists_tags where lists_tags.list_id = a.id)";
}
if (!isSuperUser($myUser)) {
$cond[] = "is_hidden = 0";
}
if ($cond) {
$cond = join($cond, ' and ');
} else {
$cond = '1';
}
$from = "lists a left join lists_problems b on a.id = b.list_id left join best_ac_submissions c on (b.problem_id = c.problem_id and c.submitter = '{$myUser['username']}')";
echoLongTable(
array('a.id as list_id', 'a.title as title', 'a.is_hidden as is_hidden', 'count(b.problem_id) as problem_count', 'count(c.submitter) as accepted'),
$from, $cond, 'group by a.id order by a.id desc',
$header,
'echoList',
array('page_len' => 40,
'table_classes' => array('table', 'table-bordered', 'table-hover', 'table-striped'),
'print_after_table' => function() {
global $myUser;
},
'head_pagination' => true
)
);
?>
<?php echoUOJPageFooter() ?>

View File

@ -63,6 +63,25 @@ function queryProblemTags($id) {
}
return $tags;
}
function queryProblemList($id) {
return DB::selectFirst("select * from lists where id = $id", MYSQLI_ASSOC);
}
function queryProblemListTags($id) {
$tags = array();
$result = DB::query("select tag from lists_tags where list_id = $id order by id");
if (!$result) {
return $tags;
}
while ($row = DB::fetch($result, MYSQLI_NUM)) {
$tags[] = $row[0];
}
return $tags;
}
function queryProblemInList($list_id, $problem_id) {
return DB::selectFirst("select * from lists_problems where list_id='$blog_id' and problem_id='$problem_id'", MYSQLI_ASSOC);
}
function queryContestProblemRank($contest, $problem) {
if (!DB::selectFirst("select * from contests_problems where contest_id = {$contest['id']} and problem_id = {$problem['id']}")) {
return null;

View File

@ -11,6 +11,7 @@ return [
'system manage' => 'System Manage',
'contests' => 'Contests',
'problems' => 'Problems',
'problems lists' => 'Problems Lists',
'groups' => 'Groups',
'add new group' => 'Add new group',
'users count' => 'Users',

View File

@ -11,6 +11,7 @@ return [
'system manage' => '系统管理',
'contests' => '比赛',
'problems' => '题库',
'problems lists' => '题单',
'groups' => '小组',
'add new group' => '添加新小组',
'users count' => '用户数量',

View File

@ -1,15 +1,19 @@
<?php
return [
'problem' => 'Problem',
'problem list' => 'Problem List',
'all problems' => 'All Problems',
'template problems' => 'Template Problems',
'add new' => 'Add new problem',
'add new list' => 'Add new problem list',
'title' => 'Title',
'total' => 'Total',
'ac' => 'AC',
'submit' => 'Submit',
'ac ratio' => 'AC Ratio',
'show tags' => 'Show tags',
'show statistics' => 'Show statistics',
'submissions statistics' => 'Submissions statistics',
'statement' => 'Statement',
'custom test' => 'Custom Test',
'manage' => 'Manage',

View File

@ -1,9 +1,13 @@
<?php
return [
'problem' => '题目',
'problem list' => '题单',
'all problems' => '总题库',
'template problems' => '模板题库',
'add new' => '添加新题',
'add new list' => '添加新题单',
'title' => '标题',
'total' => '总题数',
'ac' => 'AC',
'submit' => '提交',
'ac ratio' => 'AC 率',

View File

@ -18,6 +18,9 @@ Route::group([
Route::any('/problem/{id}/manage/statement', '/problem_statement_manage.php');
Route::any('/problem/{id}/manage/managers', '/problem_managers_manage.php');
Route::any('/problem/{id}/manage/data', '/problem_data_manage.php');
Route::any('/problem_lists', '/problem_lists.php');
Route::any('/problem_list/{id}', '/problem_list.php');
Route::any('/contests', '/contests.php');
Route::any('/contest/new', '/add_contest.php');

View File

@ -6,8 +6,9 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="nav navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/contests') ?>"><span class="glyphicon glyphicon-stats"></span> <?= UOJLocale::get('contests') ?></a></li>
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/problems') ?>"><span class="glyphicon glyphicon-list-alt"></span> <?= UOJLocale::get('problems') ?></a></li>
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/problems') ?>"><span class="glyphicon glyphicon-th-list"></span> <?= UOJLocale::get('problems') ?></a></li>
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/groups') ?>"><span class="glyphicon glyphicon-education"></span> <?= UOJLocale::get('groups') ?></a></li>
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/problem_lists') ?>"><span class="glyphicon glyphicon-list-alt"></span> <?= UOJLocale::get('problems lists') ?></a></li>
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/submissions') ?>"><span class="glyphicon glyphicon-tasks"></span> <?= UOJLocale::get('submissions') ?></a></li>
<li class="nav-item"><a class="nav-link" href="<?= HTML::url('/hacks') ?>"><span class="glyphicon glyphicon-flag"></span> <?= UOJLocale::get('hacks') ?></a></li>
<li class="nav-item"><a class="nav-link" href="<?= HTML::blog_list_url() ?>"><span class="glyphicon glyphicon-edit"></span> <?= UOJLocale::get('blogs') ?></a></li>

View File

@ -11,7 +11,7 @@ function blog_editor_init(name, editor_config) {
var input_tags = $("#input-" + name + "_tags");
var input_content_md = $("#input-" + name + "_content_md");
var input_is_hidden = $("#input-" + name + "_is_hidden");
var this_form = input_content_md[0].form;
var this_form = input_is_hidden[0].form;
var is_saved;
var last_save_done = true;
@ -23,7 +23,7 @@ function blog_editor_init(name, editor_config) {
var italic_btn = $('<button type="button" class="btn btn-secondary btn-sm"><span class="glyphicon glyphicon-italic"></span></button>');
save_btn.tooltip({ container: 'body', title: '保存 (Ctrl-S)' });
preview_btn.tooltip({ container: 'body', title: '预览 (Ctrl-D)' });
preview_btn.tooltip({ container: 'body', title: '预览 (Ctrl-D)' });
bold_btn.tooltip({ container: 'body', title: '粗体 (Ctrl-B)' });
italic_btn.tooltip({ container: 'body', title: '斜体 (Ctrl-I)' });
@ -78,34 +78,36 @@ function blog_editor_init(name, editor_config) {
set_saved(true);
// init codemirror
input_content_md.wrap('<div class="blog-content-md-editor"></div>');
var blog_contend_md_editor = input_content_md.parent();
input_content_md.before($('<div class="blog-content-md-editor-toolbar"></div>')
.append(toolbar)
);
input_content_md.wrap('<div class="blog-content-md-editor-in"></div>');
var codeeditor;
if (editor_config.type == 'blog') {
codeeditor = CodeMirror.fromTextArea(input_content_md[0], {
mode: 'gfm',
lineNumbers: true,
matchBrackets: true,
lineWrapping: true,
styleActiveLine: true,
theme: 'default'
});
} else if (editor_config.type == 'slide') {
codeeditor = CodeMirror.fromTextArea(input_content_md[0], {
mode: 'plain',
lineNumbers: true,
matchBrackets: true,
lineWrapping: true,
styleActiveLine: true,
theme: 'default'
});
if (input_content_md[0]) {
input_content_md.wrap('<div class="blog-content-md-editor"></div>');
var blog_contend_md_editor = input_content_md.parent();
input_content_md.before($('<div class="blog-content-md-editor-toolbar"></div>')
.append(toolbar)
);
input_content_md.wrap('<div class="blog-content-md-editor-in"></div>');
var codeeditor;
if (editor_config.type == 'blog') {
codeeditor = CodeMirror.fromTextArea(input_content_md[0], {
mode: 'gfm',
lineNumbers: true,
matchBrackets: true,
lineWrapping: true,
styleActiveLine: true,
theme: 'default'
});
} else if (editor_config.type == 'slide') {
codeeditor = CodeMirror.fromTextArea(input_content_md[0], {
mode: 'plain',
lineNumbers: true,
matchBrackets: true,
lineWrapping: true,
styleActiveLine: true,
theme: 'default'
});
}
}
function preview(html) {
var iframe = $('<iframe frameborder="0"></iframe>');
blog_contend_md_editor.append(
@ -219,13 +221,23 @@ function blog_editor_init(name, editor_config) {
}
// event
codeeditor.on('change', function() {
codeeditor.save();
set_saved(false);
});
if (input_content_md[0]) {
codeeditor.on('change', function() {
codeeditor.save();
set_saved(false);
});
}
$.merge(input_title, input_tags).on('input', function() {
set_saved(false);
});
$('#a-' + name + '_save').click(function (e) {
e.preventDefault();
save({
done: function () {
location.reload();
}
});
});
save_btn.click(function() {
save();
});
@ -274,20 +286,22 @@ function blog_editor_init(name, editor_config) {
});
// init hot keys
codeeditor.setOption("extraKeys", {
"Ctrl-S": function(cm) {
save_btn.click();
},
"Ctrl-B": function(cm) {
bold_btn.click();
},
"Ctrl-D": function(cm) {
preview_btn.click();
},
"Ctrl-I": function(cm) {
italic_btn.click();
}
});
if (input_content_md[0]) {
codeeditor.setOption("extraKeys", {
"Ctrl-S": function(cm) {
save_btn.click();
},
"Ctrl-B": function(cm) {
bold_btn.click();
},
"Ctrl-D": function(cm) {
preview_btn.click();
},
"Ctrl-I": function(cm) {
italic_btn.click();
}
});
}
$(document).bind('keydown', 'ctrl+d', function() {
preview_btn.click();
return false;

View File

@ -245,6 +245,11 @@ $.fn.uoj_problem_tag = function() {
$(this).attr('href', uojHome + '/problems?tag=' + encodeURIComponent($(this).text()));
});
}
$.fn.uoj_list_tag = function() {
return this.each(function() {
$(this).attr('href', uojHome + '/problem_lists?tag=' + encodeURIComponent($(this).text()));
});
}
$.fn.uoj_blog_tag = function() {
return this.each(function() {
$(this).attr('href', uojBlogUrl + '/archive?tag=' + encodeURIComponent($(this).text()));
@ -408,6 +413,7 @@ $.fn.uoj_highlight = function() {
}
});
$(this).find(".uoj-problem-tag").uoj_problem_tag();
$(this).find(".uoj-list-tag").uoj_list_tag();
$(this).find(".uoj-blog-tag").uoj_blog_tag();
$(this).find(".uoj-click-zan-block").click_zan_block();
$(this).find(".countdown").countdown();