Light12306/Mobile12306New/js/init.js

717 lines
18 KiB
JavaScript
Raw Normal View History

2014-09-01 13:50:43 +08:00
var base64 = base64 || (function() {
2014-08-21 17:00:33 +08:00
var base64Map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split('');
2014-09-01 13:50:43 +08:00
var base64DeMap = ! function() {
2014-08-21 17:00:33 +08:00
var result = {};
2014-09-01 13:50:43 +08:00
$.each(base64Map, function(i, e) {
2014-08-21 17:00:33 +08:00
result[e] = i;
});
return result;
}();
var target = {};
2014-09-01 13:50:43 +08:00
target.encode = function(data) {
2014-08-21 17:00:33 +08:00
var buf = [];
var map = base64Map;
var n = data.length; //总字节数
var val; //中间值
2014-08-21 17:00:33 +08:00
var i = 0;
/*
2014-09-01 13:50:43 +08:00
* 3字节 ==> val ==> 4字符
*/
2014-08-21 17:00:33 +08:00
while (i < n) {
val = (data[i] << 16) |
2014-09-01 13:50:43 +08:00
(data[i + 1] << 8) |
(data[i + 2]);
2014-08-21 17:00:33 +08:00
buf.push(map[val >> 18],
map[val >> 12 & 63],
map[val >> 6 & 63],
map[val & 63]);
i += 3;
}
if (n % 3 == 1) //凑两个"="
2014-08-21 17:00:33 +08:00
buf.pop(), buf.pop(), buf.push('=', '=');
else //凑一个"="
2014-08-21 17:00:33 +08:00
buf.pop(), buf.push('=');
return buf.join('');
};
2014-09-01 13:50:43 +08:00
target.decode = function(str) {
2014-08-21 17:00:33 +08:00
var buf = [];
var arr = str.split('');
var map = base64DeMap;
var n = arr.length; //总字符数
var val; //中间值
2014-08-21 17:00:33 +08:00
var i = 0;
/*
2014-09-01 13:50:43 +08:00
* 长度异常
*/
2014-08-21 17:00:33 +08:00
if (n % 4)
return null;
/*
2014-09-01 13:50:43 +08:00
* 4字符 ==> val ==> 3字节
*/
2014-08-21 17:00:33 +08:00
while (i < n) {
val = (map[arr[i]] << 18) |
(map[arr[i + 1]] << 12) |
(map[arr[i + 2]] << 6) |
(map[arr[i + 3]]);
buf.push(val >> 16,
val >> 8 & 0xFF,
val & 0xFF);
i += 4;
}
/*
2014-09-01 13:50:43 +08:00
* 凑字字符"="个数
*/
2014-08-21 17:00:33 +08:00
while (arr[--n] == '=')
buf.pop();
return buf;
};
2014-09-01 13:50:43 +08:00
target.encodeArrayBuffer = function(arrayBuffer) {
/// <summary>将ArrayBuffer转换为Base64字符串</summary>
2014-08-21 17:00:33 +08:00
var dv = new DataView(arrayBuffer);
var length = dv.byteLength;
var data = [];
for (var i = 0; i < length; i++) {
data.push(dv.getUint8(i));
}
return base64.encode(data);
};
2014-09-01 13:50:43 +08:00
target.toObjectUrl = function(base64str, type) {
/// <summary>获得指定base64字符串的对象链接格式</summary>
2014-08-21 17:00:33 +08:00
return "data:" + type + ";base64," + base64str;
};
return target;
})();
2014-09-01 13:50:43 +08:00
var bootStrap = (function() {
2014-08-21 17:00:33 +08:00
var def = $.Deferred();
2014-09-01 13:50:43 +08:00
// alert(typeof __TicketJavaScriptObject__);
2014-08-21 17:00:33 +08:00
2014-09-01 13:50:43 +08:00
var isAndroid = typeof(__TicketJavaScriptObject__) !== 'undefined';
var isIos = typeof(window.__ksticket) != 'undefined' || typeof(window.__gChrome) != 'undefined';
var isOldBrowser = typeof(window.__ksticket) != 'undefined' || typeof(window.liebaoExtentions) !== 'undefined';
var deviceObject = window.__TicketJavaScriptObject__ || window.__ksticket;
2014-08-21 17:00:33 +08:00
var isExtension = document.body.dataset["mobileSupportInitialized"] || false;
Object.defineProperties(def, {
'isAndroid': {
2014-09-01 13:50:43 +08:00
get: function() {
2014-09-04 20:32:24 +08:00
return isAndroid;
2014-08-21 17:00:33 +08:00
}
},
'isIos': {
2014-09-01 13:50:43 +08:00
get: function() {
return isIos;
}
},
'isIosOld': {
2014-09-01 13:50:43 +08:00
get: function() {
return !isOldBrowser;
}
2014-08-21 17:00:33 +08:00
},
2014-09-01 13:50:43 +08:00
'device_info': {
get: function() {
if (deviceObject)
return deviceObject.get_device_info();
return null;
}
2014-08-21 17:00:33 +08:00
}
});
2014-09-01 13:50:43 +08:00
def.open_url = function(url) {
2014-08-21 17:00:33 +08:00
if (deviceObject) {
deviceObject.open_url(url);
} else {
window.open(url);
}
}
2014-09-01 13:50:43 +08:00
def.refresh_start = function() {
2014-08-21 17:00:33 +08:00
var args = [].slice.call(arguments);
2014-09-01 13:50:43 +08:00
if (deviceObject) {
// deviceObject.refresh_start.apply(this, arguments);
deviceObject.refresh_start();
}
// $(document).dispatchEvent("refreshStart", args);
2014-08-21 17:00:33 +08:00
};
2014-09-01 13:50:43 +08:00
def.refresh_end = function() {
2014-08-21 17:00:33 +08:00
var args = [].slice.call(arguments);
2014-09-01 13:50:43 +08:00
if (deviceObject) {
// deviceObject.refresh_end.apply(this, arguments);
deviceObject.refresh_end();
}
// $(document).dispatchEvent("refreshEnd", args);
2014-08-21 17:00:33 +08:00
};
2014-09-01 13:50:43 +08:00
def.refresh_success = function() {
2014-08-21 17:00:33 +08:00
var args = [].slice.call(arguments);
2014-09-01 13:50:43 +08:00
if (deviceObject) {
// deviceObject.refresh_success.apply(this, arguments);
deviceObject.refresh_success();
2014-09-04 14:46:15 +08:00
try{
deviceObject.toast('刷票成功,请尽快订票');
}catch(e){
2014-09-04 14:46:15 +08:00
}
2014-09-01 13:50:43 +08:00
} else if (window.liebaoExtentions && window.liebaoExtentions.vibrate) {
window.liebaoExtentions.vibrate(5000);
2014-09-01 13:50:43 +08:00
} else if (window.__gChrome && window.__gChrome.hasTicket) {
window.__gChrome.hasTicket("刷票成功,请尽快订票", "");
2014-09-01 13:50:43 +08:00
}
2014-09-01 13:50:43 +08:00
// $(document).dispatchEvent("refreshSuccess", args);
2014-08-21 17:00:33 +08:00
};
var queue = {};
var callid = 0;
2014-09-01 13:50:43 +08:00
var ajaxCommon = (function() {
2014-08-21 17:00:33 +08:00
var baseUri = "https://kyfw.12306.cn/otn/";
return {
2014-09-01 13:50:43 +08:00
getUrl: function(url) {
2014-08-21 17:00:33 +08:00
if (url[4] === ":" || url[5] === ":") return url;
return baseUri + url;
},
2014-09-01 13:50:43 +08:00
getHeaders: function(url, headers) {
2014-08-21 17:00:33 +08:00
headers = headers || {};
headers['Origin'] = /(https?:\/\/[^\/]+\/)/i.exec(url)[1];
if (isIos) {
var nheaders = {};
2014-09-01 13:50:43 +08:00
$.each(headers, function(k, v) {
2014-08-21 17:00:33 +08:00
nheaders["Fish-" + k] = v;
});
headers = nheaders;
}
return headers;
}
};
})();
2014-09-01 13:50:43 +08:00
var ajaxAndLb = (function() {
2014-08-21 17:00:33 +08:00
2014-09-01 13:50:43 +08:00
window.fishXhrLoadCallback = function(obj) {
if (typeof(obj) === "string")
2014-08-21 17:00:33 +08:00
obj = JSON.parse(obj);
var ad = queue[obj.id];
if (!ad)
return;
//process with json
if (ad.rawResultType === "json") {
try {
obj.result = JSON.parse(obj.result);
} catch (e) {
obj.success = false;
}
2014-09-01 13:50:43 +08:00
} else if (ad.rawResultType === "image") {
obj.result = base64.toObjectUrl(obj.result, "png");
2014-08-21 17:00:33 +08:00
}
delete queue[obj.id];
if (obj.success) {
ad.resolve(obj.result, {
headers: obj.headers,
statusCode: obj.statusCode,
statusDescription: obj.statusDescription,
id: obj.id
});
} else {
ad.reject(obj.result, {
headers: obj.headers,
statusCode: obj.statusCode,
statusDescription: obj.statusDescription,
id: obj.id
});
}
};
2014-09-01 13:50:43 +08:00
var ajax = function(method, url, returnType, postdata, refer, headers) {
2014-08-21 17:00:33 +08:00
var ad = new $.Deferred();
postdata = postdata || "";
2014-09-01 13:50:43 +08:00
if (typeof(postdata) !== "string")
2014-08-21 17:00:33 +08:00
postdata = $.param(postdata);
2014-09-01 13:50:43 +08:00
if (method == 'GET' && (returnType || "json") != "image") {
url = url + "?" + postdata;
}
2014-08-21 17:00:33 +08:00
headers = headers || {};
if (refer) {
2014-09-01 13:50:43 +08:00
headers = $.extend({}, headers, {
Referer: refer
});
2014-08-21 17:00:33 +08:00
}
ad.rawResultType = returnType || "json";
ad.context = {
id: ++callid,
url: url,
method: method,
postdata: postdata,
refer: refer,
headers: headers || {},
callback: "fishXhrLoadCallback",
requestCharset: "UTF-8",
returnType: ad.rawResultType === "image" ? "image" : "text"
};
queue[ad.context.id] = ad;
deviceObject.sendRequest(JSON.stringify(ad.context));
return ad.promise();
};
return {
ajax: ajax,
2014-09-01 13:50:43 +08:00
get: function() {
2014-08-21 17:00:33 +08:00
var arr = [].slice.call(arguments);
arr.unshift("GET");
return ajax.apply(this, arr);
},
2014-09-01 13:50:43 +08:00
post: function() {
2014-08-21 17:00:33 +08:00
var arr = [].slice.call(arguments);
arr.unshift("POST");
return ajax.apply(this, arr);
},
2014-09-01 13:50:43 +08:00
getImage: function(url, refer) {
2014-08-21 17:00:33 +08:00
return ajax("GET", url, "image", null, refer);
}
}
})();
2014-09-01 13:50:43 +08:00
var ajaxIos = (function() {
2014-08-21 17:00:33 +08:00
//ios
2014-09-01 13:50:43 +08:00
var ajax = function(method, url, returnType, postdata, refer, headers) {
2014-08-21 17:00:33 +08:00
var ad = new $.Deferred();
headers = headers || {};
if (refer) {
2014-09-01 13:50:43 +08:00
headers = $.extend({}, headers, {
Referer: refer
});
2014-08-21 17:00:33 +08:00
}
2014-09-01 13:50:43 +08:00
var nheaders = {};
$.each(headers, function(k, v) {
nheaders["Fish-" + k] = v;
2014-08-22 18:00:59 +08:00
});
2014-09-01 13:50:43 +08:00
headers = nheaders;
2014-08-21 17:00:33 +08:00
$.ajax({
url: url,
data: postdata,
timeout: 120000,
type: method,
dataType: returnType,
refer: refer,
headers: headers
2014-09-01 13:50:43 +08:00
}).done(function(result, status, xhr) {
2014-08-21 17:00:33 +08:00
ad.resolve(result, {
headers: xhr.getAllResponseHeaders(),
statusCode: xhr.statusCode,
statusDescription: xhr.statusText,
id: 0
});
2014-09-01 13:50:43 +08:00
}).fail(function(xhr) {
2014-08-21 17:00:33 +08:00
ad.reject(result, {
headers: xhr.getAllResponseHeaders(),
statusCode: xhr.statusCode,
statusDescription: xhr.statusText,
id: 0
});
});
return ad;
};
2014-09-01 13:50:43 +08:00
var ajaxLoadImage = function(method, url, postdata, refer, headers) {
2014-08-21 17:00:33 +08:00
var ad = new $.Deferred();
var xhr = new window.XMLHttpRequest();
headers = headers || {};
xhr.open(method, url, true);
2014-09-01 13:50:43 +08:00
$.each(headers, function(k, v) {
2014-08-21 17:00:33 +08:00
xhr.setRequestHeader("Fish-" + k, v);
});
2014-09-01 13:50:43 +08:00
xhr.onreadystatechange = function() {
2014-08-21 17:00:33 +08:00
if (xhr.readyState === 4) {
if (xhr.status !== 200) {
ad.reject("加载验证码失败,请点击验证码刷新", {
2014-08-21 17:00:33 +08:00
headers: xhr.getAllResponseHeaders(),
statusCode: xhr.statusCode,
statusDescription: xhr.statusText,
id: 0
});
} else {
ad.resolve(base64.toObjectUrl(base64.encodeArrayBuffer(xhr.response), "image/jpeg"), {
headers: xhr.getAllResponseHeaders(),
statusCode: xhr.statusCode,
statusDescription: xhr.statusText,
id: 0
});
}
}
};
var prefix = "Fish-";
xhr.responseType = "arraybuffer";
xhr.setRequestHeader(prefix + "Referer", refer || "");
xhr.setRequestHeader(prefix + "User-Agent", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)");
xhr.setRequestHeader(prefix + "Origin", /(https?:\/\/[^\/]+\/)/.exec(url)[1]);
xhr.send(postdata);
return ad;
}
return {
ajax: ajax,
2014-09-01 13:50:43 +08:00
get: function() {
2014-08-21 17:00:33 +08:00
var arr = [].slice.call(arguments);
arr.unshift("GET");
return ajax.apply(this, arr);
},
2014-09-01 13:50:43 +08:00
post: function() {
2014-08-21 17:00:33 +08:00
var arr = [].slice.call(arguments);
arr.unshift("POST");
return ajax.apply(this, arr);
},
2014-09-01 13:50:43 +08:00
getImage: function(url, refer) {
2014-08-21 17:00:33 +08:00
return ajaxLoadImage("GET", url, null, refer);
}
}
})();
2014-09-01 13:50:43 +08:00
var ajaxExtension = (function() {
2014-08-21 17:00:33 +08:00
//ios
2014-09-01 13:50:43 +08:00
var ajax = function(method, url, returnType, postdata, refer, headers) {
2014-08-21 17:00:33 +08:00
var ad = new $.Deferred();
headers = headers || {};
if (refer) {
2014-09-01 13:50:43 +08:00
headers = $.extend({}, headers, {
Referer: refer
});
2014-08-21 17:00:33 +08:00
}
var xhrData = {
url: url,
data: postdata,
timeout: 120000,
type: method,
dataType: returnType,
refer: refer,
headers: headers
};
2014-09-01 13:50:43 +08:00
var e = new CustomEvent("ajaxproxy", {
detail: {
data: xhrData,
index: ++callid
},
cancelable: true
});
2014-08-21 17:00:33 +08:00
if (!document.dispatchEvent(e)) {
queue[e.detail.index] = {
2014-09-01 13:50:43 +08:00
done: function(result) {
2014-08-21 17:00:33 +08:00
ad.resolve(result, {
headers: this.headers,
statusCode: this.status,
statusDescription: this.statusText,
id: this.index
});
},
2014-09-01 13:50:43 +08:00
fail: function() {
2014-08-21 17:00:33 +08:00
ad.reject(this.text, {
headers: this.headers,
statusCode: this.status,
statusDescription: this.statusText,
id: this.index
});
}
};
} else {
document.dispatchEvent(new CustomEvent("requestSupportError"));
def.reject("平台错误");
2014-08-21 17:00:33 +08:00
}
return ad;
};
2014-09-01 13:50:43 +08:00
var ajaxLoadImage = function(method, url, postdata, refer, headers) {
2014-08-21 17:00:33 +08:00
var ad = new $.Deferred();
headers = headers || {};
if (refer) {
2014-09-01 13:50:43 +08:00
headers = $.extend({}, headers, {
Referer: refer
});
2014-08-21 17:00:33 +08:00
}
var e = new CustomEvent("ajaxLoadVerifyCode", {
2014-09-01 13:50:43 +08:00
detail: {
2014-08-21 17:00:33 +08:00
method: method,
url: url,
refer: refer,
index: ++callid,
headers: headers,
data: postdata
2014-09-01 13:50:43 +08:00
},
cancelable: true
2014-08-21 17:00:33 +08:00
});
if (!document.dispatchEvent(e)) {
queue[e.detail.index] = {
2014-09-01 13:50:43 +08:00
done: function() {
2014-08-21 17:00:33 +08:00
ad.resolve(this.url, {
headers: this.headers,
statusCode: this.status,
statusDescription: this.statusText,
id: this.index
});
},
2014-09-01 13:50:43 +08:00
fail: function() {
2014-08-21 17:00:33 +08:00
ad.reject(this.text, {
headers: this.headers,
statusCode: this.status,
statusDescription: this.statusText,
id: this.index
});
}
};
} else {
document.dispatchEvent(new CustomEvent("requestSupportError"));
ad.reject("平台错误");
2014-08-21 17:00:33 +08:00
}
return ad;
2014-08-21 17:00:33 +08:00
}
2014-09-01 13:50:43 +08:00
document.addEventListener("ajaxproxyfinished", function(e) {
2014-08-21 17:00:33 +08:00
var data = e.detail;
if (!queue[data.index]) return;
var param = queue[data.index];
delete queue[data.index];
if (data.status === 404) {
//404是个比较特殊的错误这个错误一般是证书有问题
2014-08-21 17:00:33 +08:00
document.dispatchEvent(new CustomEvent("networkOrCertificationError"));
}
data.success ? param.done.call(data || window, data.model) : param.fail.call(data || window, data.model);
});
return {
ajax: ajax,
2014-09-01 13:50:43 +08:00
get: function() {
2014-08-21 17:00:33 +08:00
var arr = [].slice.call(arguments);
arr.unshift("GET");
return ajax.apply(this, arr);
},
2014-09-01 13:50:43 +08:00
post: function() {
2014-08-21 17:00:33 +08:00
var arr = [].slice.call(arguments);
arr.unshift("POST");
return ajax.apply(this, arr);
},
2014-09-01 13:50:43 +08:00
getImage: function(url, refer) {
2014-08-21 17:00:33 +08:00
return ajaxLoadImage("GET", url, null, refer);
}
}
})();
2014-09-01 13:50:43 +08:00
var ajaxProxy = (function() {
var ajax = function(method, url, returnType, postdata, refer, headers) {
2014-08-21 17:00:33 +08:00
var ad = new $.Deferred();
headers = headers || {};
if (refer) {
2014-09-01 13:50:43 +08:00
headers = $.extend({}, headers, {
Referer: refer
});
2014-08-21 17:00:33 +08:00
}
headers["Fish-RawUrl"] = url;
2014-09-02 19:09:24 +08:00
url = "/12306/proxy.php";
2014-08-21 17:00:33 +08:00
$.ajax({
url: url,
data: postdata,
timeout: 120000,
type: method,
dataType: returnType,
refer: refer,
headers: headers
2014-09-01 13:50:43 +08:00
}).done(function(result, xhr) {
2014-09-02 19:09:24 +08:00
console.log(result, xhr)
2014-08-21 17:00:33 +08:00
ad.resolve(result, {
headers: xhr.getAllResponseHeaders(),
statusCode: xhr.statusCode,
statusDescription: xhr.statusText,
id: 0
});
2014-09-01 13:50:43 +08:00
}).fail(function() {
2014-08-22 18:00:59 +08:00
ad.reject(xhr.responseText, {
2014-08-21 17:00:33 +08:00
headers: xhr.getAllResponseHeaders(),
statusCode: xhr.statusCode,
statusDescription: xhr.statusText,
id: 0
});
});
return ad;
};
2014-09-01 13:50:43 +08:00
var ajaxLoadImage = function(method, url, postdata, refer, headers) {
2014-08-21 17:00:33 +08:00
var ad = new $.Deferred();
var xhr = new window.XMLHttpRequest();
headers = headers || {};
headers["RawUrl"] = url;
headers["Origin"] = /(https?:\/\/[^\/]+\/)/.exec(url)[1];
headers["User-Agent"] = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
headers["Referer"] = refer || "";
2014-09-02 19:09:24 +08:00
url = "/12306/proxy.php";
2014-08-21 17:00:33 +08:00
xhr.open(method, url, true);
2014-09-01 13:50:43 +08:00
$.each(headers, function(k, v) {
xhr.setRequestHeader("Fish-" + k, v);
});
2014-09-01 13:50:43 +08:00
xhr.onreadystatechange = function() {
2014-08-21 17:00:33 +08:00
if (xhr.readyState === 4) {
if (xhr.status !== 200) {
ad.reject("加载验证码失败,请点击验证码刷新", {
2014-08-21 17:00:33 +08:00
headers: xhr.getAllResponseHeaders(),
statusCode: xhr.statusCode,
statusDescription: xhr.statusText,
id: 0
});
} else {
ad.resolve(base64.toObjectUrl(base64.encodeArrayBuffer(xhr.response), "image/jpeg"), {
headers: xhr.getAllResponseHeaders(),
statusCode: xhr.statusCode,
statusDescription: xhr.statusText,
id: 0
});
}
}
};
xhr.responseType = "arraybuffer";
xhr.send(postdata || null);
2014-08-21 17:00:33 +08:00
return ad;
}
return {
ajax: ajax,
2014-09-01 13:50:43 +08:00
get: function() {
2014-08-21 17:00:33 +08:00
var arr = [].slice.call(arguments);
arr.unshift("GET");
return ajax.apply(this, arr);
},
2014-09-01 13:50:43 +08:00
post: function() {
2014-08-21 17:00:33 +08:00
var arr = [].slice.call(arguments);
arr.unshift("POST");
return ajax.apply(this, arr);
},
2014-09-01 13:50:43 +08:00
getImage: function(url, refer) {
2014-08-21 17:00:33 +08:00
return ajaxLoadImage("GET", url, null, refer);
}
}
})();
2014-09-01 13:50:43 +08:00
def.getAjaxComponent = function() {
return (isAndroid ? ajaxAndLb : (isIos ? ajaxIos : (isExtension ? ajaxExtension : ajaxProxy)));
2014-08-21 17:00:33 +08:00
};
2014-09-01 13:50:43 +08:00
def.ajax = function() {
2014-08-21 17:00:33 +08:00
var args = [].slice.call(arguments);
if (args[1])
args[1] = ajaxCommon.getUrl(args[1]);
if (args[4])
args[4] = ajaxCommon.getUrl(args[4]);
if (args[5])
args[5] = ajaxCommon.getHeaders(args[5]);
return def.getAjaxComponent().ajax.apply(this, args);
2014-08-21 17:00:33 +08:00
};
2014-09-01 13:50:43 +08:00
def.get = function() {
2014-08-21 17:00:33 +08:00
var args = [].slice.call(arguments);
args.unshift("GET");
return def.ajax.apply(this, args);
2014-08-21 17:00:33 +08:00
};
2014-09-01 13:50:43 +08:00
def.post = function() {
2014-08-21 17:00:33 +08:00
var args = [].slice.call(arguments);
args.unshift("POST");
return def.ajax.apply(this, args);
2014-08-21 17:00:33 +08:00
};
2014-09-01 13:50:43 +08:00
def.getImage = function() {
2014-08-21 17:00:33 +08:00
var args = [].slice.call(arguments);
if (args[1])
args[1] = ajaxCommon.getUrl(args[1]);
if (args[3])
args[3] = ajaxCommon.getUrl(args[3]);
if (args[5])
args[4] = ajaxCommon.getHeaders(args[4]);
return def.getAjaxComponent().getImage.apply(this, args);
2014-08-21 17:00:33 +08:00
};
2014-09-01 13:50:43 +08:00
$(function() {
2014-09-04 20:32:24 +08:00
if (isIos || isExtension || isAndroid) {
2014-08-21 17:00:33 +08:00
def.resolve();
} else {
2014-09-01 13:50:43 +08:00
var timer = setTimeout(function() {
2014-08-21 17:00:33 +08:00
def.resolve();
}, 500);
2014-09-01 13:50:43 +08:00
document.addEventListener("mobileSupportInitialized", function() {
2014-08-21 17:00:33 +08:00
clearTimeout(timer);
isExtension = true;
def.resolve();
});
}
});
return def;
})();
2014-09-01 13:50:43 +08:00
bootStrap.done(function() {
Client.init();
2014-08-19 16:11:37 +08:00
Public.init();
2014-08-21 17:00:33 +08:00
Login.init();
Query.init();
RunQuery.init();
2014-08-22 18:00:59 +08:00
OrderSubmit.init();
2014-09-01 13:50:43 +08:00
NoComplete.init();
MyRemind.init();
Remind.init();
2014-09-02 19:09:24 +08:00
OrderList.init();
2014-09-05 21:08:31 +08:00
if(window.navigator.userAgent.indexOf('LieBao') >-1){//首先判断是猎豹
// alert(window.navigator.userAgent);
2014-09-05 19:41:50 +08:00
if(window.navigator.userAgent.indexOf('LieBaoFast') == -1){
2014-09-05 21:08:31 +08:00
$('body').prepend('<span class="update_notice"><a href="http://dl.liebao.cn/android/fast/cheetah_2.11.0.apk"><img src="images/update_lb.png"></a></span>')
Public.confirm('升级到手机猎豹极速版,更轻、更快、更安全!',Public.updateAndroid,'立即升级');
}
2014-09-05 21:08:31 +08:00
}else{
if(isIos && !bootStrap.isIos){
$('body').prepend('<span class="update_notice"><a href="https://itunes.apple.com/cn/app/id641522896"><img src="images/update_all.png"></a></span>')
Public.confirm('请下载手机猎豹浏览器',Public.updateIos,'立即下载');
}else if(window.navigator.userAgent.indexOf('Android') > -1){
$('body').prepend('<span class="update_notice"><a href="https://itunes.apple.com/cn/app/id641522896"><img src="images/update_all.png"></a></span>')
Public.confirm('请下载手机猎豹浏览器',Public.updateAndroid,'立即下载');
}
}
2014-09-05 21:08:31 +08:00
// if(isIos && !bootStrap.isIos){
// Public.confirm('升级到手机猎豹极速版,更轻、更快、更安全!',Public.updateIos,'立刻升级');
// }
// if(window.navigator.userAgent.indexOf('Android') > -1){
// if(window.navigator.userAgent.indexOf('LieBaoFast') == -1){
// Public.confirm('升级到手机猎豹极速版,更轻、更快、更安全!',Public.updateAndroid,'立刻升级');
// $('body').prepend('<span class="update_notice"><a href="https://itunes.apple.com/cn/app/id641522896"><img src="images/update_lb.png"></a></span>')
// }
// }
2014-08-19 16:11:37 +08:00
});