💄 Come true the comments switch button working.

This commit is contained in:
凡梦星尘 2022-06-19 18:18:17 +08:00
parent d20198d956
commit 05ac33e27f
5 changed files with 28 additions and 7 deletions

View File

@ -1,5 +1,6 @@
@if $utterances_enable { @if $utterances_enable {
.utterances { .utterances {
max-width: unset; //max-width: unset;
min-height: 300px;
} }
} }

View File

@ -67,10 +67,6 @@
.first-comment { .first-comment {
color: $first_comment_color; color: $first_comment_color;
@if $two_comments_actived==$first_comment_name {
font-weight: bold;
}
} }
.second-comment { .second-comment {
@ -82,6 +78,7 @@
} }
$switch_btn_bg_color: $first_comment_color; $switch_btn_bg_color: $first_comment_color;
$switch_btn_move_bc: $second_comment_color;
.switch-btn { .switch-btn {
position: relative; position: relative;
@ -100,6 +97,7 @@
@if $two_comments_actived==$second_comment_name { @if $two_comments_actived==$second_comment_name {
$switch_btn_bg_color: $second_comment_color; $switch_btn_bg_color: $second_comment_color;
$switch_btn_move_bc: $first_comment_color;
} }
background-color: $switch_btn_bg_color; background-color: $switch_btn_bg_color;
@ -120,6 +118,10 @@
transition: .4s transition: .4s
} }
&.move {
background-color: $switch_btn_move_bc;
}
&.move:before { &.move:before {
-webkit-transform: translateX(20px); -webkit-transform: translateX(20px);
-moz-transform: translateX(20px); -moz-transform: translateX(20px);
@ -129,6 +131,7 @@
} }
} }
} }
} }
} }

View File

@ -50,6 +50,7 @@ NexT.boot.refresh = function() {
NexT.utils.registerLangSelect();*/ NexT.utils.registerLangSelect();*/
NexT.utils.registerSidebarTOC(); NexT.utils.registerSidebarTOC();
NexT.utils.registerPostReward(); NexT.utils.registerPostReward();
NexT.utils.registerCommonSwitch();
NexT.utils.wrapTableWithBox(); NexT.utils.wrapTableWithBox();
NexT.utils.registerVideoIframe(); NexT.utils.registerVideoIframe();
}; };

View File

@ -243,6 +243,20 @@ NexT.utils = {
}); });
}, },
registerCommonSwitch: function() {
const button = document.querySelector('.comment-switch .switch-btn');
if (!button) return;
const cwrap = document.querySelector('.comment-wrap');
button.addEventListener('click', () => {
button.classList.toggle('move');
const comms = document.querySelectorAll('.comment-wrap > div');
let len = comms.length;
while(len--){
cwrap.appendChild(comms[len]);
}
});
},
activateNavByIndex: function(index) { activateNavByIndex: function(index) {
const target = document.querySelectorAll('.post-toc li a.nav-link')[index]; const target = document.querySelectorAll('.post-toc li a.nav-link')[index];
if (!target || target.classList.contains('active-current')) return; if (!target || target.classList.contains('active-current')) return;

View File

@ -1,5 +1,6 @@
{{- with .Site.Params.utterances }} {{- with .Site.Params.utterances }}
<script src="https://utterances.njilc.com/client.js" {{- if .enable }}
<script src="//utterances.njilc.com/client.js"
repo="{{ .repo }}" repo="{{ .repo }}"
issue-term="{{ .issueTerm }}" issue-term="{{ .issueTerm }}"
label="{{ .label }}" label="{{ .label }}"
@ -7,3 +8,4 @@ crossorigin="anonymous"
theme="{{ .theme }}" async> theme="{{ .theme }}" async>
</script> </script>
{{- end }} {{- end }}
{{- end }}