Welcome to mirror list, hosted at ThFree Co, Russian Federation.

comment.html « partials « layouts - github.com/dillonzq/LoveIt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2a52864e85977f41ee66bf9e11358b4628585f27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
{{- $comment := .Scratch.Get "comment" | default dict -}}
{{- $commentConfig := dict -}}

{{- if $comment.enable -}}
    <div id="comments">
        {{- /* Disqus Comment System */ -}}
        {{- $disqus := $comment.disqus | default dict -}}
        {{- if $disqus.enable -}}
            <div id="disqus_thread" class="comment"></div>
            {{- $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>.
            </noscript>
        {{- end -}}

        {{- /* Gitalk Comment System */ -}}
        {{- $gitalk := $comment.gitalk | default dict -}}
        {{- if $gitalk.enable -}}
            <div id="gitalk" class="comment"></div>
            {{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}}
            {{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
            {{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}}
            {{- 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>.
            </noscript>
        {{- end -}}

        {{- /* Valine Comment System */ -}}
        {{- $valine := $comment.valine | default dict -}}
        {{- if $valine.enable -}}
            <div id="valine" class="comment"></div>
            {{- $options := dict "targetPath" "lib/valine/valine.min.css" -}}
            {{- dict "Source" "lib/valine/valine.scss" "ToCSS" $options | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}}
            {{- $source := $cdn.valineJS | default "lib/valine/Valine.min.js" -}}
            {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}}
            {{- $commentConfig = dict "el" "#valine" "appId" $valine.appId "appKey" $valine.appKey "lang" ($valine.lang | default (T "valineLang")) "visitor" $valine.visitor "recordIP" $valine.recordIP "placeholder" ($valine.placeholder | default (T "valinePlaceholder")) "highlight" (ne $valine.highlight false) "enableQQ" $valine.enableQQ | dict "valine" | merge $commentConfig -}}
            {{- with $valine.avatar -}}
                {{- $commentConfig = dict "avatar" . | dict "valine" | merge $commentConfig -}}
            {{- end -}}
            {{- with $valine.meta -}}
                {{- $commentConfig = dict "meta" . | dict "valine" | merge $commentConfig -}}
            {{- end -}}
            {{- with $valine.pageSize -}}
                {{- $commentConfig = dict "pageSize" . | dict "valine" | merge $commentConfig -}}
            {{- end -}}
            {{- with $valine.serverURLs -}}
                {{- $commentConfig = dict "serverURLs" . | dict "valine" | merge $commentConfig -}}
            {{- end -}}
            {{- $commentConfig = $valine.emoji | default "google.yml" | printf "lib/valine/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>.
            </noscript>
        {{- end -}}

        {{- /* Facebook Comment System */ -}}
        {{- $facebook := $comment.facebook | default dict -}}
        {{- if $facebook.enable -}}
            <div id="fb-root" class="comment"></div>
            <div
                class="fb-comments"
                data-href="{{ .Permalink }}"
                data-width="{{ $facebook.width }}"
                data-numposts="{{ $facebook.numPosts }}"
            ></div>
            {{- $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>.
            </noscript>
        {{- end -}}

        {{- /* Telegram Comments System */ -}}
        {{- $telegram := $comment.telegram | default dict -}}
        {{- if $telegram.enable -}}
            <div id="telegram-comments" class="comment">
                {{- $attr := printf `data-comments-app-website="%v"` $telegram.siteID -}}
                {{- $attr = printf `%v data-limit="%v"` $attr ($telegram.limit | default 5) -}}
                {{- with $telegram.height -}}
                    {{- $attr = printf `%v data-height="%v"` $attr . -}}
                {{- end -}}
                {{- with $telegram.color -}}
                    {{- $attr = printf `%v data-color="%v"` $attr . -}}
                {{- end -}}
                {{- if $telegram.colorful -}}
                    {{- $attr = printf `%v data-colorful="1"` $attr -}}
                {{- end -}}
                {{- if $telegram.dislikes -}}
                    {{- $attr = printf `%v data-dislikes="1"` $attr -}}
                {{- end -}}
                {{- if $telegram.outlined -}}
                    {{- $attr = printf `%v data-outlined="1"` $attr -}}
                {{- end -}}
                {{- dict "Source" "https://comments.app/js/widget.js?3" "Defer" true "Attr" $attr | partial "plugin/script.html" -}}
                <noscript>
                    Please enable JavaScript to view the comments powered by <a href="https://comments.app/">Telegram Comments</a>.
                </noscript>
            </div>
        {{- end -}}

        {{- /* Commento Comment System */ -}}
        {{- $commento := $comment.commento | default dict -}}
        {{- if $commento.enable -}}
            <div id="commento" class="comment"></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>.
            </noscript>
        {{- end -}}

        {{- /* utterances Comment System */ -}}
        {{- $utterances := $comment.utterances | default dict -}}
        {{- if $utterances.enable -}}
            <div id="utterances" class="comment"></div>
            {{- $commentConfig = dict "repo" $utterances.repo | dict "utterances" | merge $commentConfig -}}
            {{- $commentConfig = $utterances.issueTerm | default "pathname" | dict "issueTerm" | dict "utterances" | merge $commentConfig -}}
            {{- $commentConfig = dict "label" $utterances.label | dict "utterances" | merge $commentConfig -}}
            {{- $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>.
            </noscript>
        {{- end -}}

        {{- /* giscus Comment System */ -}}
        {{- $giscus := $comment.giscus | default dict -}}
        {{- if $giscus.enable -}}
            <div id="giscus" class="comment"></div>
            {{- $commentConfig = dict "repo" $giscus.repo | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = dict "repoId" $giscus.repoId | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = dict "category" $giscus.category | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = dict "categoryId" $giscus.categoryId | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = $giscus.lang | default (T "valineLang") | dict "lang" | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = $giscus.mapping | default "pathname" | dict "mapping" | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = $giscus.reactionsEnabled | default "1" | dict "reactionsEnabled" | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = $giscus.emitMetadata | default "0" | dict "emitMetadata" | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = $giscus.inputPosition | default "bottom" | dict "inputPosition" | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = $giscus.lazyLoading | default false | dict "lazyLoading" | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = $giscus.lightTheme | default "github-light" | dict "lightTheme" | dict "giscus" | merge $commentConfig -}}
            {{- $commentConfig = $giscus.darkTheme | default "github-dark" | dict "darkTheme" | dict "giscus" | merge $commentConfig -}}
            <noscript>
                Please enable JavaScript to view the comments powered by <a href="https://giscus.app">Giscus</a>.
            </noscript>
        {{- end -}}
    </div>
{{- end -}}

{{- dict "comment" $commentConfig | dict "config" | merge (.Scratch.Get "this") | .Scratch.Set "this" -}}