-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Feature: A better share button NeedMoreShare2 #1913
Changes from 4 commits
c5f8ff8
83dcbb1
86daafd
b136690
11a037d
673aa31
599b6d0
ed072f8
9edfc84
721d00f
aaa57e7
fb1e131
0e14bae
0c8fc5a
c82e17f
b6c1e14
5306aaa
ecfbe2d
0bc44b6
b52cf5e
9b9155c
d34441f
649df23
59cfb1d
4884fb0
9e46538
4b62858
89e0e10
da94ded
cb97fe1
a138923
b5dd8ed
57cd8df
583de52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -390,6 +390,25 @@ valine: | |
# Share | ||
#duoshuo_share: true | ||
|
||
# NeedMoreShare2 | ||
# This plugin is a pure javascript sharing lib which is useful in China. | ||
# See: https://github.com/revir/need-more-share2 | ||
needMoreShare2: | ||
postbottom: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to add global enable/disable switch for better control it. |
||
enable: false | ||
Options: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To lowercase? |
||
iconStyle: box | ||
boxForm: horizontal | ||
position: middleCenter | ||
networks: Weibo,Wechat,Douban,QQZone,Twitter,Facebook | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mailto,Twitter,Pinterest,Facebook,GooglePlus,Reddit,Delicious,Tapiture,StumbleUpon,Linkedin,Slashdot,Technorati,Posterous,Tumblr,GoogleBookmarks,Newsvine,Pingfm,Evernote,Friendfeed,Vkontakte,Odnoklassniki,Mailru |
||
float: | ||
enable: false | ||
Options: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To lowercase? |
||
iconStyle: box | ||
boxForm: horizontal | ||
position: middleRight | ||
networks: Weibo,Wechat,Douban,QQZone,Twitter,Facebook | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mailto,Twitter,Pinterest,Facebook,GooglePlus,Reddit,Delicious,Tapiture,StumbleUpon,Linkedin,Slashdot,Technorati,Posterous,Tumblr,GoogleBookmarks,Newsvine,Pingfm,Evernote,Friendfeed,Vkontakte,Odnoklassniki,Mailru |
||
|
||
# Google Webmaster tools verification setting | ||
# See: https://www.google.com/webmasters/ | ||
#google_site_verification: | ||
|
@@ -710,6 +729,10 @@ vendors: | |
# https://github.com/ethantw/Han | ||
han: | ||
|
||
# needMoreShare2 | ||
# https://github.com/revir/need-more-share2 | ||
needMoreShare2: | ||
|
||
|
||
# Assets | ||
css: css | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{% include 'needsharebutton/assests.swig' %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{% if theme.needMoreShare2.postbottom.enable or theme.needMoreShare2.float.enable %} | ||
{% set needMoreShare2_css = url_for(theme.vendors._internal + '/needsharebutton/needsharebutton.min.css') %} | ||
{% if theme.vendors.needMoreShare2 %} | ||
{% set needMoreShare2_css = theme.vendors.needMoreShare2_css %} | ||
{% endif %} | ||
<link rel="stylesheet" href="{{ needMoreShare2_css }}"> | ||
|
||
{% set needMoreShare2_js = url_for(theme.vendors._internal + '/needsharebutton/needsharebutton.min.js') %} | ||
{% if theme.vendors.needMoreShare2_js %} | ||
{% set needMoreShare2_js = theme.vendors.needMoreShare2_js %} | ||
{% endif %} | ||
<script src="{{ needMoreShare2_js }}"></script> | ||
|
||
<script> | ||
{% if theme.needMoreShare2.postbottom.enable %} | ||
pbOptions = {}; | ||
{% for k,v in theme.needMoreShare2.postbottom.Options %} | ||
pbOptions.{{ k }} = "{{ v }}"; | ||
{% endfor %} | ||
new needShareButton('#need-share-button-postbottom', pbOptions); | ||
{% endif %} | ||
{% if theme.needMoreShare2.float.enable %} | ||
flOptions = {}; | ||
{% for k,v in theme.needMoreShare2.float.Options %} | ||
flOptions.{{ k }} = "{{ v }}"; | ||
{% endfor %} | ||
new needShareButton('#need-share-button-float', flOptions); | ||
{% endif %} | ||
</script> | ||
{% endif %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div id="need-share-button-float"><i class="fa fa-share-alt" aria-hidden="true"></i></div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And can u please to split this 2 files into 1? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is ok to use macro to identify whether it is float or postbottom?And where should i import the macro in _layout.swig and post.swig? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. U joking? This is floatdom.swig There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will make a new file called dom.swig like this: {% macro render type %}
<span id="needsharebutton-{{type}}"><i class="fa fa-share-alt" aria-hidden="true"></i></span>
{% endmacro %} (maybe i reply in the wrong place...) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems good. But why filename |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<span id="need-share-button-postbottom"><i class="fa fa-share-alt" aria-hidden="true"></i></span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And can u please to split this 2 files into 1? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#need-share-button-postbottom { | ||
color: #000000; | ||
background: #ffffff; | ||
border: 1px solid #555555; | ||
border-radius: 4px; | ||
padding: 4px 15px; | ||
cursor: pointer; | ||
} | ||
|
||
#need-share-button-postbottom:hover { | ||
color: #ffffff; | ||
background: #000000; | ||
border: 1px solid #000000; | ||
} | ||
|
||
#need-share-button-float { | ||
position: fixed; | ||
bottom: 38px; | ||
left: -7px; | ||
z-index: 9999; | ||
color: #555555; | ||
background: rgba(255,255,255,0.6); | ||
width: 35px; | ||
cursor: pointer; | ||
text-align: center; | ||
border: 1px solid #999999; | ||
border-radius: 4px; | ||
} | ||
|
||
#need-share-button-float:hover { | ||
color: #ffffff; | ||
background: #000000; | ||
border: 1px solid #000000; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
@import "localsearch"; | ||
@import "busuanzi-counter"; | ||
@import "algolia-search" if hexo-config('algolia_search.enable'); | ||
@import "needsharebutton"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to add conditional import here. |
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To lowercase? (_)