Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #271 CDN URL for leancloud #541

Merged
merged 2 commits into from
Dec 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1023,11 +1023,17 @@ vendors:
# reading_progress: //cdn.jsdelivr.net/gh/theme-next/theme-next-reading-progress@1.1/reading_progress.min.js
reading_progress:

# valine comment
# Internal version: 3.11.1
# See: https://www.npmjs.com/package/leancloud-storage
# Example:
# leancloud: //cdn.jsdelivr.net/npm/leancloud-storage@3.11.1/dist/av-min.js
leancloud:

# Internal version: 1.3.4
# See: https://github.com/xCss/Valine
# Example:
# valine: //cdn.jsdelivr.net/npm/valine@1.3.3/dist/Valine.min.js
# valine: //cdnjs.cloudflare.com/ajax/libs/valine/1.3.3/Valine.min.js
# valine: //cdn.jsdelivr.net/npm/valine@1.3.4/dist/Valine.min.js
# valine: //cdnjs.cloudflare.com/ajax/libs/valine/1.3.4/Valine.min.js
valine:

# Internal version: 1.4.0
Expand Down
10 changes: 5 additions & 5 deletions layout/_third-party/analytics/application-insights.swig
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% if theme.application_insights %}
<script>
var appInsights=window.appInsights||function(config){
function i(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t["_"+r](config,i,u,e,o),s}),t
<script>
var appInsights=window.appInsights||function(config){
function i(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},u=document,e=window,o="script",s="AuthenticatedUserContext",h="start",c="stop",l="Track",a=l+"Event",v=l+"Page",y=u.createElement(o),r,f;y.src=config.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js";u.getElementsByTagName(o)[0].parentNode.appendChild(y);try{t.cookie=u.cookie}catch(p){}for(t.queue=[],t.version="1.0",r=["Event","Exception","Metric","PageView","Trace","Dependency"];r.length;)i("track"+r.pop());return i("set"+s),i("clear"+s),i(h+a),i(c+a),i(h+v),i(c+v),i("flush"),config.disableExceptionTracking||(r="onerror",i("_"+r),f=e[r],e[r]=function(config,i,u,e,o){var s=f&&f(config,i,u,e,o);return s!==!0&&t["_"+r](config,i,u,e,o),s}),t
}({
instrumentationKey:"{{ theme.application_insights }}"
instrumentationKey:"{{ theme.application_insights }}"
});
window.appInsights=appInsights;
appInsights.trackPageView();
</script>
</script>
{% endif %}
4 changes: 1 addition & 3 deletions layout/_third-party/analytics/cnzz-analytics.swig
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{% if theme.cnzz_siteid %}

<div style="display: none;">
<script src="//s95.cnzz.com/z_stat.php?id={{ theme.cnzz_siteid }}&web_id={{ theme.cnzz_siteid }}" language="JavaScript"></script>
<script src="//s95.cnzz.com/z_stat.php?id={{ theme.cnzz_siteid }}&web_id={{ theme.cnzz_siteid }}"></script>
</div>

{% endif %}
33 changes: 16 additions & 17 deletions layout/_third-party/analytics/facebook-sdk.swig
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{% if theme.facebook_sdk.enable %}
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{{ theme.facebook_sdk.app_id }}',
xfbml : true,
version : 'v2.10'
});
};

