Skip to content
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
17 changes: 10 additions & 7 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,18 @@ wechat_subscriber:
#qcode: /path/to/your/wechatqcode e.g. /uploads/wechat-qcode.jpg
#description: e.g. subscribe to my blog by scanning my public wechat account

# Reward
# If true, reward would be displayed in every article by default.
# You can show or hide reward in a specific article throuth `reward: true | false` in Front Matter.
reward:
# Reward (Donate)
reward_settings:
# If true, reward would be displayed in every article by default.
# You can show or hide reward in a specific article throuth `reward: true | false` in Front Matter.
enable: false
animation: false
#comment: Donate comment here
#wechatpay: /images/wechatpay.jpg
#alipay: /images/alipay.jpg
#bitcoin: /images/bitcoin.jpg

reward:
#wechatpay: /images/wechatpay.png
#alipay: /images/alipay.png
#bitcoin: /images/bitcoin.png

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#monero: /images/monero.png

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add monero and paypal as examples to the docs

# Related popular posts
# Dependencies: https://github.com/tea3/hexo-related-popular-posts
Expand Down
4 changes: 2 additions & 2 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,12 @@
{% include '../_partials/post/wechat-subscriber.swig' %}
{% endif %}

{% if page.reward === undefined and theme.reward.enable %}
{% if page.reward === undefined and theme.reward_settings.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 %}
{% if reward_able and not is_index %}
<div>
{% include '../_partials/post/reward.swig' %}
</div>
Expand Down
40 changes: 16 additions & 24 deletions layout/_partials/post/reward.swig
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
<div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
<div>{{ theme.reward.comment }}</div>
<button id="rewardButton" disable="enable" onclick="var qr = document.getElementById(&quot;QR&quot;); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
<span>{{ __('reward.donate') }}</span>
<div id="reward-container">
<div>{{ theme.reward_settings.comment }}</div>
<button id="reward-button" disable="enable" onclick="var qr = document.getElementById(&quot;qr&quot;); qr.style.display = (qr.style.display === 'none') ? 'block' : 'none';">
{{ __('reward.donate') }}
</button>
<div id="QR" style="display: none;">
<div id="qr" style="display: none;">

{% if theme.reward.wechatpay %}
<div id="wechat" style="display: inline-block">
<img id="wechat_qr" src="{{ url_for(theme.reward.wechatpay) }}" alt="{{ author }} {{ __('reward.wechatpay') }}"/>
<p>{{ __('reward.wechatpay') }}</p>
{% for name, image in theme.reward %}
{% set builtin = ['wechatpay', 'alipay', 'bitcoin'] %}
{% if builtin.indexOf(name) !== -1 %}
{% set translation = __('reward.' + name) %}
{% else %}
{% set translation = name %}
{% endif %}
<div style="display: inline-block">
<img src="{{ url_for(image) }}" alt="{{ author }} {{ translation }}"/>
<p>{{ translation }}</p>
</div>
{% endif %}

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

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

</div>
</div>
86 changes: 43 additions & 43 deletions source/css/_common/components/post/post-reward.styl
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
#rewardButton {
#reward-container {
padding: 10px 0;
margin: 20px auto;
width: 90%;
text-align: center;
}

#reward-button {
cursor: pointer;
border: 0;
outline: 0;
border-radius: 5px;
padding: 0;
margin: 0;
letter-spacing: normal;
text-transform: none;
text-indent: 0px;
text-shadow: none;
}

#rewardButton span {
display: inline-block;
width: 80px;
height: 35px;
line-height: 35px;
vertical-align: text-top;
margin: 0;
padding: 0 15px;
border-radius: 5px;
height: $font-size-large * 2;
line-height: $font-size-large * 2;
font-size: $font-size-large;
color: #fff;
font-weight: 400;
font-style: normal;
font-variant: normal;
font-stretch: normal;
font-size: 18px;
background: #F44336;
letter-spacing: normal;
text-transform: none;
text-indent: 0px;
text-shadow: none;
}

#rewardButton span:hover {
#reward-button span:hover {
background: #F7877F;
}

#QR {
#qr {
padding-top: 20px;
}

#QR a {
border: 0;
}
a {
border: 0;
}

#QR img {
width: 180px;
max-width: 100%;
display: inline-block;
margin: 0.8em 2em 0 2em;
}
img {
width: 180px;
max-width: 100%;
display: inline-block;
margin: 0.8em 2em 0 2em;
}

#QR p {
text-align: center;
}
p {
text-align: center;
}

#QR > div:hover p {
animation: roll 0.1s infinite linear;
}
if hexo-config('reward_settings.animation') {
& > div:hover p {
animation: roll 0.1s infinite linear;
}

@keyframes roll {
from {
transform: rotateZ(30deg);
}
to {
transform: rotateZ(-30deg);
@keyframes roll {
from {
transform: rotateZ(30deg);
}
to {
transform: rotateZ(-30deg);
}
}
}
}
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 @@ -57,7 +57,7 @@
@import "post-nav";
@import "post-eof";
@import "post-gallery";
@import "post-reward" if hexo-config('reward.alipay') or hexo-config('reward.wechatpay') or hexo-config('reward.bitcoin');
@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') 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";
Expand Down