Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /www/wwwroot/www.85520057.com/func.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/www.85520057.com/func.php:230) in /www/wwwroot/www.85520057.com/js.php on line 27
/**
* Share.js
*
* @example
*
* $('.share-components').share({
* sites: ['qzone', 'qq', 'weibo','wechat'],
* // ...
* });
* -------------------------------------------
*
*
*/
;(function ($) {
$.fn.share = function ($options) {
var $head = $(document.head);
var $defaults = {
url: location.href,
site_url: location.origin,
source: $head.find('[name=site], [name=Site]').attr('content') || document.title,
title: $head.find('[name=title], [name=Title]').attr('content') || document.title,
description: $head.find('[name=description], [name=Description]').attr('content') || '',
image: $('img:first').prop('src') || '',
imageSelector: undefined,
weiboKey: '',
wechatQrcodeTitle: '微信扫一扫:分享',
wechatQrcodeHelper: '微信里点“发现”,扫一下
二维码便可将本文分享至朋友圈。
',
wechatQrcodeSize: 100,
sites: ['weibo','qq','wechat','douban','qzone','linkedin','facebook','twitter','google'],
disabled: [],
//默认为空,为prepend时可以在分享图标列表末尾预置自定义图标实现其他功能
//
mode: '',
size: 'small',
//type: desk mobiles
type: 'desk',
initialized: false
};
var $globals = $.extend({}, $defaults, $options);
var $templates = {
qzone : 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url={{URL}}&title={{TITLE}}&desc={{DESCRIPTION}}&summary={{SUMMARY}}&site={{SOURCE}}&pics={{IMAGE}}',
qq : 'http://connect.qq.com/widget/shareqq/index.html?url={{URL}}&title={{TITLE}}&source={{SOURCE}}&desc={{DESCRIPTION}}&pics={{IMAGE}}',
weibo : 'https://service.weibo.com/share/share.php?url={{URL}}&title={{TITLE}}&pic={{IMAGE}}&appkey={{WEIBOKEY}}',
wechat : 'javascript:;',
douban : 'http://shuo.douban.com/!service/share?href={{URL}}&name={{TITLE}}&text={{DESCRIPTION}}&image={{IMAGE}}&starid=0&aid=0&style=11',
linkedin : 'http://www.linkedin.com/shareArticle?mini=true&ro=true&title={{TITLE}}&url={{URL}}&summary={{SUMMARY}}&source={{SOURCE}}&armin=armin',
facebook : 'https://www.facebook.com/sharer/sharer.php?u={{URL}}&title={{TITLE}}&description={{DESCRIPTION}}&caption={{SUBHEAD}}&link={{URL}}&picture={{IMAGE}}',
twitter : 'https://twitter.com/intent/tweet?text={{TITLE}}&url={{URL}}&via={{SITE_URL}}',
google : 'https://plus.google.com/share?url={{URL}}'
};
var $ariaLabels = {
qzone: "QQ空间",
qq: "QQ",
weibo: "微博",
wechat: "微信",
douban: "豆瓣",
linkedin: "LinkedIn",
facebook: "Facebook",
twitter: "Twitter",
google: "Google"
};
this.each(function() {
if ($(this).data('initialized')) {
return true;
}
var $data = $.extend({}, $globals, $(this).data());
if ($data.imageSelector) {
$data.image = $($data.imageSelector).map(function() {
return $(this).prop('src');
}).get().join('||');
}
var $container = $(this).addClass('social-share');
if ($data.type == 'desk') {
createIcons($container, $data);
createWechat($container, $data);
} else if ($data.type == 'mobiles') {
createmobiles($container, $data);
}
$(this).data('initialized', true);
});
/**
* 构造手机页面
*/
function createmobiles($container, $data) {
//手机页面调用浏览器通用分享API 须HTTPS 且浏览器支持
if ('https:' == document.location.protocol && window.navigator.share) {
var $linkImg = $('');
$container.append($linkImg);
$container.click(function (e) {
window.navigator.share({
//title:'Test',
url: $data.url,
//text:'Text'
});
});
} else {
$container.hide();
}
}
/**
* 构造分享图标界面
*/
function createIcons ($container, $data) {
var $sites = getSites($data);
if (!$sites.length)
return;
//模式为prepend时 反转网站顺序 使用jQuery.prepend()插入图标连接
$data.mode == 'prepend' ? $sites.reverse() : $sites
var showMore = false;
if ($sites.indexOf('more') > -1)
showMore = true;
if ($data.mode == 'prepend' && showMore)
createMore ($container, $data);
$.each($sites, function (i, $name) {
if ($name == '|') {
var $separator = $('')
$data.mode == 'prepend' ? $container.prepend($separator) : $container.append($separator);
return true;
}
var $url = makeUrl($name, $data);
if ($url == '')
return true;
var $link = $('');
if ($data.size == 'mid') {
$link.append('' + $ariaLabels[$name] + '
');
}
$link.prop('aria-label', "分享到 "+$ariaLabels[$name]);
$link.prop('href', $url);
$name == 'wechat' ? $link.prop('tabindex', -1) : $link.prop('target', '_blank');
$data.mode == 'prepend' ? $container.prepend($link) : $container.append($link);
});
if ($data.mode != 'prepend' && showMore)
createMore ($container, $data);
}
/**
* 构造more按钮及弹窗
*/
function createMore($container, $data) {
var $link = $('');
$link.prop('aria-label', "更多");
if ($data.size == 'mid') {
$link.append('更多
');
}
var $dialog = $('');
var $dialogTop = $('分享到
');
var $closeBtn = $('');
$closeBtn.click(function (e) {
$dialog.hide();
e.stopPropagation();
});
$dialogTop.append($closeBtn);
$dialog.append($dialogTop);
$dialogMid = $('');
$siteContainer = $('');
$.each($defaults.sites, function (i, $name) {
//var $siteBlock = $('');
var $siteBlock = $('');
var $link = $(''+$ariaLabels[$name]+'');
var $url = makeUrl($name, $data);
$link.prop('aria-label', "分享到 "+$ariaLabels[$name]);
$link.prop('href', $url);
$name == 'wechat' ? $link.prop('tabindex', -1) : $link.prop('target', '_blank');
$siteBlock.append($link);
$siteContainer.append($siteBlock);
});
$dialogMid.append($siteContainer);
$dialog.append($dialogMid);
$link.click(function () {
$dialog.show();
});
$container.append($link);
$container.append($dialog);
}
/**
* 构造微信分享二维码
*/
function createWechat ($container, $data) {
var $wechat = $container.find('a.icon-wechat,a.icon-wechat-big');
if (!$wechat.length)
return;
$wechat.append(''+$data.wechatQrcodeTitle+'
'+$data.wechatQrcodeHelper+'
');
$wechat.find('.qrcode').qrcode({render: 'image', size: $data.wechatQrcodeSize, text: $data.url});
// if ($wechat.offset().top < 100) {
// $wechat.find('.wechat-qrcode').addClass('bottom');
// }
}
/**
* 获取分享网站列表
*/
function getSites ($data) {
var $sites = ($data['sites'].length ? $data['sites']: []).slice(0);
var $disabled = $data['disabled'];
if (typeof $sites == 'string')
$sites = $sites.split(/\s*,\s*/);
if (typeof $disabled == 'string')
$disabled = $disabled.split(/\s*,\s*/);
//微信中不显示分享到微信
if (runningInWeChat())
$disabled.push('wechat');
//从网站列表中移除禁用列表
$disabled.length && $.each($disabled, function (i, el) {
var removeItemIndex = $.inArray(el, $sites);
if (removeItemIndex !== -1) {
$sites.splice(removeItemIndex, 1);
}
});
return $sites;
}
/**
* 构造分享Url
*/
function makeUrl ($name, $data) {
var $template = $templates[$name];
if (!$template)
return '';
$data['summary'] = $data['description'];
for (var $key in $data) {
if ($data.hasOwnProperty($key)) {
var $camelCaseKey = $name + $key.replace(/^[a-z]/, function($str){
return $str.toUpperCase();
});
var $value = encodeURIComponent($data[$camelCaseKey] === undefined ? $data[$key] : $data[$camelCaseKey]);
$template = $template.replace(new RegExp('{{'+$key.toUpperCase()+'}}', 'g'), $value);
}
}
return $template;
}
/**
* 是否运行在微信中
*/
function runningInWeChat() {
return /MicroMessenger/i.test(navigator.userAgent);
}
/**
* 是否运行在移动端
*/
function ismobilesScreen () {
return $(window).width() <= 768;
}
};
// 加载share插件
$(function () {
$('.social-share').share();
});
})(jQuery);