Update changyan comments

This commit is contained in:
Mimi 2020-07-22 23:19:40 +08:00
parent 924318a19d
commit bfa9a75440
2 changed files with 8 additions and 10 deletions

View File

@ -3,14 +3,12 @@
{% elif page.comments %}
<script>
NexT.utils.loadComments(document.querySelector('#SOHUCS'), () => {
var appid = '{{ theme.changyan.appid }}';
var conf = '{{ theme.changyan.appkey }}';
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})});
}
NexT.utils.getScript('https://changyan.sohu.com/upload/changyan.js', () => {
window.changyan.api.config({
appid: '{{ theme.changyan.appid }}',
conf : '{{ theme.changyan.appkey }}'
});
});
});
</script>
<script src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>

View File

@ -187,12 +187,12 @@ NexT.utils = {
// Prevent selected tab to select again.
if (element.classList.contains('active')) return;
// Add & Remove active class on `nav-tabs` & `tab-content`.
element.parentNode.childNodes.forEach(target => {
[...element.parentNode.children].forEach(target => {
target.classList.toggle('active', target === element);
});
// https://stackoverflow.com/questions/20306204/using-queryselector-with-ids-that-are-numbers
const tActive = document.getElementById(element.querySelector('a').getAttribute('href').replace('#', ''));
tActive.parentNode.childNodes.forEach(target => {
[...tActive.parentNode.children].forEach(target => {
target.classList.toggle('active', target === tActive);
});
// Trigger event