Skip to content

Commit

Permalink
Merge branch 'master' into pdfjs
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-nginx committed Nov 7, 2018
2 parents 73eb6dd + 2f50d75 commit 9aaa14a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
12 changes: 8 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,14 @@ codeblock:
#description: ex. subscribe to my blog by scanning my public wechat account

# Reward
#reward_comment: Donate comment here
#wechatpay: /images/wechatpay.jpg
#alipay: /images/alipay.jpg
#bitcoin: /images/bitcoin.png
# If true, reward would be displayed in every article by default.
# And you can show or hide one article specially through add page variable `reward: true/false`.
reward:
enable: false
#comment: Donate comment here
#wechatpay: /images/wechatpay.jpg
#alipay: /images/alipay.jpg
#bitcoin: /images/bitcoin.png

# Related popular posts
# Dependencies: https://github.com/tea3/hexo-related-popular-posts
Expand Down
7 changes: 6 additions & 1 deletion layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,12 @@
</div>
{% endif %}

{% if (theme.alipay or theme.wechatpay or theme.bitcoin) and not is_index %}
{% if page.reward === undefined and theme.reward.enable %}
{% set reward_able = true %}
{% else %}
{% set reward_able = page.reward %}
{% endif %}
{% if reward_able and (theme.reward.alipay or theme.reward.wechatpay or theme.reward.bitcoin) and not is_index %}
<div>
{% include 'reward.swig' %}
</div>
Expand Down
14 changes: 7 additions & 7 deletions layout/_macro/reward.swig
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
<div>{{ theme.reward_comment }}</div>
<div>{{ theme.reward.comment }}</div>
<button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
<span>{{ __('reward.donate') }}</span>
</button>
<div id="QR" style="display: none;">

{% if theme.wechatpay %}
{% if theme.reward.wechatpay %}
<div id="wechat" style="display: inline-block">
<img id="wechat_qr" src="{{ url_for(theme.wechatpay) }}" alt="{{ author }} {{ __('reward.wechatpay') }}"/>
<img id="wechat_qr" src="{{ url_for(theme.reward.wechatpay) }}" alt="{{ author }} {{ __('reward.wechatpay') }}"/>
<p>{{ __('reward.wechatpay') }}</p>
</div>
{% endif %}

{% if theme.alipay %}
{% if theme.reward.alipay %}
<div id="alipay" style="display: inline-block">
<img id="alipay_qr" src="{{ url_for(theme.alipay) }}" alt="{{ author }} {{ __('reward.alipay') }}"/>
<img id="alipay_qr" src="{{ url_for(theme.reward.alipay) }}" alt="{{ author }} {{ __('reward.alipay') }}"/>
<p>{{ __('reward.alipay') }}</p>
</div>
{% endif %}

{% if theme.bitcoin %}
{% if theme.reward.bitcoin %}
<div id="bitcoin" style="display: inline-block">
<img id="bitcoin_qr" src="{{ url_for(theme.bitcoin) }}" alt="{{ author }} {{ __('reward.bitcoin') }}"/>
<img id="bitcoin_qr" src="{{ url_for(theme.reward.bitcoin) }}" alt="{{ author }} {{ __('reward.bitcoin') }}"/>
<p>{{ __('reward.bitcoin') }}</p>
</div>
{% endif %}
Expand Down
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 @@ -59,7 +59,7 @@
@import "post-nav";
@import "post-eof";
@import "post-gallery";
@import "post-reward" if hexo-config('alipay') or hexo-config('wechatpay') or hexo-config('bitcoin');
@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-rtl";
Expand Down

0 comments on commit 9aaa14a

Please sign in to comment.