Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: busuanzi counter display bug #1233

Closed
wants to merge 1 commit into from

Conversation

nature1995
Copy link

@nature1995 nature1995 commented Oct 22, 2019

Do not show count in homepage when access it at the first time.

PR Checklist

  • The commit message follows our guidelines.
  • Tests for the changes was maked (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs in NexT website have been added / updated (for features).

PR Type

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Build related changes.
  • CI related changes.
  • Documentation content changes.
  • Other... Please describe:

What is the current behavior?

The busuanzi counter can display properly.

Issue resolved: Yes

What is the new behavior?

  • Screenshots with this changes: N/A
  • Link to demo site with this changes: N/A

How to use?

In NexT _config.yml:

Does this PR introduce a breaking change?

  • Yes.
  • No.

Do not show count in homepage when access it at the first time.
@welcome
Copy link

welcome bot commented Oct 22, 2019

Thanks so much for opening your first PR here!

@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented Oct 22, 2019

Would you like to have a discussion with @Liam0205 ?
#1154
https://github.com/theme-next/hexo-theme-next/pull/1154/files

GitHub
PR Checklist Please check if your PR fulfills the following requirements:

The commit message follows our guidelines.
Tests for the changes was maked (for bug fixes / features).

Muse | Mist ha...

@CLAassistant
Copy link

CLAassistant commented Oct 22, 2019

CLA assistant check
All committers have signed the CLA.

@stevenjoezhang stevenjoezhang mentioned this pull request Oct 22, 2019
15 tasks
@nature1995
Copy link
Author

因为之前写的没check通过,我就从新pull了一下

@nature1995

This comment has been minimized.

@Liam0205
Copy link
Contributor

Liam0205 commented Oct 22, 2019

As mentioned in the original issue #1154 , setting display: none helps busuanzi hide itself when busuanzi asynchronous scripts are not executed, which prevents broken result.

This is not a bug, but a feature.

@nature1995
Copy link
Author

As mentioned in the original issue post, setting display: none helps busuanzi hide itself when busuanzi asynchronous scripts are not executed, which prevents broken result.

This is not a bug, but a feature.

I think it need to display at the first time to access, or you could add an option which can have a choice for the user.

@Liam0205
Copy link
Contributor

As mentioned in the original issue post, setting display: none helps busuanzi hide itself when busuanzi asynchronous scripts are not executed, which prevents broken result.
This is not a bug, but a feature.

I think it need to display at the first time to access, or you could add an option which can have a choice for the user.

I'm not quite understand.

As you could found in the documentation of busuanzi, setting display: none is a recommended practice. This prevents broken display when asynchronous scripts are not executed, and when these scripts are well executed, the display property of the container will be correctly set again, which results in correct display.

Again: this is not a bug, this is a feature.

@nature1995
Copy link
Author

As mentioned in the original issue post, setting display: none helps busuanzi hide itself when busuanzi asynchronous scripts are not executed, which prevents broken result.
This is not a bug, but a feature.

I think it need to display at the first time to access, or you could add an option which can have a choice for the user.

I'm not quite understand.

As you could found in the documentation of busuanzi, setting display: none is a recommended practice. This prevents broken display when asynchronous scripts are not executed, and when these scripts are well executed, the display property of the container will be correctly set again, which results in correct display.

Again: this is not a bug, this is a feature.

I just see the doc in busuanzi's site which show below.
4、在访问量数据未取回来之前,我不想让页面显示为诸如“本站总访问量 次”,显得太low,怎么办?
只需要如下css,不蒜子执行完毕会自动将标签显示出来,其他以此类推:

<span id="busuanzi_container_site_pv" style='display:none'>
    本站总访问量<span id="busuanzi_value_site_pv"></span>次
</span>

@Liam0205
Copy link
Contributor

As mentioned in the original issue post, setting display: none helps busuanzi hide itself when busuanzi asynchronous scripts are not executed, which prevents broken result.
This is not a bug, but a feature.

I think it need to display at the first time to access, or you could add an option which can have a choice for the user.

I'm not quite understand.
As you could found in the documentation of busuanzi, setting display: none is a recommended practice. This prevents broken display when asynchronous scripts are not executed, and when these scripts are well executed, the display property of the container will be correctly set again, which results in correct display.
Again: this is not a bug, this is a feature.

I just see the doc in busuanzi's site which show below.
4、在访问量数据未取回来之前,我不想让页面显示为诸如“本站总访问量 次”,显得太low,怎么办?
只需要如下css,不蒜子执行完毕会自动将标签显示出来,其他以此类推:

<span id="busuanzi_container_site_pv" style='display:none'>
    本站总访问量<span id="busuanzi_value_site_pv"></span>次
</span>

doesn't this sustain my point of view?

@nature1995
Copy link
Author

As mentioned in the original issue post, setting display: none helps busuanzi hide itself when busuanzi asynchronous scripts are not executed, which prevents broken result.
This is not a bug, but a feature.

I think it need to display at the first time to access, or you could add an option which can have a choice for the user.

I'm not quite understand.
As you could found in the documentation of busuanzi, setting display: none is a recommended practice. This prevents broken display when asynchronous scripts are not executed, and when these scripts are well executed, the display property of the container will be correctly set again, which results in correct display.
Again: this is not a bug, this is a feature.

I just see the doc in busuanzi's site which show below.
4、在访问量数据未取回来之前,我不想让页面显示为诸如“本站总访问量 次”,显得太low,怎么办?
只需要如下css,不蒜子执行完毕会自动将标签显示出来,其他以此类推:

<span id="busuanzi_container_site_pv" style='display:none'>
    本站总访问量<span id="busuanzi_value_site_pv"></span>次
</span>

doesn't this sustain my point of view?

But it can't display after loading in the first time.

@Liam0205
Copy link
Contributor

Nonsense! After execution, the display property of the container will be modified to display: inline automatically.

Things works fine on my blog and on my test site. If you insist, provide a complete path for reproducing the problem.

@nature1995
Copy link
Author

It still not display in the first time. It is diplayed after refresh the site.

image

@Liam0205
Copy link
Contributor

It still not display in the first time. It is diplayed after refresh the site.

image

As requested before, provide a complete path for reproducing the problem.

@pplmx
Copy link

pplmx commented Oct 31, 2019

I found that if you both enabled live2d and busuanzi, which causes that busuanzi style="display: none".
If you disabled live2d, busuanzi would work well.

@nature1995
Copy link
Author

I found that if you both enabled live2d and busuanzi, which causes that busuanzi style="display: none".
If you disabled live2d, busuanzi would work well.

I think you are right. It the same situation as me.

@stevenjoezhang
Copy link
Contributor

If you guys can solve the problem after disabling live2d, then it sounds like it's not a bug of busuanzi.

@Liam0205
Copy link
Contributor

Liam0205 commented Nov 1, 2019

That's why I asked for a complete path for reproducing the problem, since we have no idea about what you had done before you enabled busuanzi.

@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented Nov 22, 2019

I found that if you both enabled live2d and busuanzi, which causes that busuanzi style="display: none".
If you disabled live2d, busuanzi would work well.

I'm not sure which plugin you are using, but this has proven that this is not a bug in the theme NexT. Please ask the maintainer of the plugin for help.
I also have a live2d plugin that is compatible with busuanzi. If you are interested, you can check it out: https://github.com/stevenjoezhang/live2d-widget

GitHub
把萌萌哒的看板娘抱回家 | Live2D widget for web platform. Contribute to stevenjoezhang/live2d-widget development by creating an account on GitHub.

@stevenjoezhang
Copy link
Contributor

stevenjoezhang commented Feb 13, 2020

正常情况下, busuanzi 会向 head 中 append 的一个 script 标签名为 scriptTag,用于加载数据;数据加载完成后,通过 scriptTag.parentElement.removeChild(scriptTag) 移除之;在启用 hexo-helper-live2d 时,scriptTag.parentElement 为 null (原因未知),导致 try catch 语句执行,通过 bszTag.hides() 将页面上的所有统计数据隐藏。我个人没有兴趣继续研究此问题,目前只能建议不要同时使用 busuanzi 和 hexo-helper-live2d。考虑到此问题与 NexT 主题本身无关,请联系这两个项目的维护者讨论和解决。

@ouuan
Copy link

ouuan commented Aug 5, 2022

关于 busuanzi 和 live2d 共同使用的问题,我找到了根本原因,写了篇博客: https://ouuan.moe/post/2022/08/busuanzi-and-live2d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants