Skip to content

Commit

Permalink
Add container for busuanzi counter widget (#1154)
Browse files Browse the repository at this point in the history
* [layout] _macro/post.swig: add container to busuanzi page_pv.

* [layout] _partials/analytics/busuanzi-counter.swig: add container to busuanzi site_pv & site_uv.

This will hide the `span` until `busuanzi`'s script is correctly loaded.
  • Loading branch information
Liam0205 authored and stevenjoezhang committed Sep 15, 2019
1 parent d418339 commit 4f757e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@
{%- endif %}

{%- if not is_index and theme.busuanzi_count.enable and theme.busuanzi_count.post_views %}
<span class="post-meta-item" title="{{ __('post.views') }}">
<span class="post-meta-item" title="{{ __('post.views') }}" id="busuanzi_container_page_pv" style="display: none;">
<span class="post-meta-item-icon">
<i class="fa fa-{{ theme.busuanzi_count.post_views_icon }}"></i>
</span>
<span class="post-meta-item-text">{{ __('post.views') + __('symbol.colon') }}</span>
<span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
<span id="busuanzi_value_page_pv"></span>
</span>
{%- endif %}

Expand Down
24 changes: 14 additions & 10 deletions layout/_partials/analytics/busuanzi-counter.swig
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
<script{{ pjax }} async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

{%- if theme.busuanzi_count.total_visitors %}
<span class="post-meta-item-icon">
<i class="fa fa-{{ theme.busuanzi_count.total_visitors_icon }}"></i>
</span>
<span class="site-uv" title="{{ __('footer.total_visitors') }}">
<span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
<span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
<span class="post-meta-item-icon">
<i class="fa fa-{{ theme.busuanzi_count.total_visitors_icon }}"></i>
</span>
<span class="site-uv" title="{{ __('footer.total_visitors') }}">
<span id="busuanzi_value_site_uv"></span>
</span>
</span>
{%- endif %}

Expand All @@ -16,11 +18,13 @@
{%- endif %}

{%- if theme.busuanzi_count.total_views %}
<span class="post-meta-item-icon">
<i class="fa fa-{{ theme.busuanzi_count.total_views_icon }}"></i>
</span>
<span class="site-pv" title="{{ __('footer.total_views') }}">
<span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
<span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
<span class="post-meta-item-icon">
<i class="fa fa-{{ theme.busuanzi_count.total_views_icon }}"></i>
</span>
<span class="site-pv" title="{{ __('footer.total_views') }}">
<span id="busuanzi_value_site_pv"></span>
</span>
</span>
{%- endif %}
</div>
Expand Down

0 comments on commit 4f757e4

Please sign in to comment.