feat: hide click_zan_block text
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-10-03 20:47:32 +08:00
parent 82d4bf59f3
commit 82ca33db5e
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
7 changed files with 23 additions and 11 deletions

View File

@ -81,7 +81,7 @@ EOD;
echo "<td>{$extra_config['difficulty']}</td>";
}
}
echo '<td class="text-left">', getClickZanBlock('P', $problem['id'], $problem['zan']), '</td>';
echo '<td class="text-left">', getClickZanBlock('P', $problem['id'], $problem['zan'], null, false), '</td>';
echo '</tr>';
}
}
@ -97,7 +97,7 @@ EOD;
if (isset($_COOKIE['show_difficulty'])) {
$header .= '<th class="text-center" style="width:3em;">'.UOJLocale::get('problems::difficulty').'</th>';
}
$header .= '<th class="text-center" style="width:180px;">'.UOJLocale::get('appraisal').'</th>';
$header .= '<th class="text-center" style="width:100px;">'.UOJLocale::get('appraisal').'</th>';
$header .= '</tr>';
$pag_config = array('page_len' => 40);

View File

@ -100,7 +100,7 @@ EOD;
echo "<td>{$extra_config['difficulty']}</td>";
}
}
echo '<td class="text-left">', getClickZanBlock('P', $problem['id'], $problem['zan']), '</td>';
echo '<td class="text-center">', getClickZanBlock('P', $problem['id'], $problem['zan'], null, false), '</td>';
echo '</tr>';
}
}
@ -140,7 +140,7 @@ EOD;
if (isset($_COOKIE['show_difficulty'])) {
$header .= '<th class="text-center" style="width:3em;">'.UOJLocale::get('problems::difficulty').'</th>';
}
$header .= '<th class="text-center" style="width:180px;">'.UOJLocale::get('appraisal').'</th>';
$header .= '<th class="text-center" style="width:100px;">'.UOJLocale::get('appraisal').'</th>';
$header .= '</tr>';
$tabs_info = array(

View File

@ -49,7 +49,7 @@
<tr>
<th>标题</th>
<th style="width: 20%">发表时间</th>
<th class="text-center" style="width: 180px">评价</th>
<th class="text-center" style="width: 100px">评价</th>
</tr>
</thead>
<tbody>
@ -67,7 +67,7 @@
<?php endforeach ?>
</td>
<td><?= $blog['post_time'] ?></td>
<td><?= getClickZanBlock('B', $blog['id'], $blog['zan']) ?></td>
<td><?= getClickZanBlock('B', $blog['id'], $blog['zan'], null, false) ?></td>
</tr>
<?php endforeach ?>
</tbody>

View File

@ -158,11 +158,11 @@ function getBlogLink($id) {
return $result;
}
function getClickZanBlock($type, $id, $cnt, $val = null) {
function getClickZanBlock($type, $id, $cnt, $val = null, $show_text = true) {
if ($val == null) {
$val = queryZanVal($id, $type, Auth::user());
}
return '<div class="uoj-click-zan-block" data-id="'.$id.'" data-type="'.$type.'" data-val="'.$val.'" data-cnt="'.$cnt.'"></div>';
return '<div class="uoj-click-zan-block" data-id="'.$id.'" data-type="'.$type.'" data-val="'.$val.'" data-cnt="'.$cnt.'" '.($show_text ? ' data-show-text="1" ' : '') . '></div>';
}

View File

@ -53,9 +53,14 @@ label {
.uoj-click-zan-block {
display: inline-block;
min-width: 100px;
text-align: center;
font-size: 0.9em;
}
.uoj-click-zan-block[data-show-text] {
min-width: 140px;
text-align: left;
font-size: 0.9em;
}
.uoj-click-zan-up,

View File

@ -342,6 +342,12 @@ pre {
.uoj-click-zan-block {
display: inline-block;
min-width: 100px;
text-align: center;
font-size: 0.9em;
}
.uoj-click-zan-block[data-show-text] {
min-width: 140px;
text-align: left;
}

View File

@ -277,6 +277,7 @@ $.fn.click_zan_block = function() {
var type = $(this).data('type');
var val = parseInt($(this).data('val'));
var cnt = parseInt($(this).data('cnt'));
var show_text = Boolean($(this).data('show-text'));
if (isNaN(cnt)) {
return;
}
@ -305,11 +306,11 @@ $.fn.click_zan_block = function() {
: '<span class="glyphicon glyphicon-thumbs-down"></span>';
var node = this;
var up_node = $('<a href="#" class="uoj-click-zan-up">'+up_icon_html+uojLocale('click-zan::good')+'</a>').click(function(e) {
var up_node = $('<a href="#" class="uoj-click-zan-up">'+up_icon_html+(show_text ? uojLocale('click-zan::good') : '')+'</a>').click(function(e) {
e.preventDefault();
click_zan(id, type, 1, node);
}).addClass(isBootstrap5Page ? 'text-decoration-none' : '');
var down_node = $('<a href="#" class="uoj-click-zan-down">'+down_icon_html+uojLocale('click-zan::bad')+'</a>').click(function(e) {
var down_node = $('<a href="#" class="uoj-click-zan-down">'+down_icon_html+(show_text ? uojLocale('click-zan::bad') : '')+'</a>').click(function(e) {
e.preventDefault();
click_zan(id, type, -1, node);
}).addClass(isBootstrap5Page ? 'text-decoration-none' : '');