(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/{{ config.language|replace('-', '_') }}/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{{ theme.facebook_sdk.app_id }}',
xfbml : true,
version: 'v2.10'
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/{{ config.language|replace('-', '_') }}/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
{% endif %}
15 changes: 7 additions & 8 deletions layout/_third-party/analytics/google-analytics.swig
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{% if theme.google_analytics %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ theme.google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '{{ theme.google_analytics }}');
</script>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ theme.google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ theme.google_analytics }}');
</script>
{% endif %}
4 changes: 2 additions & 2 deletions layout/_third-party/analytics/growingio.swig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if theme.growingio_analytics %}
<script type='text/javascript'>
!function(e,t,n,g,i){e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},n=t.createElement("script"),tag=t.getElementsByTagName("script")[0],n.async=1,n.src=('https:'==document.location.protocol?'https://':'http://')+g,tag.parentNode.insertBefore(n,tag)}(window,document,"script","assets.growingio.com/2.1/gio.js","gio");
!function(e,t,n,g,i){e[i]=e[i]||function(){(e[i].q=e[i].q||[]).push(arguments)},n=t.createElement("script"),tag=t.getElementsByTagName("script")[0],n.async=1,n.src=('https:'==document.location.protocol?'https://':'http://')+g,tag.parentNode.insertBefore(n,tag)}(window,document,"script","assets.growingio.com/2.1/gio.js","gio");
gio('init','{{theme.growingio_analytics}}', {});
gio('send');
gio('send');
</script>
{% endif %}
23 changes: 11 additions & 12 deletions layout/_third-party/analytics/tencent-mta.swig
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{% if theme.tencent_mta %}
<script>
var _mtac = {};
(function() {
var mta = document.createElement("script");
mta.src = "https://pingjs.qq.com/h5/stats.js?v2.0.4";
mta.setAttribute("name", "MTAH5");
mta.setAttribute("sid", "{{theme.tencent_mta}}");

var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(mta, s);
})();
</script>
<script>
var _mtac = {};
(function() {
var mta = document.createElement("script");
mta.src = "https://pingjs.qq.com/h5/stats.js?v2.0.4";
mta.setAttribute("name", "MTAH5");
mta.setAttribute("sid", "{{theme.tencent_mta}}");
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(mta, s);
})();
</script>
{% endif %}
44 changes: 21 additions & 23 deletions layout/_third-party/analytics/vkontakte-api.swig
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
{% if theme.vkontakte_api.enable %}
<div id="vk_api_transport"></div>
<script>
window.vkAsyncInit = function() {
VK.init({
apiId: {{ theme.vkontakte_api.app_id }}
});

<div id="vk_api_transport"></div>
<script>
window.vkAsyncInit = function() {
VK.init({
apiId: {{ theme.vkontakte_api.app_id }}
});

{% if not is_home() and (is_post() and theme.vkontakte_api.like) %}
VK.Widgets.Like("vk_like", {type: "mini", height: 20});
{% endif %}

{% if page.comments and theme.vkontakte_api.comments %}
VK.Widgets.Comments("vk_comments", {limit: {{ theme.vkontakte_api.num_of_posts }}, attach: "*"});
{% endif %}
};
setTimeout(function() {
var el = document.createElement("script");
el.type = "text/javascript";
el.src = "//vk.com/js/api/openapi.js";
el.async = true;
document.getElementById("vk_api_transport").appendChild(el);
}, 0);
</script>
{% if not is_home() and (is_post() and theme.vkontakte_api.like) %}
VK.Widgets.Like("vk_like", {type: "mini", height: 20});
{% endif %}

{% if page.comments and theme.vkontakte_api.comments %}
VK.Widgets.Comments("vk_comments", {limit: {{ theme.vkontakte_api.num_of_posts }}, attach: "*"});
{% endif %}
};
setTimeout(function() {
var el = document.createElement("script");
el.type = "text/javascript";
el.src = "//vk.com/js/api/openapi.js";
el.async = true;
document.getElementById("vk_api_transport").appendChild(el);
}, 0);
</script>
{% endif %}
29 changes: 16 additions & 13 deletions layout/_third-party/comments/valine.swig
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
{% if theme.valine.enable and theme.valine.appid and theme.valine.appkey %}
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
{% set leancloud_uri = '//cdn1.lncld.net/static/js/3.11.1/av-min.js' %}
{% set valine_uri = '//unpkg.com/valine/dist/Valine.min.js' %}
{% if theme.vendors.leancloud %}
{% set leancloud_uri = theme.vendors.leancloud %}
{% endif %}
{% if theme.vendors.valine %}
{% set valine_uri = theme.vendors.valine %}
{% endif %}
<script src="{{ leancloud_uri }}"></script>
<script src="{{ valine_uri }}"></script>

