This commit is contained in:
@@ -33,6 +33,7 @@ var Finding = {
|
||||
init: function () {
|
||||
Util.killIE();
|
||||
this._initToc();
|
||||
this.share();
|
||||
$(".scroll-down").click(function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -130,20 +131,53 @@ var Finding = {
|
||||
* @returns {undefined}
|
||||
*/
|
||||
share: function () {
|
||||
$(".share span").click(function () {
|
||||
var key = $(this).data("type");
|
||||
var title = encodeURIComponent($("title").text()),
|
||||
url = $(".post-title a").attr('href') ? $(".post-title a").attr('href') : location,
|
||||
pic = $(".post-content img:eq(0)").attr("src");
|
||||
var urls = {};
|
||||
urls.tencent = "http://share.v.t.qq.com/index.php?c=share&a=index&title=" + title +
|
||||
"&url=" + url + "&pic=" + pic;
|
||||
urls.weibo = "http://v.t.sina.com.cn/share/share.php?title=" +
|
||||
title + "&url=" + url + "&pic=" + pic;
|
||||
urls.google = "https://plus.google.com/share?url=" + url;
|
||||
urls.twitter = "https://twitter.com/intent/tweet?status=" + title + " " + url;
|
||||
window.open(urls[key], "_blank", "top=100,left=200,width=648,height=618");
|
||||
});
|
||||
var $this = $('.share')
|
||||
var $qrCode = $this.find('.icon-wechat')
|
||||
var shareURL = $qrCode.data('url')
|
||||
var avatarURL = $qrCode.data('avatar')
|
||||
var title = encodeURIComponent($qrCode.data('title') + ' - ' +
|
||||
$qrCode.data('blogtitle')),
|
||||
url = encodeURIComponent(shareURL)
|
||||
|
||||
var urls = {}
|
||||
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) {
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: latkeConfig.staticServePath +
|
||||
'/skins/Finding/js/jquery.qrcode.min.js',
|
||||
dataType: 'script',
|
||||
cache: true,
|
||||
success: function () {
|
||||
$qrCode.qrcode({
|
||||
width: 128,
|
||||
height: 128,
|
||||
text: shareURL,
|
||||
})
|
||||
},
|
||||
})
|
||||
} else {
|
||||
$qrCode.find('canvas').slideToggle()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
window.open(urls[key], '_blank', 'top=100,left=200,width=648,height=618')
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user