diff options
author | zzossig <zzossig@gmail.com> | 2020-01-30 15:58:58 +0300 |
---|---|---|
committer | zzossig <zzossig@gmail.com> | 2020-01-30 15:58:58 +0300 |
commit | 5eb5991271fd5f5d7352a1b8903b214907490790 (patch) | |
tree | 30efef92fc34e366b921f6a81eb9f67674c621ce | |
parent | effa5418170780cf8d1537ff94be0432f334719a (diff) |
comment added
-rw-r--r-- | layouts/partials/comments/changyan.html | 11 | ||||
-rw-r--r-- | layouts/partials/comments/commento.html | 2 | ||||
-rw-r--r-- | layouts/partials/comments/comments.html | 21 | ||||
-rw-r--r-- | layouts/partials/comments/disqus.html | 18 | ||||
-rw-r--r-- | layouts/partials/comments/gitalk.html | 17 | ||||
-rw-r--r-- | layouts/partials/comments/gitment.html | 19 | ||||
-rw-r--r-- | layouts/partials/comments/isso.html | 6 | ||||
-rw-r--r-- | layouts/partials/comments/livere.html | 17 | ||||
-rw-r--r-- | layouts/partials/comments/utterances.html | 29 | ||||
-rw-r--r-- | layouts/partials/comments/valine.html | 22 |
10 files changed, 162 insertions, 0 deletions
diff --git a/layouts/partials/comments/changyan.html b/layouts/partials/comments/changyan.html new file mode 100644 index 0000000..ddb18d6 --- /dev/null +++ b/layouts/partials/comments/changyan.html @@ -0,0 +1,11 @@ +<div id="SOHUCS" sid="{{ .RelPermalink }}"></div> +<script> + (function () { + if (window.location.hostname === 'localhost') return; + + var appid = '{{ .Site.Params.changyan.changyanAppid }}'; + var conf = '{{ .Site.Params.changyan.changyanAppkey }}'; + var width = window.innerWidth || document.documentElement.clientWidth; + if (width < 960) { window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs = function (d, a) { var c = document.getElementsByTagName("head")[0] || document.head || document.documentElement; var b = document.createElement("script"); b.setAttribute("type", "text/javascript"); b.setAttribute("charset", "UTF-8"); b.setAttribute("src", d); if (typeof a === "function") { if (window.attachEvent) { b.onreadystatechange = function () { var e = b.readyState; if (e === "loaded" || e === "complete") { b.onreadystatechange = null; a() } } } else { b.onload = a } } c.appendChild(b) }; loadJs("https://changyan.sohu.com/upload/changyan.js", function () { window.changyan.api.config({ appid: appid, conf: conf }) }); } + })(); +</script>
\ No newline at end of file diff --git a/layouts/partials/comments/commento.html b/layouts/partials/comments/commento.html new file mode 100644 index 0000000..54e7589 --- /dev/null +++ b/layouts/partials/comments/commento.html @@ -0,0 +1,2 @@ +<div id="commento"></div> +<script defer src="https://cdn.commento.io/js/commento.js"></script> diff --git a/layouts/partials/comments/comments.html b/layouts/partials/comments/comments.html new file mode 100644 index 0000000..2c2b078 --- /dev/null +++ b/layouts/partials/comments/comments.html @@ -0,0 +1,21 @@ +{{ if $.Param "enableComment" }} + {{ if $.Param "disqus_shortname" }} + {{ partial "comments/disqus.html" . }} + {{ else if $.Param "commento" }} + {{ partial "comments/commento.html" . }} + {{ else if $.Param "valine.enable" }} + {{ partial "comments/valine.html" . }} + {{ else if $.Param "changyan.changyanAppid" }} + {{ partial "comments/changyan.html" . }} + {{ else if $.Param "livere.livereUID" }} + {{ partial "comments/livere.html" . }} + {{ else if $.Param "gitment.owner" }} + {{ partial "comments/gitment.html" . }} + {{ else if $.Param "gitalk.owner" }} + {{ partial "comments/gitalk.html" . }} + {{ else if $.Param "utterances.owner" }} + {{ partial "comments/utterances.html" . }} + {{ else if $.Param "isso.enable" }} + {{ partial "comments/isso.html" . }} + {{ end }} +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/comments/disqus.html b/layouts/partials/comments/disqus.html new file mode 100644 index 0000000..54e435a --- /dev/null +++ b/layouts/partials/comments/disqus.html @@ -0,0 +1,18 @@ +<div id="disqus_thread"></div> +<script> + let disqus_config = function () { + {{with .Params.disqus_identifier }}this.page.identifier = '{{ . }}';{{end}} + {{with .Params.disqus_title }}this.page.title = '{{ . }}';{{end}} + {{with .Params.disqus_url }}this.page.url = '{{ . | html }}';{{end}} + }; + (function () { + if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) { + document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.'; + return; + } + var d = document, s = d.createElement('script'); s.async = true; + s.src = 'https://' + '{{ .Site.Params.disqus_shortname }}' + '.disqus.com/embed.js'; + s.setAttribute('data-timestamp', +new Date()); + (d.head || d.body).appendChild(s); + }) (); +</script>
\ No newline at end of file diff --git a/layouts/partials/comments/gitalk.html b/layouts/partials/comments/gitalk.html new file mode 100644 index 0000000..cf44b54 --- /dev/null +++ b/layouts/partials/comments/gitalk.html @@ -0,0 +1,17 @@ +<div id="gitalk-container"></div> +<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css" crossorigin="anonymous"> +<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js" crossorigin="anonymous"></script> +<script> + var gitalk = new Gitalk({ + id: '{{ .Date }}', + title: '{{ .Title }}', + clientID: '{{ .Site.Params.gitalk.clientId }}', + clientSecret: '{{ .Site.Params.gitalk.clientSecret }}', + repo: '{{ .Site.Params.gitalk.repo }}', + owner: '{{ .Site.Params.gitalk.owner }}', + admin: ['{{ .Site.Params.gitalk.owner }}'], + body: decodeURI(location.href) + }); + gitalk.render('gitalk-container'); +</script> +<noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by gitalk.</a></noscript>
\ No newline at end of file diff --git a/layouts/partials/comments/gitment.html b/layouts/partials/comments/gitment.html new file mode 100644 index 0000000..6eabac2 --- /dev/null +++ b/layouts/partials/comments/gitment.html @@ -0,0 +1,19 @@ +<div id="comments-gitment"></div> +<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/default.min.css" crossorigin="anonymous"> +<script src="https://cdn.jsdelivr.net/gh/theme-next/theme-next-gitment@1/gitment.browser.min.js" crossorigin="anonymous"></script> +<script type="text/javascript"> + var gitment = new Gitment({ + id: '{{ .Date }}', + title: '{{ .Title }}', + link: decodeURI(location.href), + desc: '{{ .Summary }}', + owner: '{{ .Site.Params.gitment.owner }}', + repo: '{{ .Site.Params.gitment.repo }}', + oauth: { + client_id: '{{ .Site.Params.gitment.clientId }}', + client_secret: '{{ .Site.Params.gitment.clientSecret }}' + } + }); + gitment.render('comments-gitment'); +</script> +<noscript>Please enable JavaScript to view the <a href="https://github.com/imsun/gitment">comments powered by gitment.</a></noscript>
\ No newline at end of file diff --git a/layouts/partials/comments/isso.html b/layouts/partials/comments/isso.html new file mode 100644 index 0000000..61d8c3c --- /dev/null +++ b/layouts/partials/comments/isso.html @@ -0,0 +1,6 @@ +{{- $scriptSrc := .Site.Params.isso.scriptSrc -}} +{{- $dataAttrs := .Site.Params.isso.dataAttrs -}} + +<script src='{{ $scriptSrc }}' {{- with $dataAttrs }} {{ . | safeHTMLAttr }} {{- end -}} crossorigin="anonymous"></script> + +<section id='isso-thread'></section>
\ No newline at end of file diff --git a/layouts/partials/comments/livere.html b/layouts/partials/comments/livere.html new file mode 100644 index 0000000..e802720 --- /dev/null +++ b/layouts/partials/comments/livere.html @@ -0,0 +1,17 @@ +<div id="lv-container" data-id="city" data-uid="{{ .Site.Params.livere.livereUID }}"> + <script> + (function (d, s) { + var j, e = d.getElementsByTagName(s)[0]; + + if (typeof LivereTower === 'function') { return; } + + j = d.createElement(s); + j.src = 'https://cdn-city.livere.com/js/embed.dist.js'; + j.async = true; + + e.parentNode.insertBefore(j, e); + })(document, 'script'); + </script> + <noscript>Please enable JavaScript to view the comments powered by <a + href="https://livere.com/">LiveRe.</a></noscript> +</div>
\ No newline at end of file diff --git a/layouts/partials/comments/utterances.html b/layouts/partials/comments/utterances.html new file mode 100644 index 0000000..77bdebf --- /dev/null +++ b/layouts/partials/comments/utterances.html @@ -0,0 +1,29 @@ +<div id="utterances"></div> +<noscript>Please enable JavaScript to view the <a href="https://github.com/utterance">comments powered by utterances.</a></noscript> +<script> + document.addEventListener('DOMContentLoaded', function () { + try { + {{ $owner:= .Site.Params.utterances.owner }} + var owner = JSON.parse({{ $owner | jsonify }}); + {{ $repo:= .Site.Params.utterances.repo }} + var repo = JSON.parse({{ $repo | jsonify }}); + var localTheme = localStorage.getItem('theme'); + var utterTheme = localTheme === "dark" || localTheme === "hacker" ? 'photon-dark' : localTheme === 'kimbie' ? 'github-dark-orange' : 'github-light' + + var myScript = document.createElement('script'); + myScript.setAttribute('src', 'https://utteranc.es/client.js'); + myScript.setAttribute('repo', `${owner}/${repo}`); + myScript.setAttribute('issue-term', 'pathname'); + myScript.setAttribute('theme', utterTheme); + myScript.setAttribute('crossorigin', 'anonymous'); + myScript.setAttribute('async', ''); + + myScript.onload = function() { + } + + document.getElementById('utterances').appendChild(myScript); + } catch (err) { + console.log(err); + } + }); +</script> diff --git a/layouts/partials/comments/valine.html b/layouts/partials/comments/valine.html new file mode 100644 index 0000000..34db986 --- /dev/null +++ b/layouts/partials/comments/valine.html @@ -0,0 +1,22 @@ +{{- if .Site.Params.valine.visitor -}} + <span id="{{ .RelPermalink | relLangURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}"> + <span class="post-meta-item-text">文章阅读量 </span> + <span class="leancloud-visitors-count">0</span> + <p></p> + </span> +{{- end }} +<div id="vcomments"></div> +<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script> +<script src='//unpkg.com/valine/dist/Valine.min.js'></script> +<script> + new Valine({ + el: '#vcomments' , + appId: '{{ .Site.Params.valine.appId }}', + appKey: '{{ .Site.Params.valine.appKey }}', + notify: {{ .Site.Params.valine.notify }}, + verify: {{ .Site.Params.valine.verify }}, + avatar:'{{ .Site.Params.valine.avatar }}', + placeholder: '{{ .Site.Params.valine.placeholder }}', + visitor: {{ .Site.Params.valine.visitor }} + }); +</script>
\ No newline at end of file |