Authored by Ge

update

  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta charset="utf-8">
  5 + <title>潮流商品 | YOHO!有货</title>
  6 + <meta name="description" content="">
  7 + <script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
  8 + <script type="text/javascript">
  9 + var agent = navigator.userAgent.toLowerCase() ;
  10 + var version, type, appid, td, queryString, downUrl;
  11 +
  12 + var jumpTypes = [110];
  13 +
  14 + function isInJump(unionType) {
  15 + for (var i = 0 ;i < jumpTypes.length; i++) {
  16 + if (unionType == jumpTypes[i]) {
  17 + return true;
  18 + }
  19 + }
  20 + return false;
  21 + }
  22 +
  23 + function getQueryString() {
  24 + var vars = [],
  25 + hash,
  26 + i;
  27 + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  28 +
  29 + for (i = 0; i < hashes.length; i++) {
  30 + hash = hashes[i].split('=');
  31 + vars.push(hash[0]);
  32 + vars[hash[0]] = hash[1];
  33 + }
  34 + return vars;
  35 + }
  36 +
  37 + queryString = getQueryString();
  38 + downUrl = '"http://a.app.qq.com/o/simple.jsp?pkgname=cn.yoho.magazine#opened"';
  39 + //downUrl = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
  40 + var appkey = queryString.appkey;
  41 +
  42 + if (agent.indexOf("like mac os x") > 0) {
  43 + var regStr_saf = /os [\d._]*/gi ;
  44 + var verinfo = agent.match(regStr_saf) ;
  45 +
  46 + version = (verinfo+'').replace(/[^0-9|_.]/ig,'').replace(/_/ig, '.');
  47 + type = 'ios';
  48 + appid = '490655927';
  49 + td = window.screen.width + '_' + window.screen.height + '_' + type + '_' + version;
  50 +
  51 + } else if (agent.indexOf('android') > -1 || agent.indexOf('linux') > -1) {
  52 + type = 'android';
  53 + appid = 'com.yoho';
  54 + try {
  55 + var indextd = agent.indexOf('_td');
  56 + var index = agent.indexOf(' build');
  57 + var preString = '';
  58 + var deviceType = '';
  59 +
  60 + //alert(agent);
  61 + if (indextd > -1) {
  62 + preString = agent.substr(0, indextd);
  63 + preString = preString.substr(preString.lastIndexOf(";") + 1);
  64 + preString = preString.replace(/\s+/g,'').replace(/_/ig, '');
  65 +
  66 + var sansungIndex = preString.indexOf('samsung-');
  67 + if (sansungIndex > -1) {
  68 + preString = preString.substr(8);
  69 + }
  70 + } else if (index > -1) {
  71 + preString = agent.substr(0, index);
  72 + preString = preString.substr(preString.lastIndexOf(";") + 1);
  73 + preString = preString.replace(/\s+/g,'').replace(/_/ig, '');
  74 + //alert(preString);
  75 + }
  76 + deviceType = preString;
  77 + version = agent.substr(agent.indexOf('android') + 8, 3);
  78 + td = deviceType + '_' + type + '_' + version;
  79 + } catch(e) {
  80 +
  81 + }
  82 +
  83 +
  84 +
  85 + //downUrl = 'http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk';
  86 + }
  87 +
  88 +
  89 +
  90 + $.ajax({
  91 + method: 'POST',
  92 + url: 'http://union.yoho.cn/union/ClickUnionRest/addUnion',
  93 +// url: 'http://192.168.102.205:8088/union/ClickUnionRest/addUnion',
  94 + data: {
  95 + union_type: queryString.union_type,
  96 + identify_id: queryString.identify_id,
  97 + callbackurl: queryString.callbackurl,
  98 + client_type: type,
  99 + td: queryString.td ? queryString.td : td,
  100 + appid: queryString.appid ? queryString.appid : appid,
  101 + appkey: queryString.appkey,
  102 + idfa : queryString.idfa ? queryString.idfa : queryString.IDFA,
  103 + imei:queryString.imei?queryString.imei:queryString.IMEI
  104 + },
  105 + complete: function() {
  106 +
  107 + /* if (!downUrl) {
  108 + window.location.href = "http://m.yohobuy.com";
  109 + } else {
  110 + window.location.href = downUrl;
  111 + } */
  112 + window.location.href = downUrl;
  113 +
  114 + window.setTimeout(function() {
  115 + window.location.href = "http://m.yohobuy.com";
  116 + }, 2000);
  117 + }
  118 + });
  119 +
  120 +
  121 + </script>
  122 +</head>
  123 +<body>
  124 +</body>
  125 +</html>