feat: hide exact value of negative zan values
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-02-24 15:05:53 +08:00
parent 9ad23faefc
commit 5394bbb2f7
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 22 additions and 13 deletions

View File

@ -116,6 +116,11 @@ class ClickZans {
} else {
$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>';
}
}

View File

@ -327,10 +327,14 @@ $.fn.click_zan_block = function() {
click_zan(id, type, -1, node);
});
var display_cnt = cnt > 0 ? '+' + cnt : cnt;
if (cnt < 0) display_cnt = '-';
$(this)
.append(up_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>'));
});
}