mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 09:38:42 +00:00
feat: hide exact value of negative zan values
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
9ad23faefc
commit
5394bbb2f7
@ -44,7 +44,7 @@ class ClickZans {
|
|||||||
|
|
||||||
public static function click($id, $type, $user, $delta) {
|
public static function click($id, $type, $user, $delta) {
|
||||||
if (!DB::$in_transaction) {
|
if (!DB::$in_transaction) {
|
||||||
return DB::transaction(fn() => ClickZans::click($id, $type, $user, $delta));
|
return DB::transaction(fn () => ClickZans::click($id, $type, $user, $delta));
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_name = ClickZans::getTable($type);
|
$table_name = ClickZans::getTable($type);
|
||||||
@ -104,7 +104,7 @@ class ClickZans {
|
|||||||
if ($val === null) {
|
if ($val === null) {
|
||||||
$val = ClickZans::query($id, $type, Auth::user());
|
$val = ClickZans::query($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 . '"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCntBlock($cnt) {
|
public static function getCntBlock($cnt) {
|
||||||
@ -116,6 +116,11 @@ class ClickZans {
|
|||||||
} else {
|
} else {
|
||||||
$cls .= 'neutral';
|
$cls .= 'neutral';
|
||||||
}
|
}
|
||||||
return '<span class="'.$cls.'"><span class="uoj-click-zan-cnt">[<strong>' . ($cnt > 0 ? '+' . $cnt : $cnt) . '</strong>]</span></span>';
|
|
||||||
|
$display_cnt = $cnt > 0 ? '+' . $cnt : $cnt;
|
||||||
|
|
||||||
|
if ($cnt < 0) $display_cnt = '-';
|
||||||
|
|
||||||
|
return '<span class="' . $cls . '"><span class="uoj-click-zan-cnt">[<strong>' . $display_cnt . '</strong>]</span></span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,10 +327,14 @@ $.fn.click_zan_block = function() {
|
|||||||
click_zan(id, type, -1, node);
|
click_zan(id, type, -1, node);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var display_cnt = cnt > 0 ? '+' + cnt : cnt;
|
||||||
|
|
||||||
|
if (cnt < 0) display_cnt = '-';
|
||||||
|
|
||||||
$(this)
|
$(this)
|
||||||
.append(up_node)
|
.append(up_node)
|
||||||
.append(down_node)
|
.append(down_node)
|
||||||
.append($('<span class="uoj-click-zan-cnt">[<strong>' + (cnt > 0 ? '+' + cnt : cnt) + '</strong>]</span>'));
|
.append($('<span class="uoj-click-zan-cnt">[<strong>' + display_cnt + '</strong>]</span>'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user