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

Format code with prettier and standardjs #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 107 additions & 100 deletions _includes/comments.html
Original file line number Diff line number Diff line change
@@ -1,107 +1,114 @@
{% if page.comments != false %}
{% if page.comments != false %} {% if site.comments_provider != 'disqus' and
site.lazy_load_disqus and site.disqus and site.disqus.username %}
<a href="#" class="show_disqus_comment" onclick="return false;"
>Show Disqus Comments</a
>
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "{{ site.url }}{{ page.url }}";
this.page.identifier = "{{ page.url }}";
this.page.title = "{{ page.title }}";
};
var disqus_loaded = false;
$(function () {
$(".show_disqus_comment").on("click", function () {
// DON'T EDIT BELOW THIS LINE
$(this).html("加载中...");
var that = this;
if (!disqus_loaded) {
var d = document,
s = d.createElement("script");

{% if site.comments_provider != 'disqus' and site.lazy_load_disqus and site.disqus and site.disqus.username %}
<a href="#" class="show_disqus_comment" onclick="return false;">Show Disqus Comments</a>
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '{{ site.url }}{{ page.url }}';
this.page.identifier = '{{ page.url }}';
this.page.title = '{{ page.title }}';
};
var disqus_loaded = false;
$(function() {
$('.show_disqus_comment').on('click', function() { // DON'T EDIT BELOW THIS LINE
$(this).html('加载中...');
var that = this;
if (!disqus_loaded) {
var d = document, s = d.createElement('script');
s.type = "text/javascript";
s.async = true;
var shortname = "{{ site.disqus.username }}";

s.type = 'text/javascript';
s.async = true;
var shortname = '{{ site.disqus.username }}';
s.src = "//" + shortname + ".disqus.com/embed.js";

s.src = '//' + shortname + '.disqus.com/embed.js';
s.setAttribute("data-timestamp", +new Date());
(d.head || d.body).appendChild(s);

s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
disqus_loaded = true;
}
$(that).remove();
});
});
</script>
<noscript
>Please enable JavaScript to view the
<a href="https://disqus.com/?ref_noscript" rel="nofollow"
>comments powered by Disqus.</a
></noscript
>
{% endif %} {% case site.comments_provider %} {% when 'disqus' %} {% if
site.disqus and site.disqus.username %} {% assign load_disqus = true %}
<!-- Disqus Protection, see https://github.com/mzlogin/mzlogin.github.io/issues/2 -->
{% if site.disqus.username == 'mzlogin' %} {% assign load_disqus = false %} {%
if site.url contains 'mazhuang.org' %} {% assign load_disqus = true %} {% endif
%} {% endif %} {% if load_disqus %}
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "{{ site.url }}{{ page.url }}";
this.page.identifier = "{{ page.url }}";
this.page.title = "{{ page.title }}";
};
(function () {
// DON'T EDIT BELOW THIS LINE
var d = document,
s = d.createElement("script");

disqus_loaded = true;
}
$(that).remove();
})
})
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
{% endif %}
s.type = "text/javascript";
s.async = true;
var shortname = "{{ site.disqus.username }}";

{% case site.comments_provider %}
{% when 'disqus' %}
{% if site.disqus and site.disqus.username %}
{% assign load_disqus = true %}
<!-- Disqus Protection, see https://github.com/mzlogin/mzlogin.github.io/issues/2 -->
{% if site.disqus.username == 'mzlogin' %}
{% assign load_disqus = false %}
{% if site.url contains 'mazhuang.org' %}
{% assign load_disqus = true %}
{% endif %}
{% endif %}
{% if load_disqus %}
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = '{{ site.url }}{{ page.url }}';
this.page.identifier = '{{ page.url }}';
this.page.title = '{{ page.title }}';
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = "//" + shortname + ".disqus.com/embed.js";

s.type = 'text/javascript';
s.async = true;
var shortname = '{{ site.disqus.username }}';

s.src = '//' + shortname + '.disqus.com/embed.js';

s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
{% endif %}
{% endif %}
{% when 'gitment' %}
<div id="container"></div>
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
var gitment = new Gitment({
id: '{{ page.url | truncate: 50, '' }}',
owner: '{{ site.gitment.owner }}',
repo: '{{ site.gitment.repo }}',
oauth: {
client_id: '{{ site.gitment.oauth.client_id }}',
client_secret: '{{ site.gitment.oauth.client_secret }}',
},
})
gitment.render('container')
</script>
{% when 'gitalk' %}
<div id="gitalk-container"></div>
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
<script>
var gitalk = new Gitalk({
id: '{{ page.url | truncate: 50, '' }}',
clientID: '{{ site.gitalk.clientID }}',
clientSecret: '{{ site.gitalk.clientSecret }}',
repo: '{{ site.gitalk.repo }}',
owner: '{{ site.gitalk.owner }}',
admin: ['{{ site.gitalk.owner }}'],
labels: ['gitment'],
perPage: 50,
})
gitalk.render('gitalk-container')
</script>
{% endcase %}
{% endif %}
s.setAttribute("data-timestamp", +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript
>Please enable JavaScript to view the
<a href="https://disqus.com/?ref_noscript" rel="nofollow"
>comments powered by Disqus.</a
></noscript
>
{% endif %} {% endif %} {% when 'gitment' %}
<div id="container"></div>
<link
rel="stylesheet"
href="https://imsun.github.io/gitment/style/default.css"
/>
<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
var gitment = new Gitment({
id: '{{ page.url | truncate: 50, '' }}',
owner: '{{ site.gitment.owner }}',
repo: '{{ site.gitment.repo }}',
oauth: {
client_id: '{{ site.gitment.oauth.client_id }}',
client_secret: '{{ site.gitment.oauth.client_secret }}',
},
})
gitment.render('container')
</script>
{% when 'gitalk' %}
<div id="gitalk-container"></div>
<link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css" />
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
<script>
var gitalk = new Gitalk({
id: '{{ page.url | truncate: 50, '' }}',
clientID: '{{ site.gitalk.clientID }}',
clientSecret: '{{ site.gitalk.clientSecret }}',
repo: '{{ site.gitalk.repo }}',
owner: '{{ site.gitalk.owner }}',
admin: ['{{ site.gitalk.owner }}'],
labels: ['gitment'],
perPage: 50,
})
gitalk.render('gitalk-container')
</script>
{% endcase %} {% endif %}
Loading