forked from kaeyleo/jekyll-theme-H2O
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix] Refactor _includes and _layouts
- Loading branch information
Showing
47 changed files
with
599 additions
and
740 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<script src="https://cdn.jsdelivr.net/npm/dayjs@1.11.2/dayjs.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/dayjs@1.11.2/plugin/customParseFormat.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/dayjs@1.11.2/plugin/relativeTime.js"></script> | ||
<script> | ||
$(document).ready(function () { | ||
var time_formats = ['YYYY-MM-DD HH:mm:ss ZZ', 'YYYY DD MMM HH:mm:ss ZZ', 'YYYY年MM月DD日 HH:mm:ss ZZ']; | ||
function dateFormat(date, format) { | ||
var date_org = dayjs(date, time_formats[format]); | ||
var date = date_org.format(time_formats[format]); | ||
return { "date_org": date_org, "date": date } | ||
} | ||
|
||
dayjs.extend(window.dayjs_plugin_customParseFormat); | ||
dayjs.extend(window.dayjs_plugin_relativeTime); | ||
var post_date = $("meta[property='post-date']").attr('content'); | ||
var post_date_format = $("meta[property='post-date-format']").attr('content'); | ||
var local_post_date = dateFormat(post_date, post_date_format); | ||
|
||
$(".post time span.create-at").html(local_post_date["date"]); | ||
|
||
fetch("https://api.github.com/repos/{{ site.github.owner }}/{{ site.github.repository }}/commits?path={{ page.path }}").then((response) => { | ||
return response.json(); | ||
}).then((commits) => { | ||
if (commits.length != 0) { | ||
var update_at = dayjs(commits[0]['commit']['committer']['date']); | ||
} else { | ||
var update_at = post_date | ||
} | ||
|
||
var local_update_at = dateFormat(update_at, post_date_format); | ||
$('.post time span.update-at').html(local_update_at["date"]); | ||
|
||
var relative_time = dayjs().diff(local_update_at["date_org"], 'day'); | ||
$(".post-copyright .tips span").append(relative_time); | ||
if (relative_time > 365) { | ||
$(".post-copyright .tips").addClass("active"); | ||
} | ||
}); | ||
}); | ||
</script> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% include plugins/analytics/google.html %} | ||
{% include plugins/analytics/umami.html %} | ||
{% include plugins/analytics/busuanzi.html %} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{% capture block %} | ||
<section class="post-footer-item comment"> | ||
<div class="comments-headline"> | ||
<svg class="icon" aria-hidden="true"> | ||
<use xlink:href="#icon-comment"></use> | ||
</svg> | ||
<span>{{ locales.post.comment }}</span> | ||
</div> | ||
{% if layout.type == "post" %} | ||
{% if site.comments.disqus and site.comments.waline %} | ||
<div id="comments-switch"> | ||
<span class="first-comment">Disqus</span> | ||
<span class="switch-button"> | ||
<input id="cmn-toggle-4" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"> | ||
<label for="cmn-toggle-4"></label> | ||
</span> | ||
<span class="second-comment">Waline</span> | ||
</div> | ||
{% endif %} | ||
{% else %} | ||
{% if page.comments.disqus and page.comments.waline %} | ||
<div id="comments-switch"> | ||
<span class="first-comment">Disqus</span> | ||
<span class="switch-button"> | ||
<input id="cmn-toggle-4" class="cmn-toggle cmn-toggle-round-flat" type="checkbox"> | ||
<label for="cmn-toggle-4"></label> | ||
</span> | ||
<span class="second-comment">Waline</span> | ||
</div> | ||
{% endif %} | ||
{% endif %} | ||
</section> | ||
{% endcapture %} | ||
|
||
{% if layout.type == "post" %} | ||
{% if site.comments.disqus or site.comments.waline or page.comments.waline or page.comments.disqus %} | ||
{{ block }} | ||
{% endif %} | ||
{% else %} | ||
{% if page.comments.disqus or page.comments.waline %} | ||
{{ block }} | ||
{% endif %} | ||
{% endif %} | ||
|
||
{% if layout.type == "post" %} | ||
{% if site.comments.disqus %} | ||
<section class="post-footer-item comment"> | ||
<div id="disqus_thread"></div> | ||
</section> | ||
{% endif %} | ||
{% if site.comments.waline %} | ||
<section class="post-footer-item comment"> | ||
<div id="waline"></div> | ||
</section> | ||
{% endif %} | ||
{% else %} | ||
{% if page.comments.disqus %} | ||
<section class="post-footer-item comment"> | ||
<div id="disqus_thread"></div> | ||
</section> | ||
{% endif %} | ||
{% if page.comments.waline %} | ||
<section class="post-footer-item comment"> | ||
<div id="waline"></div> | ||
</section> | ||
{% endif %} | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{% include plugins/comments/disqus.html %} | ||
{% include plugins/comments/waline_js.html %} | ||
<script> | ||
$(document).ready(function () { | ||
if ($("#comments-switch").length > 0) { | ||
var comment_status = $("#cmn-toggle-4")[0].checked; | ||
if (comment_status) { | ||
$("#waline").addClass("active"); | ||
} else { | ||
$("#disqus_thread").addClass("active"); | ||
} | ||
$("#cmn-toggle-4").click(function () { | ||
$("#disqus_thread").toggleClass("active"); | ||
$("#waline").toggleClass("active"); | ||
}) | ||
} else { | ||
if ($("#disqus_thread").length > 0) { | ||
$("#disqus_thread").addClass("active"); | ||
} else if ($("#waline").length > 0) { | ||
$("#waline").addClass("active"); | ||
} | ||
} | ||
}) | ||
</script> |
Oops, something went wrong.