add .comment-box class, comment system use id; remove unused comments_script.html

This commit is contained in:
Reorx 2022-06-01 16:55:45 +08:00
parent 66447d9a38
commit 0aa7a35ee0
6 changed files with 8 additions and 17 deletions

View File

@ -539,8 +539,8 @@ h6:hover .anchor {
box-shadow: 0 2px 0 var(--twitter-color); box-shadow: 0 2px 0 var(--twitter-color);
} }
.disqus-container, /* comments */
.telegram-widget-container { .comments-box {
margin: calc(var(--content-gap) * 2) 0; margin: calc(var(--content-gap) * 2) 0;
background-color: var(--code-bg); background-color: var(--code-bg);
border-radius: 10px; border-radius: 10px;

View File

@ -1,5 +0,0 @@
{{- /* You can add your own layouts/comments_script.html to override this file */ -}}
{{- with site.Params.commentSystem.disqus -}}
{{ partial "disqus_script.html" . }}
{{- end -}}

View File

@ -1,4 +1,4 @@
<div class="disqus-container"> <div class="comments-box">
<div id="disqus_thread"></div> <div id="disqus_thread"></div>
</div> </div>

View File

@ -128,7 +128,3 @@
mediumZoom('.post-content img:not([no-zoom])'); mediumZoom('.post-content img:not([no-zoom])');
</script> </script>
{{- end }} {{- end }}
{{- if not (.Param "noComments") }}
{{- partial "comments_script.html" . }}
{{ end }}

View File

View File

@ -1,4 +1,6 @@
<div class="telegram-widget-container"></div> <div class="comments-box">
<div id="telegram-widget-container"></div>
</div>
<script> <script>
(function() { (function() {
@ -22,8 +24,9 @@
s.setAttribute(key, attrs[key]); s.setAttribute(key, attrs[key]);
} }
const container = document.querySelector('.telegram-widget-container') const container = document.querySelector('#telegram-widget-container')
container.innerHTML = ''; container.innerHTML = '';
// telegram widget script must be added to the position where you want it to be displayed
container.appendChild(s); container.appendChild(s);
})(); })();
</script> </script>
@ -33,9 +36,6 @@
if (!toggleThemeCallbacks) { if (!toggleThemeCallbacks) {
return; return;
} }
if (document.getElementsByClassName('telegram-widget-container').length === 0) {
return;
}
toggleThemeCallbacks.push((isDark) => { toggleThemeCallbacks.push((isDark) => {
// console.log('window toggle-theme for telegram widget') // console.log('window toggle-theme for telegram widget')