From 8579e31c19f6a85f8e1d3fd94c7f36e0b60df36a Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Tue, 11 Oct 2022 21:58:37 +0800 Subject: [PATCH] feat(web): use filled icon when has cnt in click_zan_block --- web/js/uoj.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/web/js/uoj.js b/web/js/uoj.js index af3a4a2..16e622b 100644 --- a/web/js/uoj.js +++ b/web/js/uoj.js @@ -285,12 +285,22 @@ $.fn.click_zan_block = function() { if (isNaN(cnt)) { return; } + + var up_icon_html = isBootstrap5Page + ? '' + : ''; + var down_icon_html = isBootstrap5Page + ? '' + : ''; + if (val == 1) { $(this).addClass('uoj-click-zan-block-cur-up'); + up_icon_html = ''; } else if (val == 0) { $(this).addClass('uoj-click-zan-block-cur-zero'); } else if (val == -1) { $(this).addClass('uoj-click-zan-block-cur-down'); + down_icon_html = ''; } else { return; } @@ -301,13 +311,6 @@ $.fn.click_zan_block = function() { } else { $(this).addClass('uoj-click-zan-block-negative'); } - - var up_icon_html = isBootstrap5Page - ? '' - : ''; - var down_icon_html = isBootstrap5Page - ? '' - : ''; var node = this; var up_node = $(''+up_icon_html+(show_text ? uojLocale('click-zan::good') : '')+'').click(function(e) {