Skip to content

Commit

Permalink
Feat: Add likely share support (#678)
Browse files Browse the repository at this point in the history
* Feat: Add likely share support

* #491

* update cdn
  • Loading branch information
1v9 authored Mar 12, 2019
1 parent 23ec238 commit 82edcff
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 5 deletions.
26 changes: 26 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,24 @@ gitalk:
# Go to https://www.addthis.com/dashboard to customize your tools.
#add_this_id:

# Likely Share
# See: https://ilyabirman.net/projects/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
# See: https://github.com/revir/need-more-share2, https://github.com/DzmVasileusky/needShareButton
Expand Down Expand Up @@ -1110,6 +1128,14 @@ vendors:
gitalk_css:
md5:

# likely
# See: https://github.com/ilyabirman/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:

# Assets
css: css
js: js
Expand Down
13 changes: 9 additions & 4 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
{% endif %}

{% if not is_index %}
{% 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.needmoreshare2.enable and theme.needmoreshare2.postbottom.enable) or (theme.baidushare and theme.baidushare.type === "button") %}
{% 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) or (theme.baidushare and theme.baidushare.type === "button") %}
<div class="post-widgets">
{% if theme.rating.enable %}
<div class="wp_rating">
Expand All @@ -396,14 +396,14 @@
</div>
{% endif %}

{% if (theme.needmoreshare2.enable and theme.needmoreshare2.postbottom.enable) or (theme.baidushare.type === "button") %}
{% if theme.likely.enable or (theme.needmoreshare2.enable and theme.needmoreshare2.postbottom.enable) or (theme.baidushare.type === "button") %}
{% 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) %}
<span class="post-meta-divider">|</span>
{% endif %}
<div class="social_share">
{% if theme.baidushare.type === "button" %}
{% if theme.likely.enable %}
<div>
{% include '../_partials/share/baidushare.swig' %}
{% include '../_partials/share/likely.swig' %}
</div>
{% endif %}
{% if theme.needmoreshare2.enable and theme.needmoreshare2.postbottom.enable %}
Expand All @@ -413,6 +413,11 @@
</span>
</div>
{% endif %}
{% if theme.baidushare.type === "button" %}
<div>
{% include '../_partials/share/baidushare.swig' %}
</div>
{% endif %}
</div>
{% endif %}
</div>
Expand Down
23 changes: 23 additions & 0 deletions layout/_partials/share/likely.swig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% set likely_js_url = '//cdn.jsdelivr.net/npm/ilyabirman-likely@2/release/likely.js' %}
{% if theme.vendors.likely_js %}
{% set likely_js_url = theme.vendors.likely_js %}
{% endif %}
<script src="{{ likely_js_url }}"></script>

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

{% 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>
2 changes: 1 addition & 1 deletion source/css/_common/components/post/post.styl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
@import "post-gallery";
@import "post-reward" if hexo-config('reward.alipay') or hexo-config('reward.wechatpay') or hexo-config('reward.bitcoin');
@import "post-copyright" if hexo-config('creative_commons.post');
@import "post-widgets" if (hexo-config('facebook_sdk.enable') and hexo-config('facebook_sdk.like_button')) or (hexo-config('vkontakte_api.enable') and hexo-config('vkontakte_api.like')) or hexo-config('rating.enable') or (hexo-config('needmoreshare2.enable') and hexo-config('needmoreshare2.postbottom.enable')) or hexo-config('baidushare');
@import "post-widgets" if (hexo-config('facebook_sdk.enable') and hexo-config('facebook_sdk.like_button')) or (hexo-config('vkontakte_api.enable') and hexo-config('vkontakte_api.like')) or hexo-config('rating.enable') or hexo-config('likely.enable') or (hexo-config('needmoreshare2.enable') and hexo-config('needmoreshare2.postbottom.enable')) or hexo-config('baidushare');
@import "post-rtl";
@import "post-reading_progress" if hexo-config('reading_progress.enable');

0 comments on commit 82edcff

Please sign in to comment.