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

QR code generation without jiathis.com. #313

Merged
merged 1 commit into from
Aug 6, 2017
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
2 changes: 1 addition & 1 deletion layout/post.jade
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ block content
!= page.content
if theme.shareto == true
script(type='text/javascript', src=url_for(theme.js) + '/share.js' + '?v=' + theme.version, async)
a.article-share-link(data-url='#{page.permalink}', data-id='#{page._id}')= __('shareto')
a.article-share-link(data-url='#{page.permalink}', data-id='#{page._id}', data-qrcode=qrcode(page.permalink))= __('shareto')
include _partial/tag
include _partial/post_nav
if theme.duoshuo
Expand Down
10 changes: 5 additions & 5 deletions source/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1803,21 +1803,21 @@ table {
}
}

.article-share-wechat {
.article-share-qrcode {
@extend .article-share-element;
&:before {
content: "\f1d7";
content: "\f029";
}
&:hover {
&:hover, &:active {
background: #38ad5a;
&~ .wechat-qrcode {
&~ .qrcode {
display: block;
text-align: center;
}
}
}

.wechat-qrcode {
.qrcode {
display: none;
}

Expand Down
11 changes: 6 additions & 5 deletions source/js/share.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

var $this = $(this),
url = $this.attr('data-url'),
qrcode_img = $this.attr('data-qrcode'),
encodedUrl = encodeURIComponent(url),
id = 'article-share-box-' + $this.attr('data-id'),
title = document.title,
Expand All @@ -25,11 +26,11 @@
'<div id="' + id + '" class="article-share-box">',
'<input class="article-share-input" value="' + url + '">',
'<div class="article-share-links">',
'<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
'<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
'<a href="http://service.weibo.com/share/share.php?title=' + title + '&url=' + encodedUrl + '&searchPic=true&style=number' + '" class="article-share-weibo" target="_blank" title="Weibo"></a>',
'<a href="javascript:void(0);" class="article-share-wechat" target="_blank" title="Wechat"></a>',
'<div class="wechat-qrcode"><img src="http://s.jiathis.com/qrcode.php?url=' + encodedUrl + '"></div>',
'<a href="//twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
'<a href="//www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
'<a href="//service.weibo.com/share/share.php?title=' + title + '&url=' + encodedUrl + '&searchPic=true&style=number' + '" class="article-share-weibo" target="_blank" title="Weibo"></a>',
'<a href="' + qrcode_img + '" class="article-share-qrcode" target="_blank" title="QR code"></a>',
'<div class="qrcode"><img src=' + qrcode_img + '></div>',
'</div>',
'</div>'
].join('');
Expand Down