diff options
| author | Reorx <novoreorx@gmail.com> | 2022-06-01 16:55:45 +0800 |
|---|---|---|
| committer | Reorx <novoreorx@gmail.com> | 2022-06-01 16:55:45 +0800 |
| commit | 0aa7a35ee0535a0ba5bdde7ed1a6c4fa12b3008d (patch) | |
| tree | eed2a48d020fc216f3bbcb9554a4397ae47de018 | |
| parent | 66447d9a38d354f80f5dda2cd37a2701bb62d9b1 (diff) | |
add .comment-box class, comment system use id; remove unused comments_script.html
| -rw-r--r-- | assets/css/common/post-single.css | 4 | ||||
| -rw-r--r-- | layouts/partials/comments_script.html | 5 | ||||
| -rw-r--r-- | layouts/partials/disqus.html | 2 | ||||
| -rw-r--r-- | layouts/partials/page_footer.html | 4 | ||||
| -rw-r--r-- | layouts/partials/static_comments.html | 0 | ||||
| -rw-r--r-- | layouts/partials/telegram_widget.html | 10 |
6 files changed, 8 insertions, 17 deletions
diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css index 2cf4035..b5fc3b3 100644 --- a/assets/css/common/post-single.css +++ b/assets/css/common/post-single.css @@ -539,8 +539,8 @@ h6:hover .anchor { box-shadow: 0 2px 0 var(--twitter-color); } -.disqus-container, -.telegram-widget-container { +/* comments */ +.comments-box { margin: calc(var(--content-gap) * 2) 0; background-color: var(--code-bg); border-radius: 10px; diff --git a/layouts/partials/comments_script.html b/layouts/partials/comments_script.html deleted file mode 100644 index 8663497..0000000 --- a/layouts/partials/comments_script.html +++ /dev/null @@ -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 -}} diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html index e6b9b33..d1e80f8 100644 --- a/layouts/partials/disqus.html +++ b/layouts/partials/disqus.html @@ -1,4 +1,4 @@ -<div class="disqus-container"> +<div class="comments-box"> <div id="disqus_thread"></div> </div> diff --git a/layouts/partials/page_footer.html b/layouts/partials/page_footer.html index 1ad0e41..3c55704 100644 --- a/layouts/partials/page_footer.html +++ b/layouts/partials/page_footer.html @@ -128,7 +128,3 @@ mediumZoom('.post-content img:not([no-zoom])'); </script> {{- end }} - -{{- if not (.Param "noComments") }} - {{- partial "comments_script.html" . }} -{{ end }} diff --git a/layouts/partials/static_comments.html b/layouts/partials/static_comments.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/partials/static_comments.html diff --git a/layouts/partials/telegram_widget.html b/layouts/partials/telegram_widget.html index 1f614c7..786f19a 100644 --- a/layouts/partials/telegram_widget.html +++ b/layouts/partials/telegram_widget.html @@ -1,4 +1,6 @@ -<div class="telegram-widget-container"></div> +<div class="comments-box"> + <div id="telegram-widget-container"></div> +</div> <script> (function() { @@ -22,8 +24,9 @@ s.setAttribute(key, attrs[key]); } - const container = document.querySelector('.telegram-widget-container') + const container = document.querySelector('#telegram-widget-container') container.innerHTML = ''; + // telegram widget script must be added to the position where you want it to be displayed container.appendChild(s); })(); </script> @@ -33,9 +36,6 @@ if (!toggleThemeCallbacks) { return; } - if (document.getElementsByClassName('telegram-widget-container').length === 0) { - return; - } toggleThemeCallbacks.push((isDark) => { // console.log('window toggle-theme for telegram widget') |
