var nativeShare = function (elementNode, config) { if (!document.getElementById(elementNode)) { return false; } var qApiSrc = { lower: "http://3gimg.qq.com/html5/js/qb.js", higher: "http://jsapi.qq.com/get?api=app.share" }; var bLevel = { qq: {forbid: 0, lower: 1, higher: 2}, uc: {forbid: 0, allow: 1} }; var UA = navigator.appVersion; var isqqBrowser = (UA.split("MQQBrowser/").length > 1) ? bLevel.qq.higher : bLevel.qq.forbid; var isucBrowser = (UA.split("UCBrowser/").length > 1) ? bLevel.uc.allow : bLevel.uc.forbid; var version = { uc: "", qq: "" }; var isWeixin = false; config = config || {}; this.elementNode = elementNode; this.url = config.url || document.location.href || ''; this.title = config.title || document.title || ''; this.desc = config.desc || document.title || ''; this.img = config.img || document.getElementsByTagName('img').length > 0 && document.getElementsByTagName('img')[0].src || ''; this.img_title = config.img_title || document.title || ''; this.from = config.from || window.location.host || ''; this.ucAppList = { sinaWeibo: ['kSinaWeibo', 'SinaWeibo', 11, '新浪微博'], weixin: ['kWeixin', 'WechatFriends', 1, '微信好友'], weixinFriend: ['kWeixinFriend', 'WechatTimeline', '8', '微信朋友圈'], QQ: ['kQQ', 'QQ', '4', 'QQ好友'], QZone: ['kQZone', 'QZone', '3', 'QQ空间'] }; this.share = function (to_app) { var title = this.title, url = this.url, desc = this.desc, img = this.img, img_title = this.img_title, from = this.from; if (isucBrowser) { to_app = to_app == '' ? '' : (platform_os == 'iPhone' ? this.ucAppList[to_app][0] : this.ucAppList[to_app][1]); if (to_app == 'QZone') { B = "mqqapi://share/to_qzone?src_type=web&version=1&file_type=news&req_type=1&image_url="+img+"&title="+title+"&description="+desc+"&url="+url+"&app_name="+from; k = document.createElement("div"), k.style.visibility = "hidden", k.innerHTML = '', document.body.appendChild(k), setTimeout(function () { k && k.parentNode && k.parentNode.removeChild(k) }, 5E3); } if (typeof(ucweb) != "undefined") { ucweb.startRequest("shell.page_share", [title, title, url, to_app, "", "@" + from, ""]) } else { if (typeof(ucbrowser) != "undefined") { ucbrowser.web_share(title, title, url, to_app, "", "@" + from, '') } else { } } } else { if (isqqBrowser && !isWeixin) { to_app = to_app == '' ? '' : this.ucAppList[to_app][2]; var ah = { url: url, title: title, description: desc, img_url: img, img_title: img_title, to_app: to_app,//微信好友1,腾讯微博2,QQ空间3,QQ好友4,生成二维码7,微信朋友圈8,啾啾分享9,复制网址10,分享到微博11,创意分享13 cus_txt: "请输入此时此刻想要分享的内容" }; ah = to_app == '' ? '' : ah; if (typeof(browser) != "undefined") { if (typeof(browser.app) != "undefined" && isqqBrowser == bLevel.qq.higher) { browser.app.share(ah) } } else { if (typeof(window.qb) != "undefined" && isqqBrowser == bLevel.qq.lower) { window.qb.share(ah) } else { } } } else { } } }; this.html = function() { var position = document.getElementById(this.elementNode); var html = '