这是分享按钮:
<buttononclick="call()">通用分享</button>
<buttononclick="call('wechatFriend')">微信好友</button>
<buttononclick="call('wechatTimeline')">朋友圈</button>
<buttononclick="call('qqFriend')">QQ</button>
<buttononclick="call('qZone')">QQ空间</button>
<buttononclick="call('weibo')">微博</button>
这是js调用代码:
<scripttype="text/javascript"src="NativeShare.js"></script>
<scripttype="text/javascript">
varnativeShare=newNativeShare()
varshareData={
title:'分享标题',
desc:'',
//如果是微信该link的域名必须要在微信后台配置的安全域名之内的。
link:'https://www.baidu.com',
icon:'https://www.baidu.com',
//不要过于依赖以下两个回调,很多浏览器是不支持的
success:function(){
console.log("success")
},
fail:function(){
console.log("fail")
}
}
nativeShare.setShareData(shareData)
functioncall(command){
try{
nativeShare.call(command)
}catch(err){
//如果不支持,你可以在这里做降级处理
alert(err.message)
//console.log("err.message")
}
}
</script>
这个就是分享js文件NativeShare.js:
!function(e,t){
"object"==typeofexports&&"object"==typeofmodule?module.exports=t():
"function"==typeofdefine&&define.amd?define([],t):
"object"==typeofexports?exports["NativeShare.js"]=t():
e["NativeShare.js"]=t(
)}
(this,function(){
returnfunction(e){
functiont(r){
if(n[r])returnn[r].exports;
varo=n[r]={i:r,l:!1,exports:
{
}
};
returne[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}varn={};
returnt.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{
configurable:!1,enumerable:!0,get:r})},
t.n=function(e){
varn=e&&e.__esModule?function(){
returne.default}:function(){returne};
returnt.d(n,"a",n),n},
t.o=function(e,t){
returnObject.prototype.hasOwnProperty.call(e,t)
},t.p="",t(t.s=0)
}
([function(e,t,n){"usestrict";
functionr(){}
functiono(e){
vart=arguments.length>1&&void0!==arguments[1]?arguments[1]:r,n=document.getElementsByTagName("script")[0],o=document.createElement("script");
o.src=e,o.async=!0,n.parentNode.insertBefore(o,n),o.onload=t
}
functioni(e,t){if(null==e)thrownewTypeError("Cannotconvertundefinedornulltoobject");
for(varn=Object(e),r=1;r<arguments.length;r++){
varo=arguments[r];
if(null!=o)
for(variino)Object.prototype.hasOwnProperty.call(o,i)&&(n[i]=o[i])
}
returnn
}
functiona(e){
if(se)
location.href=e;
else{
vart=document.createElement("iframe");
t.style.display="none",
t.src=e,document.body.appendChild(t),
setTimeout(function(){
t&&t.parentNode&&t.parentNode.removeChild(t)},2e3)}}
functionc(e){
vart=arguments.length>1&&void0!==arguments[1]&&arguments[1],n=[];
for(varrine)t?n.push(r+"="+encodeURIComponent(e[r])):n.push(r+"="+e[r]);
returnn.join("&")}
functionu(e){
vart=document.createElement("a");
returnt.href=e,t.hostname}
functionl(e){
Oe?Oe.content=e:document.head.insertAdjacentHTML("beforeend",'<metaname="description"content="'+e+'">')
}
functionf(e){
je?je.href=e:document.head.insertAdjacentHTML("beforeend",'<linkrel="shortcuticon"href="'+e+'">')
}
functions(e){
document.title=e
}
functionp(e)
{
returnc({share_id:924053302,url:_e.encode(e.link),
title:_e.encode(e.title),
description:_e.encode(e.desc),
previewimageUrl:_e.encode(e.icon),image_url:_e.encode(e.icon)})
}
functionh(){
a((se?"mqqapi://share/to_fri?src_type=web&version=1&file_type=news":"mqqapi://share/to_fri?src_type=isqqBrowser&version=1&file_type=news")+"&"+p(Se))
}
functionb(){
a((se?"mqqapi://share/to_fri?file_type=news&src_type=web&version=1&generalpastboard=1&shareType=1&cflag=1&objectlocation=pasteboard&callback_type=scheme&callback_name=QQ41AF4B2A":"mqqapi://share/to_qzone?src_type=isqqBrowser&version=1&file_type=news&req_type=1")+"&"+p(Se))
}
functiony(){
vare={url:Se.link,title:Se.title,pic:Se.icon,desc:Se.desc};
location.href="
functiond(){
vare={url:Se.link,title:Se.title,pic:Se.icon};
location.href="
functionw(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionv(e,t,n){
returntine?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e
}
functiong(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionm(e,t){
if(!e)
thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t}
function_(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,
{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionO(e,t,n){
returntine?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}
functionj(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionS(e,t){
if(!e)
thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionk(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionP(e,t,n){
returntine?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e
}
functionC(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionq(e,t){
if(!e)
thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionT(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionE(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionD(e,t){
if(!e)
thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionx(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionQ(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionM(e,t){
if(!e)
thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionN(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionA(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionU(e,t){
if(!e)
thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionB(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionR(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionW(e,t){
if(!e)thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionI(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionz(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionF(e,t){
if(!e)thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionL(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionZ(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionJ(e,t){
if(!e)
thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionH(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionX(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionG(e,t){
if(!e)
thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionK(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionV(e,t){
if(!(einstanceoft))thrownewTypeError("Cannotcallaclassasafunction")
}
functionY(e,t){
if(!e)thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
function$(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionee(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionte(e,t){
if(!e)
thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionne(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
functionre(e,t){
if(!(einstanceoft))
thrownewTypeError("Cannotcallaclassasafunction")
}
functionoe(e,t){
if(!e)thrownewReferenceError("thishasn'tbeeninitialised-super()hasn'tbeencalled");
return!t||"object"!=typeoft&&"function"!=typeoft?e:t
}
functionie(e,t){
if("function"!=typeoft&&null!==t)
thrownewTypeError("Superexpressionmusteitherbenullorafunction,not"+typeoft);
e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),
t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)
}
Object.defineProperty(t,"__esModule",{value:!0});
varae,
ce=navigator.userAgent,
ue=/(iPad).*OS\s([\d_]+)/.test(ce),
le=/(iPod)(.*OS\s([\d_]+))?/.test(ce),
fe=!ue&&/(iPhone\sOS)\s([\d_]+)/.test(ce),
se=ue||le||fe,pe=/(Android);
?[\s\/]+([\d.]+)?/.test(ce),
he=/micromessenger/i.test(ce),
be=/QQ\/([\d\.]+)/.test(ce),
ye=/Qzone\//.test(ce),
de=/MQQBrowser/i.test(ce)&&!he&&!be,
we=/UCBrowser/i.test(ce),
ve=/mobile.*baidubrowser/i.test(ce),
ge=/SogouMobileBrowser/i.test(ce),
me=/baiduboxapp/i.test(ce),
_e={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode:function(e){
vart,n,r,o,i,a,c,u="",l=0;
for(e=_e._utf8_encode(e);l<e.length;)
t=e.charCodeAt(l++),
n=e.charCodeAt(l++),
r=e.charCodeAt(l++),
o=t>>2,i=(3&t)<<4|n>>4,a=(15&n)<<2|r>>6,
c=63&r,
isNaN(n)?a=c=64:isNaN(r)&&(c=64),
u=u+this._keyStr.charAt(o)+this._keyStr.charAt(i)+this._keyStr.charAt(a)+this._keyStr.charAt(c);
returnu
},
_utf8_encode:
function(e){
e=e.replace(/\r\n/g,"\n");
for(vart="",n=0;n<e.length;n++){
varr=e.charCodeAt(n);
r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),
t+=String.fromCharCode(63&r|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),
t+=String.fromCharCode(63&r|128))}returnt
}
},
Oe=document.querySelector("meta[name=description]"),
je=document.querySelector("link[rel*=icon]"),
Se={link:location.href,title:function(){returndocument.title}(),
desc:function(){
returnObject(Oe).content||""}(),
icon:function(){
returnObject(je).href||location.protocol+"//"+location.hostname+"/favicon.ico"}(),
from:"",success:r,fail:r,trigger:r},
ke=function(){
functione(e,t){
for(varn=0;n<t.length;n++){
varr=t[n];
r.enumerable=r.enumerable||!1,
r.configurable=!0,
"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
Pe=function(){
functione(t){
w(this,e),
this._shareData=Se,
this._config={syncDescToTag:!1,syncIconToTag:!1,syncTitleToTag:!1},
this.setConfig(t)
}
returnke(e,[{key:"getShareData",
value:function(){
returni({},this._shareData)}},
{
key:"setShareData",
value:function(){
vare=arguments.length>0&&void0!==arguments[0]?arguments[0]:{};
i(this._shareData,e),
this._config.syncDescToTag&&l(this._shareData.desc),
this._config.syncIconToTag&&f(this._shareData.icon),
this._config.syncTitleToTag&&s(this._shareData.title)}},
{
key:"setConfig",
value:function(){
vare=arguments.length>0&&void0!==arguments[0]?arguments[0]:{};
i(this._config,e)}},{key:"getConfig",
value:function(){
returni({},this._config)}}]),e}(),
Ce=Pe,
qe=function(){
functione(e,t){
for(varn=0;n<t.length;n++){
varr=t[n];
r.enumerable=r.enumerable||!1,
r.configurable=!0,"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
Te=function(e){
functiont(e){
g(this,t);
varn=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));
returno("return_(t,e),qe(t,[{key:"call",
value:function(){
vare=arguments.length>0&&void0!==arguments[0]?arguments[0]:"default",t=arguments[1];
this.setShareData(t);
varn=this.getShareData(),
r=this.constructor.commamdMap[String(e).toLowerCase()];
browser.app.share({title:n.title,description:n.desc,url:n.link,img_url:n.icon,from:n.from,to_app:r})}}]),t}(Ce);
Te.commamdMap=(ae={},
v(ae,"wechattimeline",8),
v(ae,"wechatfriend",1),
v(ae,"qqfriend",4),
v(ae,"qzone",3),
v(ae,"weibo",11),
v(ae,"copyurl",10),
v(ae,"more",5),
v(ae,"generateqrcode",7),
v(ae,"default",void0),ae);
varEe,De=Te,
xe=function(){functione(e,t){
for(varn=0;n<t.length;n++){
varr=t[n];
r.enumerable=r.enumerable||!1,
r.configurable=!0,
"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
Qe=function(e){
functiont(e){
returnj(this,t),
S(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}returnk(t,e),
xe(t,[{key:"call",value:function(){
vare=arguments.length>0&&void0!==arguments[0]?arguments[0]:"default",
t=arguments[1];
this.setShareData(t);
varn=this.getShareData(),
r=this.constructor.commamdMap[String(e).toLowerCase()];
ucbrowser.web_shareEX?ucbrowser.web_shareEX(JSON.stringify({title:n.title,content:n.desc,sourceUrl:n.link,imageUrl:n.icon,source:n.from,target:r})):ucbrowser.web_share(title,desc,link,r,"",from,"")}}]),t}(Ce);
Qe.commamdMap=(
Ee={},
O(Ee,"wechattimeline","kWeixinFriend"),
O(Ee,"wechatfriend","kWeixin"),
O(Ee,"qqfriend","kQQ"),
O(Ee,"qzone","kQZone"),
O(Ee,"weibo","kSinaWeibo"),
O(Ee,"default",void0),Ee);
varMe,Ne=Qe,Ae=function(){
functione(e,t){for(varn=0;n<t.length;n++){varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
Ue=function(e){
functiont(e){
returnC(this,t),q(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))
}
returnT(t,e),Ae(t,[{key:"call",
value:function(){
vare=arguments.length>0&&void0!==arguments[0]?arguments[0]:"default",
t=arguments[1];
this.setShareData(t);
varn=this.getShareData(),
r=this.constructor.commamdMap[String(e).toLowerCase()];
ucweb.startRequest("shell.page_share",[n.title,n.desc,n.link,r,"",n.from,n.icon])}}]),t}(Ce);
Ue.commamdMap=(Me={},P(Me,"wechattimeline","WechatTimeline"),
P(Me,"wechatfriend","WechatFriends"),
P(Me,"qqfriend","QQ"),P(Me,"qzone","Qzone"),
P(Me,"weibo","SinaWeibo"),
P(Me,"default",""),Me);
varBe=Ue,
Re=function(){
functione(e,t){for(varn=0;n<t.length;n++){
varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}
}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
We=function(e){
functiont(e){
returnE(this,t),
D(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}returnx(t,e),
Re(t,[{key:"call",
value:function(e,t){
this.setShareData(t);
varn=this.getShareData();
_flyflowNative.exec("bd_utils","shareWebPage",JSON.stringify({title:n.title,content:n.desc,landurl:n.link,imageurl:n.icon,shareSource:n.from}),"")}}]),t}(Ce),
Ie=We,
ze=function(){
functione(e,t){
for(varn=0;n<t.length;n++){
varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
Fe=function(e){
functiont(e){
returnQ(this,t),
M(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}
returnN(t,e),
ze(t,[{key:"call",value:function(e,t){
this.setShareData(t);
varn=this.getShareData();
location.href="baidubrowserapp://bd_utils?action=shareWebPage¶ms="+encodeURIComponent(JSON.stringify({title:n.title,content:n.desc,imageurl:n.icon,landurl:n.link,mediaType:0,share_type:"webpage"}))}}]),t}(Ce),
Le=Fe,
Ze=function(){functione(e,t){
for(varn=0;n<t.length;n++){
varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
Je=function(e){
functiont(e){
returnA(this,t),U(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}
returnB(t,e),Ze(t,[{key:"call",
value:function(e,t){
this.setShareData(t);
varn=this.getShareData();
SogouMse.Utility.shareWithInfo({shareTitle:n.title,shareContent:n.desc,shareImageUrl:n.icon,shareUrl:n.link})}}]),t}(Ce),He=Je,Xe=function(){functione(e,t){
for(varn=0;n<t.length;n++){
varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),Ge=functione(t,n,r){null===t&&(t=Function.prototype);
varo=Object.getOwnPropertyDescriptor(t,n);if(void0===o){vari=Object.getPrototypeOf(t);
returnnull===i?void0:e(i,n,r)
}
if("value"ino)returno.value;
vara=o.get;
if(void0!==a)
returna.call(r)},
Ke=function(e){
functiont(e){R(this,t);
varn=W(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));
returnn.setConfig(e),n}returnI(t,e),Xe(t,[{key:"call",value:function(e,t){this.setShareData(t)}},
{
key:"setConfig",value:function(e){
Ge(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setConfig",this).call(this,e),
this.init(this.getConfig().wechatConfig)}},{key:"init",value:function(e){vart=this;e&&o("
varn=t._shareData,r={};
Object.defineProperty(r,"trigger",{get:function(){
return
function(){i(r,{title:n.title,desc:n.desc,link:n.link,imgUrl:n.icon,type:n.type,
dataUrl:n.dataUrl,success:n.success,fail:n.fail,cancel:n.fail}),n.trigger.apply(n,arguments)}},
set:function(e){n.trigger=e},enumerable:!0}),wx.ready(function(){
wx.onMenuShareAppMessage(r),
wx.onMenuShareQQ(r),
wx.onMenuShareQZone(r),
wx.onMenuShareWeibo(r),
wx.onMenuShareTimeline(r)})})}}]),t}(Ce),
Ve=Ke,
Ye=function(){
functione(e,t){
for(varn=0;n<t.length;n++){varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),
r&&e(t,r),t}}(),
$e=function(e){
functiont(e){
returnz(this,t),F(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}
returnL(t,e),Ye(t,[{key:"call",
value:function(){
vare=arguments.length>0&&void0!==arguments[0]?arguments[0]:"default",t=arguments[1];
if(this.setShareData(t),"weibo"!==(e=String(e).toLowerCase()))
throw"qqfriend"===e?h():"qzone"===e&&b(),
newError("thebrowsermaynotsupportcommand"+e+"!");
d()}}]),t}(Ce),et=$e,
tt=function(){
functione(e,t){
for(varn=0;n<t.length;n++){varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
nt=function(e){
functiont(e){Z(this,t);
varn=J(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));
returnn.init(),n}returnH(t,e),tt(t,[{key:"call",
value:function(){
vare=(arguments.length>0&&void0!==arguments[0]&&arguments[0],arguments[1]);
this.setShareData(e),mqq.ui.showShareMenu()}},{
key:"init",
value:function(){vare=this;o("
function(){
vart=e._shareData;
mqq.ui.setOnShareHandler(function(e){
mqq.ui.shareMessage({back:!0,share_type:e,title:t.title,desc:t.desc,share_url:t.link,
image_url:t.icon,sourceName:t.from},
function(e){
0===e.retCode?t.success(e):t.fail(e)})})})}}]),t}(Ce),
rt=nt,
ot=function(){
functione(e,t){
for(varn=0;n<t.length;n++){varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),it=functione(t,n,r){
null===t&&(t=Function.prototype);
varo=Object.getOwnPropertyDescriptor(t,n);
if(void0===o)
{
vari=Object.getPrototypeOf(t);
returnnull===i?void0:e(i,n,r)}if("value"ino)returno.value;
vara=o.get;
if(void0!==a)returna.call(r)
},
at=function(e){
functiont(e){X(this,t);
varn=G(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));
returnn.init(),n}returnK(t,e),ot(t,[{key:"setShareData",
value:function(e){
it(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setShareData",this).call(this,e);
varn=this.getShareData();
u(n.link)!==location.hostname&&(n.link=location.href,console.warn("安卓的QQ自带浏览器分享url必须跟页面url同一个域名,已自动为你设置为当前页面的url"));
try{mqq.data.setShareInfo({share_url:n.link,title:n.title,desc:n.desc,image_url:n.icon},
function(e){!0!==e&&console.warn(e)})}catch(e){}}},
{key:"call",
value:function(){
vare=(arguments.length>0&&void0!==arguments[0]&&arguments[0],arguments[1]);
this.setShareData(e),mqq.ui.showShareMenu()}},{key:"init",value:function(){vare=this;o("
functione(e,t){
for(varn=0;n<t.length;n++){
varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}
return
function(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
lt=function(e){
functiont(e){
V(this,t);
varn=Y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));
returnn.init(),n}
return$(t,e),
ut(t,[{key:"call",value:function(){
vare=this,
t=(arguments.length>0&&void0!==arguments[0]&&arguments[0],arguments[1]);
this.setShareData(t);
for(varn=this.getShareData(),r=[],o=[],i=[],a=[],c=0;c<5;c++)
r.push(n.icon),
a.push(n.link),
o.push(n.title),
i.push(n.desc);
QZAppExternal.setShare(
function(t){0!=t.code&&(e.hasSomethingWrong=!0)},{type:"share",image:r,title:o,summary:i,shareURL:a})}},{key:"setShareData",value:function(e){
try{this.call("default",e)}catch(e){}}},{key:"init",value:function(){
vare=this;o("
function(){
e.call("default")})}}]),t}(Ce),
ft=lt,
st=function(){
functione(e,t){
for(varn=0;n<t.length;n++){
varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
pt=function(e){
functiont(e){returnee(this,t),te(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}
returnne(t,e),
st(t,[{key:"call",
value:function(e,t){
this.setShareData(t);
varn=this.getShareData();
window.NativeShareFailCallback=n.fail,window.NativeShareSuccessCallback=n.success,
location.href="baiduboxapp://callShare?"+["options="+encodeURIComponent(JSON.stringify({title:n.title,imageUrl:"",mediaType:"all",
content:n.desc,linkUrl:n.link,iconUrl:n.icon})),"errorcallback=window.NativeShareFailCallback","successcallback=window.NativeShareSuccessCallback"].join("&")}}]),t}(Ce),
ht=pt,
bt=function(){functione(e,t){
for(varn=0;n<t.length;n++){
varr=t[n];
r.enumerable=r.enumerable||!1,r.configurable=!0,"value"inr&&(r.writable=!0),
Object.defineProperty(e,r.key,r)}}
returnfunction(t,n,r){
returnn&&e(t.prototype,n),r&&e(t,r),t}}(),
yt=function(e){
functiont(e){returnre(this,t),
oe(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}
returnie(t,e),
bt(t,[{key:"call",
value:function(e,t){
this.setShareData(t);
varn=this.getShareData();
window.NativeShareFailCallback=n.fail,window.NativeShareSuccessCallback=n.success,prompt("BdboxApp:"+JSON.stringify({obj:"Bdbox_android_utils",func:"callShare",args:['{\n
imageUrl:"",\n
mediaType:"all",\n
title:"'+n.title+'",\n
content:"'+n.desc+'",\n
linkUrl:"'+n.link+'",\n
iconUrl:"'+n.icon+'"\n
}',"window.NativeShareSuccessCallback","window.NativeShareFailCallback"]}))}}]),t}(Ce),dt=yt;
n.d(t,"Share",function(){returnCe}),
n.d(t,"QQMobileBrowser",function(){returnDe}),
n.d(t,"UCIosBrowser",function(){returnNe}),
n.d(t,"UCAndroidBrowser",function(){returnBe}),
n.d(t,"BaiduAndroidBrowser",function(){returnIe}),
n.d(t,"BaiduIosBrowser",function(){returnLe}),
n.d(t,"SogouIosBrowser",function(){returnHe}),
n.d(t,"BaiduIos",function(){returnht}),
n.d(t,"BaiduAndroid",function(){returndt}),
n.d(t,"Wechat",function(){returnVe}),
n.d(t,"Others",function(){returnet}),
n.d(t,"QQIos",function(){returnrt}),
n.d(t,"QQAndroid",function(){returnct}),
n.d(t,"QZone",function(){returnft}),
n.d(t,"shareToQQ",
function(){
returnh}),
n.d(t,"shareToQZone",function(){returnb}),
n.d(t,"shareToWeibo4Web",function(){returnd}),
n.d(t,"shareToQZone4Web",
function(){returny});
varwt=void0;
wt=he?Ve:be&&se?rt:be&&pe?ct:ye?ft:de?De:we&&se?Ne:we&&pe?Be:ve&&pe?Ie:ve&&se?Le:ge&&se?He:me&&se?ht:me&&pe?dt:et,window.NativeShare=wt,t.default=wt}])});


本文转载自中文网
如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h55103.shtml