通用分享

通用分享
 首页 > 作文

HTML5实现分享到微信好友朋友圈QQ好友QQ空间微博二维码功能

更新时间:2023-04-03 08:13:39 阅读: 评论:0

这是分享按钮:

<button onclick="call()">通用分享</button><button onclick="call('wechatfriend')">微信好友</button><button onclick="call('wechattimeline')">朋友圈</button><button onclick="call('qqfriend')">qq</button><button onclick="call('qzone')">qq空间</button><button onclick="call('weibo')">微博</button>

这是js调用代码:

<script type="text/javascript" src="nativeshare.js"></script><script type="text/javascript">    var nativeshare = new nativeshare()    var sharedata = {        title: '分享标题',    败犬女王片尾曲    desc: '',        // 如果是微信该link的域名必须要在微信后台配置的安全域名之内的。        link: 'https://www.baidu.com',        icon: 'https://www.baidu.com',        // 不要过于依赖以下两个回调,很多浏览器是不支持的        success: function() {            console.log("success")        },        fail: function() {            console.log("fail")        }    }    nativeshare.tsharedata(sharedata)    function call(command) {        try {            nativeshare.call(command)        } catch (err) {            // 如果不支持,你可以在这里做降级处理            alert(err.message)            // console.log("err.message")        }    }</script>

这个就是分享js文件nativeshare.js:

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["nativeshare.js"]=t():e["nativeshare.js"]=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.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){var n=e&&e.__esmodule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return object.prototype.hasownproperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"u strict";function r(){}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r,n=document.getelementsbytagname("script")[0],o=document.createelement("script");o.src=e,o.async=!0,n.parentnode.inrtbefore(o,n),o.onload=t}function i(e,t){if(null==e)throw new typeerror("cannot convert undefined or null to object");for(var n=object(e),r=1;r<arguments.length;r++){var o=arguments[r];if(null!=o)for(var i in o)object.prototype.hasownproperty.call(o,i)&&(n[i]=o[i])}return n}function a(e){if()location.href=e;el{var t=document.createelement("iframe");t.style.display="none",t.src=e,document.body.appendchild(t),ttimeout(function(){t&&t.parentnode&&t.parentnode.removechild(t)},2e3)}}function c(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[];for(var r in e)t?n.push(r+"="+encodeuricomponent(e[r])):n.push(r+"="+e[r]);return n.join("&")}function u(e){var t=document.createelement("a");return t.href=e,t.hostname}function l(e){oe?oe.content=e:document.head.inrtadjacenthtml("beforeend",'<meta name="description" content="'+e+'">')}function f(e){je?je.href=e:document.head.inrtadjacenthtml("beforeend",'<link rel="shortcut icon" href="'+e+'">')}function s(e){document.title=e}function p(e){return c({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)})}function h(){a((?"mqqapi://share/to_fri?src_type=web&version=1&file_type=news":"mqqapi://share/to_fri?src_type=isqqbrowr&version=1&file_type=news")+"&"+p())}function b(){a((?"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=isqqbrowr&version=1&file_type=news&req_type=1")+"&"+p())}function y(){var e={url:.link,title:.title,pic:.icon,desc:.desc};location.href="/d/file/titlepic/cgi_qzshare_onekey d(){var e={url:.link,title:.title,pic:.icon};location.href="http://rvice.weibo.com/share/share.php?"+c(e,!0)}function w(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function v(e,t,n){return t in e?object.defineproperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function m(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function o(e,t,n){return t in e?object.defineproperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j(e,t){if(!(e instanceof t))throw new typeerror("cannot 借条格式call a class as a function")}function s(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function k(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function p(e,t,n){return t in e?object.defineproperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function q(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function t(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function e(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function d(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function x(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function q(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function m(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function n(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function a(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function u(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function b(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:免费商业计划书模板{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function r(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function w(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function z(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function f(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function l(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function z(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function j(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function h(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function x(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function g(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function k(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function v(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function y(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function $(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function ee(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function te(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function ne(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}function re(e,t){if(!(e instanceof t))throw new typeerror("cannot call a class as a function")}function oe(e,t){if(!e)throw new referenceerror("this hasn't been initialid - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function ie(e,t){if("function"!=typeof t&&null!==t)throw new typeerror("super expression must either be null or a function, not "+typeof t);e.prototype=object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(object.tprototypeof?object.tprototypeof(e,t):e.__proto__=t)}object.defineproperty(t,"__esmodule",{value:!0});var ae,ce=navigator.uragent,ue=/(ipad).*os\s([\d_]+)/.test(ce),le=/(ipod)(.*os\s([\d_]+))?/.test(ce),fe=!ue&&/(iphone\sos)\s([\d_]+)/.test(ce),=ue||le||fe,pe=/(android);?[\s\/]+([\d.]+)?/.test(ce),he=/micromesnger/i.test(ce),be=/qq\/([\d\.]+)/.test(ce),ye=/qzone\//.test(ce),de=/mqqbrowr/i.test(ce)&&!he&&!be,we=/ucbrowr/i.test(ce),ve=/mobile.*baidubrowr/i.test(ce),ge=/sogoumobilebrowr/i.test(ce),me=/baiduboxapp/i.test(ce),_e={_keystr:"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t,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);return u},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var t="",n=0;n<e.length;n++){var r=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))}return t}},oe=document.querylector("meta[name=description]"),je=document.querylector("link[rel*=icon]"),={link:location.href,title:function(){return document.title}(),desc:function(){return object(oe).content||""}(),icon:function(){return object(je).href||location.protocol+"//"+location.hostname+"/favicon.ico"}(),from:"",success:r,fail:r,trigger:r},ke=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),pe=function(){function e(t){w(this,e),this._sharedata=,this._config={syncdesctotag:!1,syncicontotag:!1,synctitletotag:!1},this.tconfig(t)}return ke(e,[{key:"getsharedata",value:function(){return i({},this._sharedata)}},{key:"tsharedata",value:function(){var e=arguments.length>0&&void 0!==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:"tconfig",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this._config,e)}},{key:"getconfig",value:function(){return i({},this._config)}}]),e}(),ce=pe,qe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),te=function(e){function t(e){g(this,t);var n=m(this,(t.__proto__||object.getprototypeof(t)).call(this,e));return o("https://jsapi.qq.com/get?api=app.share"),n}return _(t,e),qe(t,[{key:"call",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments[1];this.tsharedata(t);var n=this.getsharedata(),r=this.constructor.commamdmap[string(e).tolowerca()];browr.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",void 0),ae);var ee,de=te,xe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),qe=function(e){function t(e){return j(this,t),s(this,(t.__proto__||object.getprototypeof(t)).call(this,e))}return k(t,e),xe(t,[{key:"call",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments[1];this.tsharedata(t);var n=this.getsharedata(),r=this.constructor.commamdmap[string(e).tolowerca()];ucbrowr.web_shareex?ucbrowr.web_shareex(json.stringify({title:n.title,content:n.desc,sourceurl:n.link,imageurl:n.icon,source:n.from,target:r})):ucbrowr.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",void 0),ee);var me,ne=qe,ae=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),ue=function(e){function t(e){return c(this,t),q(this,(t.__proto__||object.getprototypeof(t)).call(this,e))}return t(t,e),ae(t,[{key:"call",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments[1];this.tsharedata(t);var n=this.getsharedata(),r=this.constructor.commamdmap[string(e).tolowerca()];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);var be=ue,re=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),we=function(e){function t(e){return e(this,t),d(this,(t.__proto__||object.getprototypeof(t)).call(this,e))}return x(t,e),re(t,[{key:"call",value:function(e,t){this.tsharedata(t);var n=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(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),fe=function(e){function t(e){return q(this,t),m(this,(t.__proto__||object.getprototypeof(t)).call(this,e))}return n(t,e),ze(t,[{key:"call",value:function(e,t){this.tsharedata(t);var n=this.getsharedata();location.href="baidubrowrapp://bd_utils?action=sharewebpage&params="+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(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),je=function(e){function t(e){return a(this,t),u(this,(t.__proto__||object.getprototypeof(t)).call(this,e))}return b(t,e),ze(t,[{key:"call",value:function(e,t){this.tsharedata(t);var n=this.getsharedata();sogoum.utility.sharewithinfo({sharetitle:n.title,sharecontent:n.desc,shareimageurl:n.icon,shareurl:n.link})}}]),t}(ce),he=je,xe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),ge=function e(t,n,r){null===t&&(t=function.prototype);var o=object.getownpropertydescriptor(t,n);if(void 0===o){var i=object.getprototypeof(t);return null===i?void 0:e(i,n,r)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(r)},ke=function(e){function t(e){r(this,t);var n=w(this,(t.__proto__||object.getprototypeof(t)).call(this,e));return n.tconfig(e),n}return i(t,e),xe(t,[{key:"call",value:function(e,t){this.tsharedata(t)}},{key:"tconfig",value:function(e){ge(t.prototype.__proto__||object.getprototypeof(t.prototype),"tconfig",this).call(this,e),this.init(this.getconfig().wechatconfig)}},{key:"init",value:function(e){var t=this;e&&o("https://res.wx.qq.com/open/js/jweixin-1.2.0.js",function(){wx.config(i({debug:!1,jsapilist:["onmenusharetimeline","onmenushareappmessage","onmenushareqq","onmenushareweibo","onmenushareqzone"]},e));var n=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)}},t: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(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),$e=function(e){function t(e){return z(this,t),f(this,(t.__proto__||object.getprototypeof(t)).call(this,e))}return l(t,e),ye(t,[{key:"call",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments[1];if(this.tsharedata(t),"weibo"!==(e=string(e).tolowerca()))throw"qqfriend"===e?h():"qzone"===e&&b(),new error("the browr may not support command "+e+"!");d()}}]),t}(ce),et=$e,tt=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),nt=function(e){function t(e){z(this,t);var n=j(this,(t.__proto__||object.getprototypeof(t)).call(this,e));return n.init(),n}return h(t,e),tt(t,[{key:"call",value:function(){var e=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments[1]);this.tsharedata(e),mqq.ui.showsharemenu()}},{key:"init",value:function(){var e=this;o("https://open.mobile.qq.com/sdk/qqapi.js",function(){var t=e._sharedata;mqq.ui.tonsharehandler(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(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),it=function e(t,n,r){null===t&&(t=function.prototype);var o=object.getownpropertydescriptor(t,n);if(void 0===o){var i=object.getprototypeof(t);return null===i?void 0:e(i,n,r)}if("value"in o)return o.value;var a=o.get;if(void 0!==a)return a.call(r)},at=function(e){function t(e){x(this,t);var n=g(this,(t.__proto__||object.getprototypeof(t)).call(this,e));return n.init(),n}return k(t,e),ot(t,[{key:"tsharedata",value:function(e){it(t.prototype.__proto__||object.getprototypeof(t.prototype),"tsharedata",this).call(this,e);var n=this.getsharedata();u(n.link)!==location.hostname&&(n.link=location.href,console.warn("安卓的qq自带浏览器分享url必须跟页面url同一个域名,已自动为你设置为当前页面的url"));try{mqq.data.tshareinfo({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(){var e=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments[1]);this.tsharedata(e),mqq.ui.showsharemenu()}},{key:"init",value:function(){var e=this;o("https://open.mobile.qq.com/sdk/qqapi.js",function(){e.tsharedata()})}}]),t}(ce),ct=at,ut=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.co物质的概念nfigurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),lt=function(e){function t(e){v(this,t);var n=y(this,(t.__proto__||object.getprototypeof(t)).call(this,e));return n.init(),n}return $(t,e),ut(t,[{key:"call",value:function(){var e=this,t=(arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments[1]);this.tsharedata(t);for(var n=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.tshare(function(t){0!=t.code&&(e.hassomethingwrong=!0)},{type:"share",image:r,title:o,summary:i,shareurl:a})}},{key:"tsharedata",value:function(e){try{this.call("default",e)}catch(e){}}},{key:"init",value:function(){var e=this;o("https://qzonestyle.gtimg.cn/qzone/phone/m/v4/widget/mobile/jsbridge.js",function(){e.call("default")})}}]),t}(ce),ft=lt,st=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),pt=function(e){function t(e){return ee(this,t),te(this,(t.__proto__||object.getprototypeof(t)).call(this,e))}return ne(t,e),st(t,[{key:"call",value:function(e,t){this.tsharedata(t);var n=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"].j化学元素周期表顺口溜oin("&")}}]),t}(ce),ht=pt,bt=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),object.defineproperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),yt=function(e){function t(e){return re(this,t),oe(this,(t.__proto__||object.getprototypeof(t)).call(this,e))}return ie(t,e),bt(t,[{key:"call",value:function(e,t){this.tsharedata(t);var n=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(){return ce}),n.d(t,"qqmobilebrowr",function(){return de}),n.d(t,"uciosbrowr",function(){return ne}),n.d(t,"ucandroidbrowr",function(){return be}),n.d(t,"baiduandroidbrowr",function(){return ie}),n.d(t,"baiduiosbrowr",function(){return le}),n.d(t,"sogouiosbrowr",function(){return he}),n.d(t,"baiduios",function(){return ht}),n.d(t,"baiduandroid",function(){return dt}),n.d(t,"wechat",function(){return ve}),n.d(t,"others",function(){return et}),n.d(t,"qqios",function(){return rt}),n.d(t,"qqandroid",function(){return ct}),n.d(t,"qzone",function(){return ft}),n.d(t,"sharetoqq",function(){return h}),n.d(t,"sharetoqzone",function(){return b}),n.d(t,"sharetoweibo4web",function(){return d}),n.d(t,"sharetoqzone4web",function(){return y});var wt=void 0;wt=he?ve:be&&?rt:be&&pe?ct:ye?ft:de?de:we&&?ne:we&&pe?be:ve&&pe?ie:ve&&?le:ge&&?he:me&&?ht:me&&pe?dt:et,window.nativeshare=wt,t.default=wt}])});

参考网址:

https://fa-ge.github.io/nativeshare/demo/index.html

总结

以上所述是www.887551.com给大家介绍的html5实现分享到微信好友朋友圈qq好友qq空间微博二维码功能,希望对大家有所帮助

本文发布于:2023-04-03 08:13:11,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/4ecf8e9668eca51827fa0e2c2631dbd1.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:HTML5实现分享到微信好友朋友圈QQ好友QQ空间微博二维码功能.doc

本文 PDF 下载地址:HTML5实现分享到微信好友朋友圈QQ好友QQ空间微博二维码功能.pdf

标签:这是   好友   不支持   域名
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图
  • 我要关灯
    我要开灯
  • 返回顶部