2025-2-26-fixed
This commit is contained in:
17
themes/next/layout/_third-party/comments/changyan.swig
vendored
Normal file
17
themes/next/layout/_third-party/comments/changyan.swig
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{%- if is_home() %}
|
||||
<script id="cy_cmt_num" src="https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId={{ theme.changyan.appid }}"></script>
|
||||
{% 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})});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script src="https://assets.changyan.sohu.com/upload/plugins/plugins.count.js"></script>
|
||||
{%- endif %}
|
||||
37
themes/next/layout/_third-party/comments/disqus.swig
vendored
Normal file
37
themes/next/layout/_third-party/comments/disqus.swig
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
{%- if theme.disqus.count %}
|
||||
<script>
|
||||
function loadCount() {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://{{ theme.disqus.shortname }}.disqus.com/count.js';
|
||||
s.id = 'dsq-count-scr';
|
||||
(d.head || d.body).appendChild(s);
|
||||
}
|
||||
// defer loading until the whole page loading is completed
|
||||
window.addEventListener('load', loadCount, false);
|
||||
</script>
|
||||
{%- endif %}
|
||||
{%- if page.comments %}
|
||||
<script>
|
||||
var disqus_config = function() {
|
||||
this.page.url = {{ page.permalink | json }};
|
||||
this.page.identifier = {{ page.path | json }};
|
||||
this.page.title = {{ page.title | json }};
|
||||
{% if __('disqus') !== 'disqus' -%}
|
||||
this.language = '{{ __('disqus') }}';
|
||||
{% endif -%}
|
||||
};
|
||||
NexT.utils.loadComments(document.querySelector('#disqus_thread'), () => {
|
||||
if (window.DISQUS) {
|
||||
DISQUS.reset({
|
||||
reload: true,
|
||||
config: disqus_config
|
||||
});
|
||||
} else {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://{{ theme.disqus.shortname }}.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', '' + +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{%- endif %}
|
||||
21
themes/next/layout/_third-party/comments/disqusjs.swig
vendored
Normal file
21
themes/next/layout/_third-party/comments/disqusjs.swig
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{%- if page.comments %}
|
||||
{%- set disqusjs_css_uri = theme.vendors.disqusjs_css or '//cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css' %}
|
||||
<link rel="stylesheet" href="{{ disqusjs_css_uri }}">
|
||||
|
||||
{%- set disqusjs_js_uri = theme.vendors.disqusjs_js or '//cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js' %}
|
||||
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#disqus_thread'), () => {
|
||||
NexT.utils.getScript('{{ disqusjs_js_uri }}', () => {
|
||||
window.dsqjs = new DisqusJS({
|
||||
api : '{{ theme.disqusjs.api }}' || 'https://disqus.com/api/',
|
||||
apikey : '{{ theme.disqusjs.apikey }}',
|
||||
shortname : '{{ theme.disqusjs.shortname }}',
|
||||
url : {{ page.permalink | json }},
|
||||
identifier: {{ page.path | json }},
|
||||
title : {{ page.title | json }},
|
||||
});
|
||||
}, window.DisqusJS);
|
||||
});
|
||||
</script>
|
||||
{%- endif %}
|
||||
28
themes/next/layout/_third-party/comments/gitalk.swig
vendored
Normal file
28
themes/next/layout/_third-party/comments/gitalk.swig
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
{%- if page.comments %}
|
||||
{%- set gitalk_css_uri = theme.vendors.gitalk_css or '//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.css' %}
|
||||
<link rel="stylesheet" href="{{ gitalk_css_uri }}">
|
||||
|
||||
{%- set gitalk_js_uri = theme.vendors.gitalk_js or '//cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js' %}
|
||||
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#gitalk-container'), () => {
|
||||
NexT.utils.getScript('{{ gitalk_js_uri }}', () => {
|
||||
var gitalk = new Gitalk({
|
||||
clientID : '{{ theme.gitalk.client_id }}',
|
||||
clientSecret: '{{ theme.gitalk.client_secret }}',
|
||||
repo : '{{ theme.gitalk.repo }}',
|
||||
owner : '{{ theme.gitalk.github_id }}',
|
||||
admin : ['{{ theme.gitalk.admin_user }}'],
|
||||
id : '{{ gitalk_md5(page.path) }}',
|
||||
{%- if theme.gitalk.language == '' %}
|
||||
language: window.navigator.language || window.navigator.userLanguage,
|
||||
{% else %}
|
||||
language: '{{ theme.gitalk.language }}',
|
||||
{%- endif %}
|
||||
distractionFreeMode: {{ theme.gitalk.distraction_free_mode }}
|
||||
});
|
||||
gitalk.render('gitalk-container');
|
||||
}, window.Gitalk);
|
||||
});
|
||||
</script>
|
||||
{%- endif %}
|
||||
17
themes/next/layout/_third-party/comments/livere.swig
vendored
Normal file
17
themes/next/layout/_third-party/comments/livere.swig
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{%- if page.comments %}
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#lv-container'), () => {
|
||||
window.livereOptions = {
|
||||
refer: location.pathname.replace(CONFIG.root, '').replace('index.html', '')
|
||||
};
|
||||
(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>
|
||||
{%- endif %}
|
||||
29
themes/next/layout/_third-party/comments/valine.swig
vendored
Normal file
29
themes/next/layout/_third-party/comments/valine.swig
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{%- set valine_uri = theme.vendors.valine or '//unpkg.com/valine/dist/Valine.min.js' %}
|
||||
|
||||
<script>
|
||||
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
|
||||
NexT.utils.getScript('{{ valine_uri }}', () => {
|
||||
var GUEST = ['nick', 'mail', 'link'];
|
||||
var guest = '{{ theme.valine.guest_info }}';
|
||||
guest = guest.split(',').filter(item => {
|
||||
return GUEST.includes(item);
|
||||
});
|
||||
new Valine({
|
||||
el : '#valine-comments',
|
||||
verify : {{ theme.valine.verify }},
|
||||
notify : {{ theme.valine.notify }},
|
||||
appId : '{{ theme.valine.appid }}',
|
||||
appKey : '{{ theme.valine.appkey }}',
|
||||
placeholder: {{ theme.valine.placeholder | json }},
|
||||
avatar : '{{ theme.valine.avatar }}',
|
||||
meta : guest,
|
||||
pageSize : '{{ theme.valine.pageSize }}' || 10,
|
||||
visitor : {{ theme.valine.visitor }},
|
||||
lang : '{{ theme.valine.language }}' || 'zh-cn',
|
||||
path : location.pathname,
|
||||
recordIP : {{ theme.valine.recordIP }},
|
||||
serverURLs : '{{ theme.valine.serverURLs }}'
|
||||
});
|
||||
}, window.Valine);
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user