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

Extract all share systems to plugins #1104

Merged
merged 5 commits into from
Aug 18, 2019
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
125 changes: 32 additions & 93 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,8 @@ bookmark:


# ---------------------------------------------------------------
# Comments and Widgets
# See: https://theme-next.org/docs/third-party-services/comments-and-widgets
# Comments Settings
# See: https://theme-next.org/docs/third-party-services/comments
# ---------------------------------------------------------------

# Multiple Comment System Support
Expand Down Expand Up @@ -682,85 +682,10 @@ gitalk:


# ---------------------------------------------------------------
# Content Sharing Services
# See: https://theme-next.org/docs/third-party-services/content-sharing-services
# Post Widgets / Content Sharing Services
# See: https://theme-next.org/docs/third-party-services/post-widgets
# ---------------------------------------------------------------

# AddThis Share. See: https://www.addthis.com
# Go to https://www.addthis.com/dashboard to customize your tools.
add_this_id:

# Likely Share
# For more information: https://ilyabirman.net/projects/likely/, https://github.com/ilyabirman/Likely
# Likely supports four looks, nine social networks, any button text.
# You are free to modify the text value and order of any network.
likely:
enable: false
look: normal # Available values: normal | light | small | big
networks:
twitter: Tweet
facebook: Share
linkedin: Link
gplus: Plus
vkontakte: Share
odnoklassniki: Class
telegram: Send
whatsapp: Send
pinterest: Pin

# NeedMoreShare2
# Dependencies: https://github.com/theme-next/theme-next-needmoreshare2
# For more information: https://github.com/revir/need-more-share2
# iconStyle: default | box
# boxForm: horizontal | vertical
# position: top / middle / bottom + Left / Center / Right
# networks:
# Weibo | Wechat | Douban | QQZone | Twitter | Facebook | Linkedin | Mailto | Reddit | Delicious | StumbleUpon | Pinterest
# GooglePlus | Tumblr | GoogleBookmarks | Newsvine | Evernote | Friendfeed | Vkontakte | Odnoklassniki | Mailru
needmoreshare2:
enable: false
postbottom:
enable: false
options:
iconStyle: box
boxForm: horizontal
position: bottomCenter
networks: Weibo,Wechat,Douban,QQZone,Twitter,Facebook
float:
enable: false
options:
iconStyle: box
boxForm: horizontal
position: middleRight
networks: Weibo,Wechat,Douban,QQZone,Twitter,Facebook


# ---------------------------------------------------------------
# Statistics and Analytics
# See: https://theme-next.org/docs/third-party-services/statistics-and-analytics
# ---------------------------------------------------------------

# Baidu Analytics
baidu_analytics: # <app_id>

# Growingio Analytics
# Copyright 2015-2018 GrowingIO, Inc. More info available at https://www.growingio.com
growingio_analytics: # <project_id>

# Google Analytics
google_analytics:
tracking_id: # <app_id>
localhost_ignored: true

# CNZZ count
cnzz_siteid:

# Application Insights
# See: https://azure.microsoft.com/en-us/services/application-insights
application_insights:

# Post widgets & FB/VK comments settings.
# ---------------------------------------------------------------
# Facebook SDK Support
facebook_sdk:
enable: false
Expand Down Expand Up @@ -793,7 +718,35 @@ rating:
enable: false
id: # <app_id>
color: fc6423

# AddThis Share. See: https://www.addthis.com
# Go to https://www.addthis.com/dashboard to customize your tools.
add_this_id:


# ---------------------------------------------------------------
# Statistics and Analytics
# See: https://theme-next.org/docs/third-party-services/statistics-and-analytics
# ---------------------------------------------------------------

# Baidu Analytics
baidu_analytics: # <app_id>

# Growingio Analytics
# Copyright 2015-2018 GrowingIO, Inc. More info available at https://www.growingio.com
growingio_analytics: # <project_id>

# Google Analytics
google_analytics:
tracking_id: # <app_id>
localhost_ignored: true

# CNZZ count
cnzz_siteid:

# Application Insights
# See: https://azure.microsoft.com/en-us/services/application-insights
application_insights:

# Show number of visitors to each article.
# You can visit https://leancloud.cn to get AppID and AppKey.
Expand Down Expand Up @@ -1103,20 +1056,6 @@ vendors:
gitalk_js:
gitalk_css:

# likely
# Example:
# likely_js: //cdn.jsdelivr.net/npm/ilyabirman-likely@2/release/likely.js
# likely_css: //cdn.jsdelivr.net/npm/ilyabirman-likely@2/release/likely.css
likely_js:
likely_css:

# Internal version: 1.0.0
# Example:
# needmoreshare2_js: //cdn.jsdelivr.net/gh/theme-next/theme-next-needmoreshare2@1/needsharebutton.min.js
# needmoreshare2_css: //cdn.jsdelivr.net/gh/theme-next/theme-next-needmoreshare2@1/needsharebutton.min.css
needmoreshare2_js:
needmoreshare2_css:

# Algolia Search
# Example:
# algolia_instant_js: //cdn.jsdelivr.net/npm/instantsearch.js@2/dist/instantsearch.min.js
Expand Down
2 changes: 1 addition & 1 deletion layout/_layout.swig
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<div class="reading-progress-bar"></div>
{%- endif %}

