Commit d6354ff1 authored by Van's avatar Van

🎨 add share comment

parent 92862ed3
<#--
Solo - A small and beautiful blogging system written in Java.
Copyright (c) 2010-2019, b3log.org & hacpai.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<div class="article__share"
data-title="${article.articleTitle}"
data-blogtitle="${blogTitle}"
data-url="${servePath}${article.articlePermalink}"
data-avatar="${article.authorThumbnailURL}">
<span class="item" data-type="qqz">
<svg viewBox="0 0 32 32" width="100%" height="100%">
<path d="M22.824 13.989l-8.348 6.287s3.351 0.522 8.404 0.461l-0.23-1.040 7.2-6.549c0.132-0.12 0.183-0.312 0.129-0.487s-0.203-0.299-0.377-0.314l-9.492-0.856-3.708-9.213c-0.068-0.169-0.226-0.279-0.401-0.279s-0.333 0.11-0.401 0.279l-3.708 9.213-9.492 0.856c-0.174 0.015-0.323 0.139-0.377 0.314s-0.004 0.366 0.129 0.487l7.2 6.549-2.158 9.742c-0.040 0.178 0.026 0.365 0.168 0.474 0.142 0.107 0.331 0.115 0.481 0.021l8.158-5.165 8.158 5.165c0.070 0.045 0.147 0.066 0.225 0.066 0.090 0 0.18-0.029 0.256-0.086 0.142-0.109 0.208-0.295 0.168-0.474l-1.707-7.704c0.732-0.386 1.538-1.040 1.538-1.040s-3.195 1.638-14.664 0.838l8.312-6.325s-0.327-0.534-10.744-0.914c-0.697-0.026 8.493-1.83 15.281-0.305z"></path>
</svg>
</span>
<span class="item" data-type="wechat">
<svg viewBox="0 0 32 32" width="100%" height="100%">
<path d="M9.062 9.203c0-0.859-0.562-1.422-1.422-1.422-0.844 0-1.703 0.562-1.703 1.422 0 0.844 0.859 1.406 1.703 1.406 0.859 0 1.422-0.562 1.422-1.406zM20.672 17.125c0-0.562-0.562-1.125-1.422-1.125-0.562 0-1.125 0.562-1.125 1.125 0 0.578 0.562 1.141 1.125 1.141 0.859 0 1.422-0.562 1.422-1.141zM16.984 9.203c0-0.859-0.562-1.422-1.406-1.422-0.859 0-1.703 0.562-1.703 1.422 0 0.844 0.844 1.406 1.703 1.406 0.844 0 1.406-0.562 1.406-1.406zM26.906 17.125c0-0.562-0.578-1.125-1.422-1.125-0.562 0-1.125 0.562-1.125 1.125 0 0.578 0.562 1.141 1.125 1.141 0.844 0 1.422-0.562 1.422-1.141zM22.75 10.922c-0.359-0.047-0.719-0.063-1.094-0.063-5.375 0-9.625 4.016-9.625 8.953 0 0.828 0.125 1.625 0.359 2.375-0.359 0.031-0.703 0.047-1.063 0.047-1.422 0-2.547-0.281-3.969-0.562l-3.953 1.984 1.125-3.406c-2.828-1.984-4.531-4.547-4.531-7.656 0-5.391 5.094-9.625 11.328-9.625 5.563 0 10.453 3.391 11.422 7.953zM32 19.687c0 2.547-1.688 4.813-3.969 6.516l0.859 2.828-3.109-1.703c-1.141 0.281-2.281 0.578-3.406 0.578-5.391 0-9.625-3.688-9.625-8.219s4.234-8.219 9.625-8.219c5.094 0 9.625 3.688 9.625 8.219z"></path>
</svg>
</span>
<span class="item" data-type="weibo">
<svg viewBox="0 0 32 32" width="100%" height="100%">
<path d="M13.444 27.064c-5.3 0.525-9.875-1.875-10.219-5.35-0.344-3.481 3.675-6.719 8.969-7.244 5.3-0.525 9.875 1.875 10.212 5.35 0.35 3.481-3.669 6.725-8.963 7.244zM24.038 15.521c-0.45-0.137-0.762-0.225-0.525-0.819 0.512-1.287 0.563-2.394 0.006-3.188-1.038-1.481-3.881-1.406-7.137-0.037 0 0-1.025 0.444-0.762-0.363 0.5-1.613 0.425-2.956-0.356-3.737-1.769-1.769-6.469 0.069-10.5 4.1-3.013 3.006-4.763 6.212-4.763 8.981 0 5.287 6.787 8.506 13.425 8.506 8.7 0 14.494-5.056 14.494-9.069 0-2.431-2.044-3.806-3.881-4.375z"></path>
<path d="M29.819 5.833c-2.1-2.331-5.2-3.219-8.063-2.612v0c-0.663 0.144-1.081 0.794-0.938 1.45 0.144 0.662 0.788 1.081 1.45 0.938 2.038-0.431 4.238 0.2 5.731 1.856s1.9 3.913 1.256 5.888v0c-0.206 0.644 0.144 1.331 0.788 1.544 0.644 0.206 1.331-0.144 1.544-0.787v-0.006c0.9-2.762 0.331-5.938-1.769-8.269z"></path>
<path d="M26.588 8.752c-1.025-1.138-2.538-1.569-3.925-1.269-0.569 0.119-0.931 0.688-0.813 1.256 0.125 0.569 0.688 0.931 1.25 0.806v0c0.681-0.144 1.419 0.069 1.919 0.619 0.5 0.556 0.637 1.313 0.419 1.975v0c-0.175 0.55 0.125 1.15 0.681 1.331 0.556 0.175 1.15-0.125 1.331-0.681 0.438-1.356 0.163-2.906-0.863-4.037z"></path>
<path d="M13.738 20.771c-0.188 0.319-0.594 0.469-0.912 0.337-0.319-0.125-0.412-0.488-0.231-0.794 0.188-0.306 0.581-0.456 0.894-0.337 0.313 0.113 0.425 0.469 0.25 0.794zM12.044 22.933c-0.512 0.819-1.613 1.175-2.438 0.8-0.813-0.369-1.056-1.319-0.544-2.119 0.506-0.794 1.569-1.15 2.388-0.806 0.831 0.356 1.1 1.3 0.594 2.125zM13.969 17.146c-2.519-0.656-5.369 0.6-6.463 2.819-1.119 2.262-0.037 4.781 2.506 5.606 2.638 0.85 5.75-0.456 6.831-2.894 1.069-2.394-0.262-4.85-2.875-5.531z"></path>
</svg>
</span>
<span class="item" data-type="twitter">
<svg viewBox="0 0 32 32" width="100%" height="100%">
<path d="M32.003 6.075c-1.175 0.525-2.444 0.875-3.769 1.031 1.356-0.813 2.394-2.1 2.887-3.631-1.269 0.75-2.675 1.3-4.169 1.594-1.2-1.275-2.906-2.069-4.794-2.069-3.625 0-6.563 2.938-6.563 6.563 0 0.512 0.056 1.012 0.169 1.494-5.456-0.275-10.294-2.888-13.531-6.862-0.563 0.969-0.887 2.1-0.887 3.3 0 2.275 1.156 4.287 2.919 5.463-1.075-0.031-2.087-0.331-2.975-0.819 0 0.025 0 0.056 0 0.081 0 3.181 2.263 5.838 5.269 6.437-0.55 0.15-1.131 0.231-1.731 0.231-0.425 0-0.831-0.044-1.237-0.119 0.838 2.606 3.263 4.506 6.131 4.563-2.25 1.762-5.075 2.813-8.156 2.813-0.531 0-1.050-0.031-1.569-0.094 2.913 1.869 6.362 2.95 10.069 2.95 12.075 0 18.681-10.006 18.681-18.681 0-0.287-0.006-0.569-0.019-0.85 1.281-0.919 2.394-2.075 3.275-3.394z"></path>
</svg>
</span>
<span class="item__qr"></span>
</div>
\ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.1.0.1, Mar 6, 2019 * @version 2.2.0.0, Mar 28, 2019
*/ */
var Page = function (tips) { var Page = function (tips) {
this.currentCommentId = '' this.currentCommentId = ''
...@@ -28,6 +28,52 @@ var Page = function (tips) { ...@@ -28,6 +28,52 @@ var Page = function (tips) {
} }
$.extend(Page.prototype, { $.extend(Page.prototype, {
share: function () {
var $this = $('.article__share')
if ($this.length === 0) {
return
}
var $qrCode = $this.find('.item__qr')
var shareURL = $this.data('url')
var avatarURL = $this.data('avatar')
var title = encodeURIComponent($this.data('title') + ' - ' +
$this.data('blogtitle'))
var url = encodeURIComponent(shareURL)
var urls = {}
urls.tencent = 'http://share.v.t.qq.com/index.php?c=share&a=index&title=' +
title +
'&url=' + url + '&pic=' + avatarURL
urls.weibo = 'http://v.t.sina.com.cn/share/share.php?title=' +
title + '&url=' + url + '&pic=' + avatarURL
urls.qqz = 'https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='
+ url + '&sharesource=qzone&title=' + title + '&pics=' + avatarURL
urls.twitter = 'https://twitter.com/intent/tweet?status=' + title + ' ' +
url
$this.find('span').click(function () {
var key = $(this).data('type')
if (!key) {
return
}
if (key === 'wechat') {
if ($qrCode.find('canvas').length === 0) {
$qrCode.qrcode({
width: 128,
height: 128,
text: shareURL,
})
} else {
$qrCode.slideToggle()
}
return false
}
window.open(urls[key], '_blank', 'top=100,left=200,width=648,height=618')
})
},
/* /*
* @description 把评论中的标识替换为图片 * @description 把评论中的标识替换为图片
* @param {Dom} selector * @param {Dom} selector
...@@ -65,7 +111,8 @@ $.extend(Page.prototype, { ...@@ -65,7 +111,8 @@ $.extend(Page.prototype, {
if (!$('#soloEditorComment').hasClass('vditor')) { if (!$('#soloEditorComment').hasClass('vditor')) {
var that = this var that = this
Util.addScript(Label.staticServePath + '/js/lib/vditor-1.1.10/index.min.js', 'vditorScript') Util.addScript(Label.staticServePath +
'/js/lib/vditor-1.1.10/index.min.js', 'vditorScript')
window.vditor = new Vditor('soloEditorComment', { window.vditor = new Vditor('soloEditorComment', {
placeholder: that.tips.commentContentCannotEmptyLabel, placeholder: that.tips.commentContentCannotEmptyLabel,
height: 180, height: 180,
...@@ -88,7 +135,7 @@ $.extend(Page.prototype, { ...@@ -88,7 +135,7 @@ $.extend(Page.prototype, {
enable: true, enable: true,
style: Label.hljsStyle, style: Label.hljsStyle,
}, },
parse: function(element) { parse: function (element) {
if (element.style.display === 'none') { if (element.style.display === 'none') {
return return
} }
......
Subproject commit 5fbe279bcdba86cb5bb79e748584443088bcf69f Subproject commit 59450e32189e8289e2fa232a9a7ee86ae03d6811
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment