From abcb5b943d48852961016f52c36dff579c87692a Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Thu, 27 Dec 2018 23:07:52 +0800 Subject: [PATCH 1/2] Fix #271 --- _config.yml | 12 +++++++--- layout/_third-party/comments/valine.swig | 29 +++++++++++++----------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/_config.yml b/_config.yml index 9a3f968249..455923c3b9 100644 --- a/_config.yml +++ b/_config.yml @@ -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 diff --git a/layout/_third-party/comments/valine.swig b/layout/_third-party/comments/valine.swig index da06d7f96d..bc12fd7825 100644 --- a/layout/_third-party/comments/valine.swig +++ b/layout/_third-party/comments/valine.swig @@ -1,28 +1,31 @@ {% if theme.valine.enable and theme.valine.appid and theme.valine.appkey %} - + {% 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 %} + - {% endif %} From 25d6db5cde952e0bf30e2ddc07b1f7d5ba5c36d2 Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Fri, 28 Dec 2018 00:20:12 +0800 Subject: [PATCH 2/2] format code --- .../analytics/application-insights.swig | 10 ++--- .../analytics/cnzz-analytics.swig | 4 +- .../_third-party/analytics/facebook-sdk.swig | 33 +++++++------- .../analytics/google-analytics.swig | 15 +++---- layout/_third-party/analytics/growingio.swig | 4 +- .../_third-party/analytics/tencent-mta.swig | 23 +++++----- .../_third-party/analytics/vkontakte-api.swig | 44 +++++++++---------- layout/_third-party/math/mathjax.swig | 30 ++++++------- layout/_third-party/needsharebutton.swig | 6 +-- layout/_third-party/rating.swig | 30 +++++++------ layout/_third-party/seo/baidu-push.swig | 24 +++++----- layout/page.swig | 36 +++++++-------- 12 files changed, 127 insertions(+), 132 deletions(-) diff --git a/layout/_third-party/analytics/application-insights.swig b/layout/_third-party/analytics/application-insights.swig index c1dda0e0b5..9844cbf4c8 100644 --- a/layout/_third-party/analytics/application-insights.swig +++ b/layout/_third-party/analytics/application-insights.swig @@ -1,11 +1,11 @@ {% if theme.application_insights %} - + {% endif %} diff --git a/layout/_third-party/analytics/cnzz-analytics.swig b/layout/_third-party/analytics/cnzz-analytics.swig index bffb73cdcb..9693cda230 100644 --- a/layout/_third-party/analytics/cnzz-analytics.swig +++ b/layout/_third-party/analytics/cnzz-analytics.swig @@ -1,7 +1,5 @@ {% if theme.cnzz_siteid %} -
- {% endif %} diff --git a/layout/_third-party/analytics/facebook-sdk.swig b/layout/_third-party/analytics/facebook-sdk.swig index 7b5a291876..d7cd7ee2f6 100644 --- a/layout/_third-party/analytics/facebook-sdk.swig +++ b/layout/_third-party/analytics/facebook-sdk.swig @@ -1,19 +1,18 @@ {% if theme.facebook_sdk.enable %} - + {% endif %} diff --git a/layout/_third-party/analytics/google-analytics.swig b/layout/_third-party/analytics/google-analytics.swig index 1190babc94..fb7fc604f5 100644 --- a/layout/_third-party/analytics/google-analytics.swig +++ b/layout/_third-party/analytics/google-analytics.swig @@ -1,10 +1,9 @@ {% if theme.google_analytics %} - - + + {% endif %} diff --git a/layout/_third-party/analytics/growingio.swig b/layout/_third-party/analytics/growingio.swig index 4f67c75003..b39380378a 100644 --- a/layout/_third-party/analytics/growingio.swig +++ b/layout/_third-party/analytics/growingio.swig @@ -1,7 +1,7 @@ {% if theme.growingio_analytics %} {% endif %} diff --git a/layout/_third-party/analytics/tencent-mta.swig b/layout/_third-party/analytics/tencent-mta.swig index f4b6470157..032e41ab43 100644 --- a/layout/_third-party/analytics/tencent-mta.swig +++ b/layout/_third-party/analytics/tencent-mta.swig @@ -1,14 +1,13 @@ {% if theme.tencent_mta %} - + {% endif %} diff --git a/layout/_third-party/analytics/vkontakte-api.swig b/layout/_third-party/analytics/vkontakte-api.swig index dfcc953b78..ee069d4193 100644 --- a/layout/_third-party/analytics/vkontakte-api.swig +++ b/layout/_third-party/analytics/vkontakte-api.swig @@ -1,27 +1,25 @@ {% if theme.vkontakte_api.enable %} + + + {% 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); + {% endif %} diff --git a/layout/_third-party/math/mathjax.swig b/layout/_third-party/math/mathjax.swig index 6ce58109e8..a92c1a62b1 100644 --- a/layout/_third-party/math/mathjax.swig +++ b/layout/_third-party/math/mathjax.swig @@ -1,26 +1,26 @@ diff --git a/layout/_third-party/needsharebutton.swig b/layout/_third-party/needsharebutton.swig index 9120520c67..77dc9b26fe 100644 --- a/layout/_third-party/needsharebutton.swig +++ b/layout/_third-party/needsharebutton.swig @@ -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 %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/layout/_third-party/rating.swig b/layout/_third-party/rating.swig index 3ace732ab6..e51e0945a2 100644 --- a/layout/_third-party/rating.swig +++ b/layout/_third-party/rating.swig @@ -1,18 +1,20 @@ {% if theme.rating.enable and (not is_home() and is_post()) %} {% endif %} diff --git a/layout/_third-party/seo/baidu-push.swig b/layout/_third-party/seo/baidu-push.swig index ee6838f3a6..d2ecfdf6bb 100644 --- a/layout/_third-party/seo/baidu-push.swig +++ b/layout/_third-party/seo/baidu-push.swig @@ -1,16 +1,16 @@ {% if theme.baidu_push %} - + } + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(bp, s); + })(); + {% endif %} diff --git a/layout/page.swig b/layout/page.swig index 5498cc0265..24dd1d9a13 100644 --- a/layout/page.swig +++ b/layout/page.swig @@ -4,11 +4,11 @@ {% block title %}{# #}{% set page_title_suffix = ' | ' + title %}{# - #}{% if page.type === "categories" and not page.title %}{# + #}{% if page.type === 'categories' and not page.title %}{# #}{{ __('title.category') + page_title_suffix }}{# - #}{% elif page.type === "tags" and not page.title %}{# + #}{% elif page.type === 'tags' and not page.title %}{# #}{{ __('title.tag') + page_title_suffix }}{# - #}{% elif page.type === "schedule" and not page.title %}{# + #}{% elif page.type === 'schedule' and not page.title %}{# #}{{ __('title.schedule') + page_title_suffix }}{# #}{% else %}{# #}{{ page.title + page_title_suffix }}{# @@ -30,16 +30,16 @@ {#################}