-
Notifications
You must be signed in to change notification settings - Fork 1
/
callapp.min.js
1 lines (1 loc) · 1.6 KB
/
callapp.min.js
1
!function(a,b){function e(){var b;return a.CustomEvent?b=new a.CustomEvent("click",{canBubble:!0,cancelable:!0}):(b=document.createEvent("Event"),b.initEvent("click",!0,!0)),b}var c,d,g,h,i;b.callapp||(c=navigator.userAgent,d={isSafari:/Version\/[\d\.]+.*Safari/.test(c),chromeV:c.match(/Chrome\/(\d+)/),isAndroid:/Android/i.test(c),isIOS:/iPhone|iPad|iPod/i.test(c),isWechat:/MicroMessenger/i.test(c),iosVersion:function(){if(/iP(hone|od|ad)/.test(navigator.platform)){var a=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3]||0,10)]}return null}},g=(d.chromeV&&d.chromeV[1])>=25&&d.isAndroid,h=d.isAndroid&&!!c.match(/samsung/i),i=d.isSafari&&c.indexOf("OS 9_")>-1,b.callapp=function(b){var c,d,j;b&&"object"==typeof b&&("undefined"!=typeof b.dowmloadUrl&&""!=b.dowmloadUrl&&(c=i?2500:1e3,d=Date.now(),setTimeout(function(){var e=Date.now();c+200>e-d&&(a.location.href=b.dowmloadUrl)},c)),"undefined"!=typeof b.scheme&&""!=b.scheme&&"undefined"!=typeof b.package&&""!=b.package&&"undefined"!=typeof b.schemeUrl&&""!=b.schemeUrl&&(i?setTimeout(function(){var a=document.getElementById("JopenScheme");a||(a=document.createElement("a"),a.id="JopenScheme",a.style.display="none",document.body.appendChild(a)),a.href=b.schemeUrl,a.dispatchEvent(e())},100):g||h?(b.schemeUrl=b.schemeUrl.replace(/pcautobrowser:/,"intent:")+"#Intent;scheme="+b.scheme+";package="+b.package+";end",setTimeout(function(){a.location.href=b.schemeUrl},100)):(j=document.createElement("iframe"),j.src=b.schemeUrl,j.style.display="none",document.body.appendChild(j))))})}(window,window.lib||(window.lib={}));