VUE 项目落地页使用 LinkedME 深度链接服务跳回App
VUE 项目落地页使用 LinkedME 深度链接服务跳回App当前需求: 在微信或者浏览器中打开页面, 需要跳转回对应app;当前实现技术: 使用 LinkedME 深度链接服务实现流程:1。 ios 后台配置及处理相关参数完成2。 javascript 前端调用3。 在项目中,api目录下 引入了linkedme.min.js,同时创建了 linkedme.js , 对初...
·
VUE 项目落地页使用 LinkedME 深度链接服务跳回App
当前需求: 在微信或者浏览器中打开页面, 需要跳转回对应app;
当前实现技术: 使用 LinkedME 深度链接服务
实现流程:
1。 ios 后台配置及处理相关参数完成
2。 javascript 前端调用
3。 在项目中,api目录下 引入了 linkedme.min.js ,同时创建了 linkedme.js , 对初始化LinkedME 初始化及创建进行了封装, 方便在所需页面引入使用。
3.1 linkedme.js 中跟ios拿到 linkedme_key ,并设置 linkedme 对象参数
3.2 导出函数, 由所需功能组件引入
3.3 对组件传入的参数做处理, (注意: 组件使用参数为字符类型)
4。 组件使用
4.1 在页面中准备 a 表标签, 绑定href, 在 mounted 钩子中, 使用引入的 linkedmeLink 处理后, 返回了 LinkedME 服务端所需的参数
4.2 赋值给 href, 完成调用
linkedme.js
let linkedmePromise =
import('./linkedme.min.js')
var hosts = EnvSupport.env.API_SERVER.split("//")[1].split('.')[0];
var linkedmeType = "live";
// 以下判断是自己判定了环境, 用来测试的, 需要的同学干掉就好了
if (EnvSupport.env.API_SERVER == 'test2' || EnvSupport.env.API_SERVER == 'rc') {
linkedmeType = "test";
}
let defaultData = {};
defaultData.type = linkedmeType; //表示现在使用线上模式,如果填写"test", 表示测试模式.【可选】
defaultData.feature = "功能名称"; // 自定义深度链接功能,多个用逗号分隔,【可选】
defaultData.stage = "阶段名称"; // 自定义深度链接阶段,多个用逗号分隔,【可选】
defaultData.channel = "渠道名称"; // 自定义深度链接渠道,多个用逗号分隔,【可选】
defaultData.tags = "标签名称"; // 自定义深度链接标签,多个用逗号分隔,【可选】
defaultData.ios_custom_url = ""; // 自定义iOS平台下App的下载地址,如果是AppStore的下载地址可以不用填写,
defaultData.android_custom_url = ""; // 自定义安卓平台下App的下载地址,【可选】
// 下面是自定义深度链接参数,用户点击深度链接打开app之后,params参数将被带入app
// 比如详情页面的参数,可以写进去,这样唤起app后可直接跳转到详情页【可选】
export default async function (para) {
await linkedmePromise
if (linkedme.LinkedME_KEY !== "e8a88452ee127077067d2eaf264") {
linkedme.init("e8a88452ec1b87077067d2eaf264", {
type: linkedmeType
}, null);
}
para = para || {}
let str = '';
for (let k in para) {
str += `"${k}":"${para[k]}",`
}
str = str.slice(0, -1)
let params = `{${str}}`
return new Promise((resolve, reject) => {
// console.log({
// ...defaultData,
// ...{params: params},
// })
let datas = {
...defaultData,
...{
params: params
}
};
linkedme.link(datas, function (err, data) {
if (err) {
// 生成深度链接失败,返回错误对象err
let s = err;
s = JSON.parse(s);
reject(err)
} else {
/*
生成深度链接成功,深度链接可以通过data.url得到,
将深度链接绑定到<a>标签,这样当用户点击这
个深度链接,如果是在pc上,那么跳转到深度链接二维
码页面,用户用手机扫描该二维码就会打开app;如果
在移动端,深度链接直接会根据手机设备类型打开ios
或者安卓app
*/
resolve(data)
}
}, false);
});
}
linkedme.min.js
// 你最好去自己官网下载
!function(){"use strict";var a={key_str:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var i,n,o,r,t,s,a,d="",l=0;for(e=this._utf8_encode(e);l<e.length;)r=(i=e.charCodeAt(l++))>>2,t=(3&i)<<4|(n=e.charCodeAt(l++))>>4,s=(15&n)<<2|(o=e.charCodeAt(l++))>>6,a=63&o,isNaN(n)?s=a=64:isNaN(o)&&(a=64),d=d+this.key_str.charAt(r)+this.key_str.charAt(t)+this.key_str.charAt(s)+this.key_str.charAt(a);return d},decode:function(e){var i,n,o,r,t,s,a="",d=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");d<e.length;)i=this.key_str.indexOf(e.charAt(d++))<<2|(r=this.key_str.indexOf(e.charAt(d++)))>>4,n=(15&r)<<4|(t=this.key_str.indexOf(e.charAt(d++)))>>2,o=(3&t)<<6|(s=this.key_str.indexOf(e.charAt(d++))),a+=String.fromCharCode(i),64!=t&&(a+=String.fromCharCode(n)),64!=s&&(a+=String.fromCharCode(o));return a=this._utf8_decode(a)},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");for(var i="",n=0;n<e.length;n++){var o=e.charCodeAt(n);o<128?i+=String.fromCharCode(o):(127<o&&o<2048?i+=String.fromCharCode(o>>6|192):(i+=String.fromCharCode(o>>12|224),i+=String.fromCharCode(o>>6&63|128)),i+=String.fromCharCode(63&o|128))}return i},_utf8_decode:function(e){for(var i="",n=0,o=c1=c2=0;n<e.length;)(o=e.charCodeAt(n))<128?(i+=String.fromCharCode(o),n++):191<o&&o<224?(c2=e.charCodeAt(n+1),i+=String.fromCharCode((31&o)<<6|63&c2),n+=2):(c2=e.charCodeAt(n+1),c3=e.charCodeAt(n+2),i+=String.fromCharCode((15&o)<<12|(63&c2)<<6|63&c3),n+=3);return i}},d={chrome:"01",safari:"02",ucbrowser:"03",oppobrowser:"04",vivobrowser:"05",miuibrowser:"06",baidubrowser:"07",baiduboxapp:"08",micromessenger:"09",qqbrowser:"10",qihoobrowser:"11",mb2345browser:"12",sogoumobilebrowser:"13",qq:"14",weibo:"15",opera:"16",dolphin:"17",firefox:"18",netscape:"19",webview:"20",webkit:"21",androidbrowser:"22",mzbrowser:"23"},l={ios:"1",android:"2"};function c(e){var i=document.createElement("div"),n=i;i.attachShadow&&(n=i.attachShadow({mode:"open"}));var o=document.createElement("span");o.innerText=e,n.appendChild(o),document.body.appendChild(i),function(e){var i=document.getSelection(),n=document.createRange();n.selectNodeContents(e),i.removeAllRanges(),i.addRange(n)}(o);var r=document.execCommand("copy");return document.getSelection().removeAllRanges(),document.body.removeChild(i),r}function h(e,i){i=i&&i.replace("https://lkme.cc/","");var n=(new D).get_result();if("INPUT"!=e.target.nodeName&&"TEXTAREA"!=e.target.nodeName&&"true"!=e.target.contentEditable&&!e.target.required)try{var o=document.querySelectorAll("body>*:not(script):not(style)");if(Array.prototype.map.call(o,function(e,i,n){e.removeEventListener("click",h)}),!d[n.browser.name.toLowerCase()])return;if(-1!=n.browser.name.toLowerCase().indexOf("liebao")||-1!=n.browser.name.toLowerCase().indexOf("samsungbrowser"))return;var r,t="01"+l[n.os.name.toLowerCase()]+d[n.browser.name.toLowerCase()]+z("identity_id");if(i){var s=(new Date).getTime();r="data:image/png;base64,`+"+a.encode(t)+"#"+i+"/"+s+"`+"}else r="data:image/png;base64,`+"+a.encode(t)+"`+";try{if("ios"==n.os.name.toLowerCase())c(r);else{if("android"!=n.os.name.toLowerCase())return;!function(i){function e(e){e.clipboardData.setData("text/plain",i),e.preventDefault()}document.addEventListener("copy",e);var n=document.execCommand("copy");document.removeEventListener("copy",e)}(r)}}catch(e){console.log(e)}}catch(e){console.log(e)}}function u(e,i){var n=(65535&e)+(65535&i);return(e>>16)+(i>>16)+(n>>16)<<16|65535&n}function w(e,i,n,o,r,t){return u(function(e,i){return e<<i|e>>>32-i}(u(u(i,e),u(o,t)),r),n)}function m(e,i,n,o,r,t,s){return w(i&n|~i&o,e,i,r,t,s)}function p(e,i,n,o,r,t,s){return w(i&o|n&~o,e,i,r,t,s)}function f(e,i,n,o,r,t,s){return w(i^n^o,e,i,r,t,s)}function _(e,i,n,o,r,t,s){return w(n^(i|~o),e,i,r,t,s)}function g(e,i){var n,o,r,t,s;e[i>>5]|=128<<i%32,e[14+(i+64>>>9<<4)]=i;var a=1732584193,d=-271733879,l=-1732584194,c=271733878;for(n=0;n<e.length;n+=16)d=_(d=_(d=_(d=_(d=f(d=f(d=f(d=f(d=p(d=p(d=p(d=p(d=m(d=m(d=m(d=m(r=d,l=m(t=l,c=m(s=c,a=m(o=a,d,l,c,e[n],7,-680876936),d,l,e[n+1],12,-389564586),a,d,e[n+2],17,606105819),c,a,e[n+3],22,-1044525330),l=m(l,c=m(c,a=m(a,d,l,c,e[n+4],7,-176418897),d,l,e[n+5],12,1200080426),a,d,e[n+6],17,-1473231341),c,a,e[n+7],22,-45705983),l=m(l,c=m(c,a=m(a,d,l,c,e[n+8],7,1770035416),d,l,e[n+9],12,-1958414417),a,d,e[n+10],17,-42063),c,a,e[n+11],22,-1990404162),l=m(l,c=m(c,a=m(a,d,l,c,e[n+12],7,1804603682),d,l,e[n+13],12,-40341101),a,d,e[n+14],17,-1502002290),c,a,e[n+15],22,1236535329),l=p(l,c=p(c,a=p(a,d,l,c,e[n+1],5,-165796510),d,l,e[n+6],9,-1069501632),a,d,e[n+11],14,643717713),c,a,e[n],20,-373897302),l=p(l,c=p(c,a=p(a,d,l,c,e[n+5],5,-701558691),d,l,e[n+10],9,38016083),a,d,e[n+15],14,-660478335),c,a,e[n+4],20,-405537848),l=p(l,c=p(c,a=p(a,d,l,c,e[n+9],5,568446438),d,l,e[n+14],9,-1019803690),a,d,e[n+3],14,-187363961),c,a,e[n+8],20,1163531501),l=p(l,c=p(c,a=p(a,d,l,c,e[n+13],5,-1444681467),d,l,e[n+2],9,-51403784),a,d,e[n+7],14,1735328473),c,a,e[n+12],20,-1926607734),l=f(l,c=f(c,a=f(a,d,l,c,e[n+5],4,-378558),d,l,e[n+8],11,-2022574463),a,d,e[n+11],16,1839030562),c,a,e[n+14],23,-35309556),l=f(l,c=f(c,a=f(a,d,l,c,e[n+1],4,-1530992060),d,l,e[n+4],11,1272893353),a,d,e[n+7],16,-155497632),c,a,e[n+10],23,-1094730640),l=f(l,c=f(c,a=f(a,d,l,c,e[n+13],4,681279174),d,l,e[n],11,-358537222),a,d,e[n+3],16,-722521979),c,a,e[n+6],23,76029189),l=f(l,c=f(c,a=f(a,d,l,c,e[n+9],4,-640364487),d,l,e[n+12],11,-421815835),a,d,e[n+15],16,530742520),c,a,e[n+2],23,-995338651),l=_(l,c=_(c,a=_(a,d,l,c,e[n],6,-198630844),d,l,e[n+7],10,1126891415),a,d,e[n+14],15,-1416354905),c,a,e[n+5],21,-57434055),l=_(l,c=_(c,a=_(a,d,l,c,e[n+12],6,1700485571),d,l,e[n+3],10,-1894986606),a,d,e[n+10],15,-1051523),c,a,e[n+1],21,-2054922799),l=_(l,c=_(c,a=_(a,d,l,c,e[n+8],6,1873313359),d,l,e[n+15],10,-30611744),a,d,e[n+6],15,-1560198380),c,a,e[n+13],21,1309151649),l=_(l,c=_(c,a=_(a,d,l,c,e[n+4],6,-145523070),d,l,e[n+11],10,-1120210379),a,d,e[n+2],15,718787259),c,a,e[n+9],21,-343485551),a=u(a,o),d=u(d,r),l=u(l,t),c=u(c,s);return[a,d,l,c]}function v(e){var i,n="";for(i=0;i<32*e.length;i+=8)n+=String.fromCharCode(e[i>>5]>>>i%32&255);return n}function b(e){var i,n=[];for(n[(e.length>>2)-1]=void 0,i=0;i<n.length;i+=1)n[i]=0;for(i=0;i<8*e.length;i+=8)n[i>>5]|=(255&e.charCodeAt(i/8))<<i%32;return n}function o(e){var i,n,o="0123456789abcdef",r="";for(n=0;n<e.length;n+=1)i=e.charCodeAt(n),r+=o.charAt(i>>>4&15)+o.charAt(15&i);return r}function n(e){return unescape(encodeURIComponent(e))}function r(e){return function(e){return v(g(b(e),8*e.length))}(n(e))}function t(e,i){return function(e,i){var n,o,r=b(e),t=[],s=[];for(t[15]=s[15]=void 0,16<r.length&&(r=g(r,8*e.length)),n=0;n<16;n+=1)t[n]=909522486^r[n],s[n]=1549556828^r[n];return o=g(t.concat(b(i)),512+8*i.length),v(g(s.concat(o),640))}(n(e),n(i))}function k(e,i,n){return i?n?t(i,e):function(e,i){return o(t(e,i))}(i,e):n?r(e):function(e){return o(r(e))}(e)}var y="function",E="object",e="model",i="name",s="type",C="vendor",S="version",L="architecture",x="console",A="mobile",T="tablet",N="smarttv",O="wearable",R={extend:function(e,i){for(var n in i)-1!=="browser cpu device engine os".indexOf(n)&&i[n].length%2==0&&(e[n]=i[n].concat(e[n]));return e},has:function(e,i){return"string"==typeof e&&-1!==i.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.split(".")[0]:void 0}},I={rgx:function(){for(var e,i,n,o,r,t,s,a=0,d=arguments;a<d.length&&!t;){var l=d[a],c=d[a+1];if(void 0===e)for(o in e={},c)c.hasOwnProperty(o)&&(typeof(r=c[o])==E?e[r[0]]=void 0:e[r]=void 0);for(i=n=0;i<l.length&&!t;)if(t=l[i++].exec(this.get_UA()))for(o=0;o<c.length;o++)s=t[++n],typeof(r=c[o])==E&&0<r.length?2==r.length?typeof r[1]==y?e[r[0]]=r[1].call(this,s):e[r[0]]=r[1]:3==r.length?typeof r[1]!=y||r[1].exec&&r[1].test?e[r[0]]=s?s.replace(r[1],r[2]):void 0:e[r[0]]=s?r[1].call(this,s,r[2]):void 0:4==r.length&&(e[r[0]]=s?r[3].call(this,s.replace(r[1],r[2])):void 0):e[r]=s||void 0;a+=2}return e},str:function(e,i){for(var n in i)if(typeof i[n]==E&&0<i[n].length){for(var o=0;o<i[n].length;o++)if(R.has(i[n][o],e))return"?"===n?void 0:n}else if(R.has(i[n],e))return"?"===n?void 0:n;return e}},M={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"}}}},U={browser:[[/(qq)[\/\s]([\w\.]+)/i],[[i,"QQ"],S],[/(uc\s?browser)[\/\s]?([\w\.]+)/i,/ucweb.+(ucbrowser)[\/\s]?([\w\.]+)/i,/JUC.+(ucweb)[\/\s]?([\w\.]+)/i],[[i,"UCBrowser"],S],[/(sogoumobilebrowser)[\/\s]?([\w\.]+)/i,/(liebao[a-z]*)[\/\s]?([\w\.]+)/i,/(oppobrowser)[\/\s]?([\w\.]+)/i,/(vivobrowser)[\/\s]?([\w\.]+)/i,/(miuibrowser)[\/\s]?([\w\.]+)/i,/(samsungbrowser)[\/\s]?([\w\.]+)/i,/(baidubrowser)[\/\s]?([\w\.]+)/i,/(baiduboxapp)[\/\s]?([\w\.]+)/i,/(micromessenger)[\/\s]?([\w\.]+)/i,/(qqbrowser)[\/\s]?([\w\.]+)/i,/(qihoobrowser)[\/\s]?([\w\.]+)/i,/(mb2345browser)[\/\s]?([\w\.]+)/i,/(mzbrowser)[\/\s]?([\w\.]+)/i,/(weibo)[\_]+([\d\.]+)/i],[i,S],[/(wv\))[\/\s]?([\w\.]+)/i],[[i,"WebView"],S],[/(chrome)[\/\s]?([\w\.]+)/i,/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[i,"Chrome"],S],[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[i,S],[/\s(opr)\/([\w\.]+)/i],[[i,"Opera"],S],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs)\/([\w\.-]+)/i],[i,S],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[i,"IE"],S],[/(edge)\/((\d+)?[\w\.]+)/i],[i,S],[/(yabrowser)\/([\w\.]+)/i],[[i,"Yandex"],S],[/(comodo_dragon)\/([\w\.]+)/i],[[i,/_/g," "],S],[/(dolfin)\/([\w\.]+)/i],[[i,"Dolphin"],S],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[S,[i,"AndroidBrowser"]],[/FBAV\/([\w\.]+);/i],[S,[i,"Facebook"]],[/fxios\/([\w\.-]+)/i],[S,[i,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[S,[i,"Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[S,i],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[i,[S,I.str,M.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[i,S],[/(navigator|netscape)\/([\w\.-]+)/i],[[i,"Netscape"],S],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[i,S],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[i,S]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[L,"amd64"]],[/(ia32(?=;))/i],[[L,R.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[L,"ia32"]],[/windows\s(ce|mobile);\sppc;/i],[[L,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[L,/ower/,"",R.lowerize]],[/(sun4\w)[;\)]/i],[[L,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[L,R.lowerize]]],device:[[/(android).*;SAMSUNG ([a-z0-9 _-]+) build/i],[C,e,[s,A]],[/(android).*; ([a-z0-9 _-]+) build/i],[C,e,[s,A]],[/(android)[\- ][\d]+\.[\d]+\.[\d]; ([a-z0-9 _-]+) build/i],[C,e,[s,A]],[/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i],[C,e,[s,T]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w+)*/i,/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i],[C,[e,/_/g," "],[s,A]],[/(nexus\s9)/i],[e,[C,"HTC"],[s,T]],[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],[e,C,[s,T]],[/applecoremedia\/[\w\.]+ \((ipad)/],[e,[C,"Apple"],[s,T]],[/(apple\s{0,1}tv)/i],[[e,"Apple TV"],[C,"Apple"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[C,e,[s,T]],[/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i],[e,[C,"Amazon"],[s,T]],[/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i],[[e,I.str,M.device.amazon.model],[C,"Amazon"],[s,A]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[e,C,[s,A]],[/\((ip[honed|\s\w*]+);/i],[e,[C,"Apple"],[s,A]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[C,e,[s,A]],[/\(bb10;\s(\w+)/i],[e,[C,"BlackBerry"],[s,A]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7)/i],[e,[C,"Asus"],[s,T]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[C,"Sony"],[e,"Xperia Tablet"],[s,T]],[/(?:sony)?(?:(?:(?:c|d)\d{4})|(?:so[-l].+))\sbuild\//i],[[C,"Sony"],[e,"Xperia Phone"],[s,A]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[C,e,[s,x]],[/android.+;\s(shield)\sbuild/i],[e,[C,"Nvidia"],[s,x]],[/(playstation\s[34portablevi]+)/i],[e,[C,"Sony"],[s,x]],[/(sprint\s(\w+))/i],[[C,I.str,M.device.sprint.vendor],[e,I.str,M.device.sprint.model],[s,A]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[e,[C,"Microsoft"],[s,x]],[/(kin\.[onetw]{3})/i],[[e,/\./g," "],[C,"Microsoft"],[s,A]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w+)*/i,/(XT\d{3,4}) build\//i,/(nexus\s[6])/i],[e,[C,"Motorola"],[s,A]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[e,[C,"Motorola"],[s,T]],[/\(dtv[\);].+(aquos)/i],[e,[C,"Sharp"],[s,N]],[/sie-(\w+)*/i],[e,[C,"Siemens"],[s,A]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]+)*/i],[[C,"Nokia"],e,[s,A]],[/android\s3\.[\s\w;-]{10}(a\d{3})/i],[e,[C,"Acer"],[s,T]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[C,"LG"],e,[s,T]],[/(lg) netcast\.tv/i],[C,e,[s,N]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w+)*/i],[e,[C,"LG"],[s,A]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[e,[C,"Lenovo"],[s,T]],[/linux;.+((jolla));/i],[C,e,[s,A]],[/((pebble))app\/[\d\.]+\s/i],[C,e,[s,O]],[/android.+;\s(glass)\s\d/i],[e,[C,"Google"],[s,O]],[/android.+(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:one|one[\s_]plus)?[\s_]*(?:\d\w)?)\s+build/i],[[e,/_/g," "],[C,"Xiaomi"],[s,A]],[/\s(tablet)[;\/\s]/i,/\s(mobile)[;\/\s]/i],[[s,R.lowerize],C,e]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[S,[i,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[i,S],[/rv\:([\w\.]+).*(gecko)/i],[S,i]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[i,S],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[i,[S,I.str,M.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[i,"Windows"],[S,I.str,M.os.windows.version]],[/\((bb)(10);/i],[[i,"BlackBerry"],S],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[i,S],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[i,"Symbian"],S],[/\((series40);/i],[i],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[i,"Firefox OS"],S],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[i,S],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[i,"Chromium OS"],S],[/(sunos)\s?([\w\.]+\d)*/i],[[i,"Solaris"],S],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[i,S],[/(ip[honead]+)(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i],[[i,"iOS"],[S,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[i,"Mac OS"],[S,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[i,S]]},D=function(e,i){if(!(this instanceof D))return new D(e,i).get_result();var n=e||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:""),o=i?R.extend(U,i):U;return this.get_browser=function(){var e=I.rgx.apply(this,o.browser);return e.major=R.major(e.version),e},this.get_CPU=function(){return I.rgx.apply(this,o.cpu)},this.get_device=function(){return I.rgx.apply(this,o.device)},this.get_engine=function(){return I.rgx.apply(this,o.engine)},this.get_OS=function(){return I.rgx.apply(this,o.os)},this.get_result=function(){return{ua:this.get_UA(),browser:this.get_browser(),engine:this.get_engine(),os:this.get_OS(),device:this.get_device(),cpu:this.get_CPU()}},this.get_UA=function(){return n},this.set_UA=function(e){return n=e,this},this.set_UA(n),this};function z(e){for(var i=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var r=n[o];" "==r.charAt(0);)r=r.substring(1);if(0==r.indexOf(i))return r.substring(i.length,r.length)}return""}function q(){return event&&event.preventDefault?event.preventDefault():window.event.returnValue=!1,!1}D.VERSION="0.7.10",D.BROWSER={NAME:i,MAJOR:"major",VERSION:S},D.CPU={ARCHITECTURE:L},D.DEVICE={MODEL:e,VENDOR:C,TYPE:s,CONSOLE:x,MOBILE:A,SMARTTV:N,TABLET:T,WEARABLE:O,EMBEDDED:"embedded"},D.ENGINE={NAME:i,VERSION:S},D.OS={NAME:i,VERSION:S},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")});function H(){}function X(e){var i=server.LinkedME_LIVE_URL+"/js/record_id",n="app_id="+e.app_id+"&identity_id="+e.identity_id+"&is_valid_identityid="+e.is_valid_identityId+"&browser_fingerprint_id="+e.browser_fingerprint_id+"&deeplink_id="+e.deeplink_id+"&is_pc_scan=false";server.XHR_async(i,n,"POST",null,function(e,i){},null)}function j(e,i){h(event,e);var n=new D,o=n.get_browser(),r=n.get_OS(),t=n.get_device(),s=server.LinkedME_LIVE_URL+"/sdk/click?uri="+e+"&os="+r.name+"&os_version="+r.version+"&browser_name="+o.name+"&browser_major="+o.major+"&device_model="+t.model;if("UCBrowser"==o.name&&(s=server.LinkedME_LIVE_URL+"/sdk/click?uri="+e+"&os="+r.name+"&os_version="+r.version+"&browser_name=QQ&browser_major="+o.major+"&device_model="+t.model),i&&(s+="&scan=1"),"ios"==r.name.toLowerCase()&&"micromessenger"==o.name.toLowerCase()){if((a=server.XHR_sync(s,null,"get",null,function(e,i){})).err_code||!a.has_android)return;X(a)}if("Android"==r.name)try{var a;if((a=server.XHR_sync(s,null,"get",null,function(e,i){})).err_code||!a.has_android)return;if(0<="MicroMessenger,baidubrowser".toLowerCase().indexOf(o.name.toLowerCase())){var d=a.deeplink_name,l=a.android_uri_scheme,c="link.linkedme.cc";0<=o.name.toLowerCase().indexOf("baidubrowser")&&(c="127.0.0.1");var u=a.us_port,w=(new Date).getTime(),m=encodeURIComponent(l+"://linkedme?click_id="+d+"&lkme=1")+"&lm_timestamp="+w;if(u&&c){var p=u.split(",");if(p&&0<p.length)for(var f=0;f<p.length;f++){var _="http://"+c+":"+p[f]+"/lkme?android_scheme="+m;server.XHR_async(_,null,"get",null,function(e,i){})}}}if("weibo"!=o.name.toLowerCase()&&"micromessenger"!=o.name.toLowerCase()){if(a.android_direct_open)return a.android_custom_url.endsWith(".apk")&&X(a),window.location=a.android_custom_url,q();switch(o.name){case"Chrome":!function(e,i){var n=(new Date).getTime(),o=e.android_uri_scheme+"://linkedme?click_id="+e.deeplink_name+"&lkme=1&r="+n,r="intent://linkedme?click_id="+e.deeplink_name+"&lkme=1#Intent;scheme="+e.android_uri_scheme+";package="+e.android_package_name+";end",t="market://details?id="+e.android_package_name;if(i<37||40==i)window.location=r;else if(37<=i&&i<=41&&39!=i)window.open(o,"_blank").close(),setTimeout(function(){document.hasFocus()&&(X(e),"app_store"==e.download_way?window.location=t:"download_page"==e.download_way&&(window.location=e.android_custom_url))},1e3);else if(39==i||41<i)if("app_store"==e.download_way)window.location=o,setTimeout(function(){document.hasFocus()&&(X(e),window.location=t)},1e3);else if("download_page"==e.download_way){var s=server.LinkedME_LIVE_URL+"/js/record_id_and_redirect?app_id="+e.app_id+"&identity_id="+e.identity_id+"&is_valid_identityid="+e.is_valid_identityId+"&browser_fingerprint_id="+e.browser_fingerprint_id+"&deeplink_id="+e.deeplink_id+"&url="+e.android_custom_url;s=encodeURIComponent(s);var a=r.substring(0,r.length-3)+"S.browser_fallback_url="+s+";end";window.location=a}}(a,o.major);break;case"QQ":case"QQBrowser":!function(e){var i=(new Date).getTime(),n=e.android_uri_scheme+"://linkedme?click_id="+e.deeplink_name+"&lkme=1&r="+i,o="market://details?id="+e.android_package_name;window.location=n;var r=setTimeout(function(){X(e),"app_store"==e.download_way?window.location=o:"download_page"==e.download_way&&(window.location=e.android_custom_url)},500);document.addEventListener("webkitvisibilitychange",function(){document.webkitHidden&&clearTimeout(r)},!1)}(a);break;default:!function(e){var i=(new Date).getTime(),n=e.android_uri_scheme+"://linkedme?click_id="+e.deeplink_name+"&lkme=1&r="+i,o="market://details?id="+e.android_package_name;window.location=n;var r=setTimeout(function(){X(e),"app_store"==e.download_way?window.location=o:"download_page"==e.download_way&&(window.location=e.android_custom_url)},2e3);document.addEventListener("webkitvisibilitychange",function(){document.webkitHidden&&clearTimeout(r)},!1)}(a)}q()}}catch(e){console.log(e)}}H.prototype.XHR_async=function(e,i,n,o,r,t){var s=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");s.withCredentials=!0,s.ontimeout=function(){r("timeout",null,504)},s.onerror=function(e){r(e.error||"Error in API: "+s.status,null,s.status)},s.onreadystatechange=function(){var i;if(4===s.readyState)if(200===s.status){if(t)i=s.responseText;else try{i=JSON.parse(s.responseText)}catch(e){i={}}r(null,i,s.status)}else 402===s.status?r("Not enough credits to redeem.",null,s.status):"4"!==s.status.toString().substring(0,1)&&"5"!==s.status.toString().substring(0,1)||r("Error in API: "+s.status,null,s.status)};try{s.open(n,e,!0),s.timeout=this.TIMEOUT,i?(s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.send(i)):s.send()}catch(e){console.log(e)}},H.prototype.XHR_sync=function(e,i,n,o,r,t){var s=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");s.withCredentials=!0,s.onerror=function(e){r(e.error||"Error in API: "+s.status,null,s.status)};try{if(s.open(n,e,!1),i?(s.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),s.send(i)):s.send(),200===s.status){if(t)i=s.responseText;else try{i=JSON.parse(s.responseText)}catch(e){i={}}r(null,i,s.status)}else 402===s.status?r("Not enough credits to redeem.",null,s.status):"4"!==s.status.toString().substring(0,1)&&"5"!==s.status.toString().substring(0,1)||r("Error in API: "+s.status,null,s.status);return i}catch(e){console.log(e)}},H.prototype.LinkedME_LIVE_URL="https://lkme.cc/i",window.server=new H;function V(){}var B=!1;V.prototype.DEBUG=0,V.prototype.TIMEOUT=5e3,V.prototype.LinkedME_KEY="",V.prototype.LinkedME_SESSION_ID="",V.prototype.version="1.0.4",V.prototype.trigger_deeplink=j,V.prototype.init=function(e,i,n){this.DEBUG&&console.log("linkedme.init()"),null!=(i=i||{}).type&&null!=i.type||(i.type="live");var o=server.LinkedME_LIVE_URL+"/sdk/webinit";if(this.LinkedME_SESSION_ID&&this.LinkedME_KEY==e){var r=z("identity_id");null!=n&&n(null,{identity_id:r,session_id:this.LinkedME_SESSION_ID},null)}else{this.LinkedME_KEY=e;var t=this;server.XHR_async(o+"?linkedme_key="+e+"&type="+i.type,null,"get",null,function(e,i){t.LinkedME_SESSION_ID=i.session_id,document.cookie="identity_id="+i.identity_id,null!=n&&n(e,i),function(){var e=document.querySelectorAll("body>*:not(script):not(style)");Array.prototype.map.call(e,function(e,i,n){e.addEventListener("click",h)})}(),B=!0},null)}},V.prototype.link=function(s,a,d,l){s=s;var c=this,u=0,w=setInterval(function(){if(1==B){clearInterval(w),u++,l=null==l||l,this.DEBUG&&console.log("linkedme.link()");var e=server.LinkedME_LIVE_URL+"/sdk/url";if(null==d&&(d=!1),(s=s||{}).linkedme_key=c.LinkedME_KEY,s.session_id=c.LinkedME_SESSION_ID,s.identity_id=z("identity_id"),s.params&&""!==s.params.trim())try{var i="string"==typeof s.params?JSON.parse(s.params):s.params;s.params={},s.params.$control=i,s.params.$og_title="DetailViewController",s.params=JSON.stringify(s.params)}catch(e){return alert("params鐨凧SON鏁版嵁鏍煎紡鏈夎, 鎻愮ず:JSON鏍煎紡鐨刱ey鍜寁alue鐢ㄥ弻寮曞彿鎷捣鏉�!"),void a("params鐨凧SON鏁版嵁鏍煎紡鏈夎, 鎻愮ず:JSON鏍煎紡鐨刱ey鍜寁alue鐢ㄥ弻寮曞彿鎷捣鏉�!",{url:null})}else s.params="{}";null!=s.type&&null!=s.type||(s.type="live"),s.source="Web",s.sdk_version="web1.0.2",s.timestamp=+new Date,s.sign="",s.h5_url=window.location.href,s.deeplink_md5=k(s.linkedme_key.trim()+"&"+s.tags+"&"+s.channel+"&"+s.feature+"&"+s.stage+"&"+s.params);var n=s.linkedme_key.trim().split("_");3==n.length&&(s.linkedme_key=n[2]),s.tags=null==s.tags||null==s.tags?"":s.tags,s.channel=null==s.channel||null==s.channel?"":s.channel,s.feature=null==s.feature||null==s.feature?"":s.feature,s.stage=null==s.stage||null==s.stage?"":s.stage,"live"==s.type?s.deeplink_md5_new=k(s.linkedme_key.trim()+"&"+s.tags+"&"+s.channel+"&"+s.feature+"&"+s.stage+"&"+s.params):"test"==s.type&&(s.deeplink_md5_new=k(s.linkedme_key.trim()+"&"+s.tags+"&"+s.channel+"&"+s.feature+"&"+s.stage+"&"+s.params+"&test"));var o=new D;s.os=o.get_OS()?o.get_OS().name:"";var r=[];for(var t in s)r.push(encodeURIComponent(t)+"="+encodeURIComponent(s[t]));if(!l)return void server.XHR_sync(e,r.join("&"),"post",null,a);server.XHR_async(e,r.join("&"),"post",null,function(e,i){if(e)a(e,i);else if(i.err_code)a(e,i);else{d&&(window.location=i.url),a(e,i);for(var n=document.getElementsByClassName("linkedme"),o=0;o<n.length;o++)n[o].addEventListener("click",function(){j(i.url)})}})}else 30<u&&(clearInterval(w),console.log("娣卞害閾炬帴鍒濆鍖栧け璐�"))},100)},V.prototype.close=function(e){this.DEBUG&&console.log("linkedme.close()"),null!=(e=e||{}).type&&null!=e.type||(e.type="live"),e.linkedme_key=this.LinkedME_KEY,e.session_id=this.LinkedME_SESSION_ID,e.identity_id=z("identity_id"),e.timestamp=+new Date;var i=[];for(var n in e)i.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));var o=server.LinkedME_LIVE_URL+"/sdk/webclose";server.XHR_async(o,i.join("&"),"post",null,function(e,i){})},window.linkedme=new V,window.onbeforeunload=function(){linkedme.close(null)}}();
更多推荐
已为社区贡献2条内容
所有评论(0)