🔧 Merge branch 'feature-artalk' into v0.2.13-RC (#54)

This commit is contained in:
Cell
2022-01-30 22:49:03 +08:00
16 changed files with 110 additions and 17 deletions
+2
View File
@@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
<!-- Releases see https://github.com/Lruihao/FixIt/releases -->
## v0.2.13
- :tada: Feat: add Artalk comment support ([#54](https://github.com/Lruihao/FixIt/issues/54))
- :sparkles: Feat: update watermark 1.0.3-RC (fontFamily support)
- **Full Changelog:** [`v0.2.12...v0.2.13`](https://github.com/Lruihao/FixIt/compare/v0.2.12...v0.2.13)
+2
View File
@@ -135,6 +135,7 @@ the FixIt theme may be more suitable for you.
* **Telegram comments** system supported by [Telegram Comments](https://comments.app/)
* **Commento** comment system supported by [Commento](https://commento.io/)
* **Utterances** comment system supported by [Utterances](https://utteranc.es/)
* **Artalk** comment system supported by [Artalk](https://artalk.js.org/)
### Extended Features
@@ -223,6 +224,7 @@ Thanks to the authors of following resources included in the theme:
* [cookieconsent](https://github.com/osano/cookieconsent)
* [Watermark](https://github.com/Lruihao/watermark)
* [pangu.js](https://github.com/vinta/pangu.js)
* [Artalk](https://artalk.js.org/)
## Author
+2
View File
@@ -134,6 +134,7 @@ sh fixit_checker.sh
* 支持 **[Telegram comments](https://comments.app/) 评论**系统
* 支持 **[Commento](https://commento.io/)** 评论系统
* 支持 **[Utterances](https://utteranc.es/)** 评论系统
* 支持 **[Artalk](https://artalk.js.org/)** 评论系统
### 扩展功能
@@ -220,6 +221,7 @@ FixIt 主题中用到了以下项目,感谢它们的作者:
* [cookieconsent](https://github.com/osano/cookieconsent)
* [Watermark](https://github.com/Lruihao/watermark)
* [pangu.js](https://github.com/vinta/pangu.js)
* [Artalk](https://artalk.js.org/)
## 作者
+3
View File
@@ -10,6 +10,9 @@ libFiles:
# aplayer@1.10.1 https://github.com/MoePlayer/APlayer
aplayerCSS: aplayer@1.10.1/dist/APlayer.min.css
aplayerJS: aplayer@1.10.1/dist/APlayer.min.js
# artalk@2.1.4 https://github.com/ArtalkJS/Artalk
artalkCSS: artalk@2.1.4/dist/Artalk.min.css
artalkJS: artalk@2.1.4/dist/Artalk.min.js
# autocomplete.js@0.38.1 https://github.com/algolia/autocomplete.js
autocompleteJS: autocomplete.js@0.38.1/dist/autocomplete.min.js
# clipboard.js@2.0.8 https://github.com/zenorocha/clipboard.js
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -1,6 +1,7 @@
algoliasearch@4.11.0 https://github.com/algolia/algoliasearch-client-javascript
animate.css@4.1.1 https://github.com/daneden/animate.css
aplayer@1.10.1 https://github.com/MoePlayer/APlayer
artalk@2.1.4 https://github.com/ArtalkJS/Artalk
autocomplete.js@0.38.1 https://github.com/algolia/autocomplete.js
clipboard.js@2.0.8 https://github.com/zenorocha/clipboard.js
cookieconsent@3.1.1 https://github.com/osano/cookieconsent
@@ -24,4 +25,4 @@ simple-icons@5.21.1 https://github.com/simple-icons/simple-icons
twemoji@13.1.0 https://github.com/twitter/twemoji
typeit@7.0.4 https://github.com/alexmacarthur/typeit
valine@1.4.16 https://github.com/xCss/Valine
watermark@1.0.3-RC https://github.com/Lruihao/watermark.git
watermark@1.0.3-RC https://github.com/Lruihao/watermark
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+14
View File
@@ -708,6 +708,20 @@ enableEmoji = true
# 评论系统设置
[params.page.comment]
enable = false
# Artalk comment config (https://artalk.js.org/) since v0.2.12
# Artalk 评论系统设置 (https://artalk.js.org/) since v0.2.12
[params.page.comment.artalk]
enable = false
pageKey = ""
pageTitle = ""
server = "https://yourdomain/api/"
site = "默认站点"
placeholder = ""
noComment = ""
sendBtn = ""
editorTravel = true
flatMode = 'auto'
maxNesting = 3
# Disqus comment config (https://disqus.com/)
# Disqus 评论系统设置 (https://disqus.com/)
[params.page.comment.disqus]
+4 -2
View File
@@ -58,7 +58,8 @@ math:
* :(far fa-comments fa-fw): **Facebook comments** system supported by [Facebook](https://developers.facebook.com/docs/plugins/comments/)
* :(fas fa-comment fa-fw): **Telegram comments** system supported by [Comments](https://comments.app/)
* :(fas fa-comment-dots fa-fw): **Commento** comment system supported by [Commento](https://commento.io/)
* :(fas fa-comment-alt fa-fw): **Utterances** comment system supported by [Utterances](https://utteranc.es/)
* :(far fa-comment-alt fa-fw): **Utterances** comment system supported by [Utterances](https://utteranc.es/)
* :(far fa-comment-alt fa-fw): **Artalk** comment system supported by [Artalk](https://artalk.js.org/)
#### Extended Features
@@ -120,4 +121,5 @@ Thanks to the authors of following resources included in the theme:
* [Valine](https://valine.js.org/)
* [cookieconsent](https://github.com/osano/cookieconsent)
* [Watermark](https://github.com/Lruihao/watermark)
* [pangu.js](https://github.com/vinta/pangu.js)
* [pangu.js](https://github.com/vinta/pangu.js)
* [Artalk](https://artalk.js.org/)
+2
View File
@@ -59,6 +59,7 @@ math:
* :(fas fa-comment fa-fw): 支持 **[Telegram comments](https://comments.app/) 评论**系统
* :(fas fa-comment-dots fa-fw): 支持 **[Commento](https://commento.io/)** 评论系统
* :(far fa-comment-alt fa-fw): 支持 **[Utterances](https://utteranc.es/)** 评论系统
* :(far fa-comment-alt fa-fw): 支持 **[Artalk](https://artalk.js.org/)** 评论系统
#### 扩展功能
@@ -121,3 +122,4 @@ FixIt 主题中用到了以下项目,感谢它们的作者:
* [cookieconsent](https://github.com/osano/cookieconsent)
* [Watermark](https://github.com/Lruihao/watermark)
* [pangu.js](https://github.com/vinta/pangu.js)
* [Artalk](https://artalk.js.org/)
@@ -497,9 +497,23 @@ Please open the code block below to view the complete sample configuration :(far
Skype = false
Trello = false
Mix = false
# {{< version 0.2.0 changed >}} Comment config
# {{< version 0.2.13 changed >}} Comment config
[params.page.comment]
enable = true
enable = false
# {{< version 0.2.13 >}}
# {{< link "https://artalk.js.org/" Artalk >}} comment config (https://artalk.js.org/)
[params.page.comment.artalk]
enable = false
pageKey = ""
pageTitle = ""
server = "https://yourdomain/api/"
site = "默认站点"
placeholder = ""
noComment = ""
sendBtn = ""
editorTravel = true
flatMode = 'auto'
maxNesting = 3
# {{< link "https://disqus.com/" Disqus >}} comment config (https://disqus.com)
[params.page.comment.disqus]
# {{< version 0.1.1 >}}
@@ -508,9 +508,23 @@ hugo
Skype = false
Trello = false
Mix = false
# {{< version 0.2.0 changed >}} 评论系统设置
# {{< version 0.2.13 changed >}} 评论系统设置
[params.page.comment]
enable = true
enable = false
# {{< version 0.2.13 >}}
# {{< link "https://artalk.js.org/" Artalk >}} 评论系统设置 (https://artalk.js.org/)
[params.page.comment.artalk]
enable = false
pageKey = ""
pageTitle = ""
server = "https://yourdomain/api/"
site = "默认站点"
placeholder = ""
noComment = ""
sendBtn = ""
editorTravel = true
flatMode = 'auto'
maxNesting = 3
# {{< link "https://disqus.com/" Disqus >}} 评论系统设置 (https://disqus.com)
[params.page.comment.disqus]
# {{< version 0.1.1 >}}
+21 -7
View File
@@ -5,6 +5,20 @@
{{- if $comment.enable -}}
<div id="comments">
{{- /* Artalk Comment System */ -}}
{{- $artalk := $comment.artalk | default dict -}}
{{- if $artalk.enable -}}
<div id="artalk" class="comment"></div>
{{- $source := $cdn.artalkCSS | default "lib/artalk/Artalk.min.css" -}}
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
{{- $source := $cdn.artalkJS | default "lib/artalk/Artalk.min.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $commentConfig = dict "el" "#artalk" "pageKey" $artalk.pageKey "pageTitle" $artalk.pageTitle "server" $artalk.server "site" $artalk.site "placeholder" $artalk.placeholder "noComment" $artalk.noComment "sendBtn" $artalk.sendBtn "editorTravel" $artalk.editorTravel "flatMode" $artalk.flatMode "maxNesting" $artalk.maxNesting | dict "artalk" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://github.com/ArtalkJS/Artalk" rel="license external nofollow noopener noreffer">Artalk</a>.
</noscript>
{{- end -}}
{{- /* Disqus Comment System */ -}}
{{- $disqus := $comment.disqus | default dict -}}
{{- if $disqus.enable -}}
@@ -12,7 +26,7 @@
{{- $source := printf "https://%v.disqus.com/embed.js" $disqus.shortname -}}
{{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript">Disqus</a>.
Please enable JavaScript to view the comments powered by <a href="https://disqus.com/?ref_noscript" rel="license external nofollow noopener noreffer">Disqus</a>.
</noscript>
{{- end -}}
@@ -26,7 +40,7 @@
{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
{{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk"></a>Gitalk</a>.
Please enable JavaScript to view the comments powered by <a href="https://github.com/gitalk/gitalk" rel="license external nofollow noopener noreffer">Gitalk</a>.
</noscript>
{{- end -}}
@@ -53,7 +67,7 @@
{{- end -}}
{{- $commentConfig = $valine.emoji | default "google.yml" | printf "data/emoji/%v" | resources.Get | transform.Unmarshal | dict "valine" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://valine.js.org/">Valine</a>.
Please enable JavaScript to view the comments powered by <a href="https://valine.js.org/" rel="license external nofollow noopener noreffer">Valine</a>.
</noscript>
{{- end -}}
@@ -70,7 +84,7 @@
{{- $source := printf "https://connect.facebook.net/%v/sdk.js#xfbml=1&version=v5.0&appId=%v&autoLogAppEvents=1" ($facebook.languageCode | default (T "facebookLanguageCode")) $facebook.appId -}}
{{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/"></a>Facebook</a>.
Please enable JavaScript to view the comments powered by <a href="https://developers.facebook.com/docs/plugins/comments/" rel="license external nofollow noopener noreffer">Facebook</a>.
</noscript>
{{- end -}}
@@ -97,7 +111,7 @@
{{- end -}}
{{- dict "Source" "https://comments.app/js/widget.js?2" "Defer" true "Attr" $attr | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
Please enable JavaScript to view the comments powered by <a href="https://comments.app/" rel="license external nofollow noopener noreffer">Telegram Comments</a>.
</noscript>
{{- end -}}
@@ -107,7 +121,7 @@
<div id="commento"></div>
{{- dict "Source" "https://cdn.commento.io/js/commento.js" "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://commento.io/">Commento</a>.
Please enable JavaScript to view the comments powered by <a href="https://commento.io/" rel="license external nofollow noopener noreffer">Commento</a>.
</noscript>
{{- end -}}
@@ -121,7 +135,7 @@
{{- $commentConfig = $utterances.lightTheme | default "github-light" | dict "lightTheme" | dict "utterances" | merge $commentConfig -}}
{{- $commentConfig = $utterances.darkTheme | default "github-dark" | dict "darkTheme" | dict "utterances" | merge $commentConfig -}}
<noscript>
Please enable JavaScript to view the comments powered by <a href="https://utteranc.es/">Utterances</a>.
Please enable JavaScript to view the comments powered by <a href="https://utteranc.es/" rel="license external nofollow noopener noreffer">Utterances</a>.
</noscript>
{{- end -}}
</div>
+10 -1
View File
@@ -593,12 +593,21 @@ class Theme {
initComment() {
if (this.config.comment) {
if (this.config.comment.artalk){
const artalk = new Artalk(this.config.comment.artalk);
artalk.setDarkMode(this.isDark);
this.switchThemeEventSet.add(() => {
artalk.setDarkMode(this.isDark);
})
}
if (this.config.comment.gitalk) {
this.config.comment.gitalk.body = decodeURI(window.location.href);
const gitalk = new Gitalk(this.config.comment.gitalk);
gitalk.render('gitalk');
}
if (this.config.comment.valine) new Valine(this.config.comment.valine);
if (this.config.comment.valine) {
new Valine(this.config.comment.valine);
}
if (this.config.comment.utterances) {
const utterancesConfig = this.config.comment.utterances;
const script = document.createElement('script');