{{ partial('_partials/share/index.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_partials/share.swig', {}, {cache: theme.cache.enable}) }}
</div>

{{ partial('_scripts/index.swig', {}, {cache: theme.cache.enable}) }}
Expand Down
10 changes: 0 additions & 10 deletions layout/_partials/head/head.swig
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@
<link rel="stylesheet" href="{{ fancybox_css_uri }}">
{%- endif %}

{%- if theme.likely.enable %}
{%- set likely_css_uri = theme.vendors.likely_css | default('//cdn.jsdelivr.net/npm/ilyabirman-likely@2/release/likely.css') %}
<link rel="stylesheet" href="{{ likely_css_uri }}">
{%- endif %}

{%- if theme.needmoreshare2.enable %}
{%- set needmoreshare2_css_uri = theme.vendors.needmoreshare2_css | default(next_vendors('needsharebutton/needsharebutton.css')) %}
<link rel="stylesheet" href="{{ needmoreshare2_css_uri }}">
{%- endif %}

{%- if theme.pace.enable %}
{%- set pace_css_uri = theme.vendors.pace_css | default(next_vendors('pace/pace-theme-' + theme.pace.theme + '.min.css?v=1.0.2')) %}
{%- set pace_js_uri = theme.vendors.pace | default(next_vendors('pace/pace.min.js?v=1.0.2')) %}
Expand Down
27 changes: 1 addition & 26 deletions layout/_partials/post/post-footer.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- if theme.rating.enable or (theme.vkontakte_api.enable and theme.vkontakte_api.like) or (theme.facebook_sdk.enable and theme.facebook_sdk.like_button) or theme.likely.enable or (theme.needmoreshare2.enable and theme.needmoreshare2.postbottom.enable) %}
{%- if theme.rating.enable or (theme.vkontakte_api.enable and theme.vkontakte_api.like) or (theme.facebook_sdk.enable and theme.facebook_sdk.like_button) %}
<div class="post-widgets">
{%- if theme.rating.enable %}
<div class="wp_rating">
Expand All @@ -21,30 +21,5 @@
{%- endif %}
</div>
{%- endif %}

{%- if theme.likely.enable or (theme.needmoreshare2.enable and theme.needmoreshare2.postbottom.enable) %}
<div class="social-share">
{%- if theme.likely.enable %}
{%- if theme.likely.look == 'normal' %}
{%- set likely_look = 'likely' %}
{% else %}
{%- set likely_look = 'likely likely-' + theme.likely.look %}
{%- endif %}

<div class="{{ likely_look }}">
{%- for x in theme.likely.networks %}
<div class="{{ loop.key }}">{{ x }}</div>
{%- endfor %}
</div>
{%- endif %}
{%- if theme.needmoreshare2.enable and theme.needmoreshare2.postbottom.enable %}
<div id="needsharebutton-postbottom">
<span class="btn">
<i class="fa fa-share-alt" aria-hidden="true"></i>
</span>
</div>
{%- endif %}
</div>
{%- endif %}
</div>
{%- endif %}
5 changes: 5 additions & 0 deletions layout/_partials/share.swig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{%- if theme.add_this_id %}
<div class="addthis_inline_share_toolbox">
<script src="//s7.addthis.com/js/300/addthis_widget.js#pubid={{ theme.add_this_id }}" async="async"></script>
</div>
{%- endif %}
3 changes: 0 additions & 3 deletions layout/_partials/share/add-this.swig

This file was deleted.

9 changes: 0 additions & 9 deletions layout/_partials/share/index.swig

This file was deleted.

2 changes: 0 additions & 2 deletions layout/_partials/share/likely.swig

This file was deleted.

26 changes: 0 additions & 26 deletions layout/_partials/share/needsharebutton.swig

This file was deleted.

2 changes: 1 addition & 1 deletion source/css/_common/components/post/post-widgets.styl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.post-widgets {
border-top: 1px solid #eee;
margin-top: 45px;
margin-top: 15px;
text-align: center;
}

Expand Down
3 changes: 1 addition & 2 deletions source/css/_common/components/post/post.styl
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@
@import 'post-rtl';
@import 'post-tags';
@import 'post-title';
@import 'post-widgets';

@import 'post-reward' if (hexo-config('reward_settings.enable'));

@import 'post-copyright' if (hexo-config('creative_commons.post'));

@import 'post-widgets' if ((hexo-config('facebook_sdk.enable') && hexo-config('facebook_sdk.like_button')) || (hexo-config('vkontakte_api.enable') && hexo-config('vkontakte_api.like')) || hexo-config('rating.enable') || hexo-config('likely.enable') || (hexo-config('needmoreshare2.enable') && hexo-config('needmoreshare2.postbottom.enable')));
28 changes: 0 additions & 28 deletions source/css/_common/components/third-party/needsharebutton.styl

This file was deleted.

2 changes: 0 additions & 2 deletions source/css/_common/components/third-party/third-party.styl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

@import 'search' if (hexo-config('local_search.enable') || hexo-config('algolia_search.enable'));

@import 'needsharebutton' if (hexo-config('needmoreshare2.enable'));

@import 'related-posts' if (hexo-config('related_posts.enable'));

@import 'math' if (hexo-config('math.enable') && hexo-config('math.engine') == 'mathjax');