<script>
var GUEST = ['nick','mail','link'];
var guest = '{{ theme.valine.guest_info }}';
guest = guest.split(',').filter(function (item) {
return GUEST.indexOf(item)>-1;
return GUEST.indexOf(item) > -1;
});
new Valine({
el: '#comments' ,
verify: {{ theme.valine.verify }},
notify: {{ theme.valine.notify }},
appId: '{{ theme.valine.appid }}',
appKey: '{{ theme.valine.appkey }}',
placeholder: '{{ theme.valine.placeholder }}',
avatar:'{{ theme.valine.avatar }}',
meta:guest,
pageSize:'{{ theme.valine.pageSize }}' || 10,
visitor: {{ theme.valine.visitor }}
el: '#comments' ,
verify: {{ theme.valine.verify }},
notify: {{ theme.valine.notify }},
appId: '{{ theme.valine.appid }}',
appKey: '{{ theme.valine.appkey }}',
placeholder: '{{ theme.valine.placeholder }}',
avatar: '{{ theme.valine.avatar }}',
meta:guest,
pageSize: '{{ theme.valine.pageSize }}' || 10,
visitor: {{ theme.valine.visitor }}
});
</script>
{% endif %}
30 changes: 15 additions & 15 deletions layout/_third-party/math/mathjax.swig
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
},
TeX: {equationNumbers: { autoNumber: "AMS" }}
});
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
},
TeX: {equationNumbers: { autoNumber: "AMS" }}
});
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for (i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for (i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
</script>
<script src="{{ theme.math.mathjax.cdn }}"></script>

<style>
.MathJax_Display {
overflow: auto hidden;
overflow: auto hidden;
}
</style>
6 changes: 3 additions & 3 deletions layout/_third-party/needsharebutton.swig
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
{% if theme.needmoreshare2.postbottom.enable %}
pbOptions = {};
{% for k,v in theme.needmoreshare2.postbottom.options %}
pbOptions.{{ k }} = "{{ v }}";
pbOptions.{{ k }} = "{{ v }}";
{% endfor %}
new needShareButton('#needsharebutton-postbottom', pbOptions);
{% endif %}
{% if theme.needmoreshare2.float.enable %}
flOptions = {};
{% for k,v in theme.needmoreshare2.float.options %}
flOptions.{{ k }} = "{{ v }}";
flOptions.{{ k }} = "{{ v }}";
{% endfor %}
new needShareButton('#needsharebutton-float', flOptions);
{% endif %}
</script>
{% endif %}
{% endif %}
30 changes: 16 additions & 14 deletions layout/_third-party/rating.swig
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{% if theme.rating.enable and (not is_home() and is_post()) %}
<script>
wpac_init = window.wpac_init || [];
wpac_init.push({widget: 'Rating', id: {{ theme.rating.id }},
el: 'wpac-rating',
color: '{{ theme.rating.color }}'
});
(function() {
if ('WIDGETPACK_LOADED' in window) return;
WIDGETPACK_LOADED = true;
var mc = document.createElement('script');
mc.type = 'text/javascript';
mc.async = true;
mc.src = '//embed.widgetpack.com/widget.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(mc, s.nextSibling);
})();
wpac_init = window.wpac_init || [];
wpac_init.push({
widget: 'Rating',
id: {{ theme.rating.id }},
el: 'wpac-rating',
color: '{{ theme.rating.color }}'
});
(function() {
if ('WIDGETPACK_LOADED' in window) return;
WIDGETPACK_LOADED = true;
var mc = document.createElement('script');
mc.type = 'text/javascript';
mc.async = true;
mc.src = '//embed.widgetpack.com/widget.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(mc, s.nextSibling);
})();
</script>
{% endif %}
24 changes: 12 additions & 12 deletions layout/_third-party/seo/baidu-push.swig
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{% if theme.baidu_push %}
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
{% endif %}
Loading