|
2 | 2 | const {
|
3 | 3 | since: f_since,
|
4 | 4 | record: f_record,
|
5 |
| - site_deploy: f_site_deploy |
| 5 | + site_deploy: f_site_deploy, |
| 6 | + word_count: f_word_count |
6 | 7 | } = theme?.footer || {}
|
7 | 8 | const { author: bi_author } = theme?.base_info || {}
|
8 | 9 | const { author: hexo_author } = config
|
9 | 10 | const { site_uv: bsz_site_uv, site_pv: bsz_site_pv, enable: bsz_enable } = theme?.website_count?.busuanzi_count || {}
|
10 | 11 | const web_master = bi_author || hexo_author
|
| 12 | +
|
| 13 | +const show_pv = bsz_enable === true && bsz_site_pv === true |
| 14 | +const show_uv = bsz_enable === true && bsz_site_uv === true |
| 15 | +
|
| 16 | +let f_temp_total_word = 0 |
| 17 | +try { |
| 18 | + f_temp_total_word = totalcount(site) |
| 19 | +} catch { |
| 20 | + f_temp_total_word = 0 |
| 21 | +} |
| 22 | +const show_word_count = f_word_count === true && f_temp_total_word !== 0 |
| 23 | +
|
| 24 | +const has_count_info = show_pv || show_uv || show_word_count |
11 | 25 | %>
|
12 | 26 | <footer class="footer border-box">
|
13 | 27 | <div class="copyright-info info-item">
|
@@ -37,35 +51,30 @@ const web_master = bi_author || hexo_author
|
37 | 51 | </div>
|
38 | 52 | <% } %>
|
39 | 53 |
|
40 |
| - <div class="count-info info-item"> |
41 |
| - <% |
42 |
| - let f_temp_total_word; |
43 |
| - try { |
44 |
| - f_temp_total_word = totalcount(site); |
45 |
| - } catch (e) { |
46 |
| - f_temp_total_word = 0; |
47 |
| - } |
48 |
| - if (theme.footer?.word_count === true && f_temp_total_word !== 0) { %> |
49 |
| - <span class="count-item border-box word"> |
| 54 | + <% if (has_count_info) { %> |
| 55 | + <div class="count-info info-item"> |
| 56 | + <% if (show_word_count) { %> |
| 57 | + <span class="count-item border-box word"> |
50 | 58 | <span class="item-type border-box"><%- __('footer.total_words') %></span>
|
51 | 59 | <span class="item-value border-box word"><%= totalcount(site) %></span>
|
52 | 60 | </span>
|
53 |
| - <% } %> |
| 61 | + <% } %> |
54 | 62 |
|
55 |
| - <% if (bsz_enable === true && bsz_site_uv === true) { %> |
56 |
| - <span class="count-item border-box uv"> |
| 63 | + <% if (show_uv) { %> |
| 64 | + <span class="count-item border-box uv"> |
57 | 65 | <span class="item-type border-box"><%- __('footer.site_uv') %></span>
|
58 | 66 | <span class="item-value border-box uv" id="busuanzi_value_site_uv"></span>
|
59 | 67 | </span>
|
60 |
| - <% } %> |
| 68 | + <% } %> |
61 | 69 |
|
62 |
| - <% if (bsz_enable === true && bsz_site_pv === true) { %> |
63 |
| - <span class="count-item border-box pv"> |
| 70 | + <% if (show_pv) { %> |
| 71 | + <span class="count-item border-box pv"> |
64 | 72 | <span class="item-type border-box"><%- __('footer.site_pv') %></span>
|
65 | 73 | <span class="item-value border-box pv" id="busuanzi_value_site_pv"></span>
|
66 | 74 | </span>
|
67 |
| - <% } %> |
68 |
| - </div> |
| 75 | + <% } %> |
| 76 | + </div> |
| 77 | + <% } %> |
69 | 78 |
|
70 | 79 | <% if (f_record?.enable === true) { %>
|
71 | 80 | <div class="record-info info-item">
|
|
0 commit comments