修正提交订单的跨天日期有错以及引导的问题

This commit is contained in:
iFish 2014-09-09 15:56:01 +08:00
parent ce405c6142
commit fbbe68c00b
4 changed files with 62 additions and 15 deletions

View File

@ -101,6 +101,9 @@
var notInstallExtension = function () {
seajs.use("ui/noextension");
};
var extensionDisabled = function () {
seajs.use("ui/extesniondisabled");
};
window.targetExtensionId = null;
$(function () {
//确保内容脚本启动
@ -115,8 +118,11 @@
});
});
start.fail(function () {
notInstallExtension();
start.fail(function (reason) {
if (reason === "disabled")
extensionDisabled();
else
notInstallExtension();
});
start.always(function () {
var page = location.pathname;
@ -150,18 +156,39 @@
//完成!
start.resolve();
};
var timeout = 3000;
if (document.body.dataset["mobileSupportInitialized"]) {
checkExtensionInfo();
} else {
var timer = setTimeout(function () {
start.reject();
}, 1500);
document.addEventListener("mobileSupportInitialized", function () {
window.clearTimeout(timer);
var waitForStart = function () {
if (document.body.dataset["mobileSupportInitialized"]) {
checkExtensionInfo();
});
} else {
var timer = setTimeout(function () {
start.reject();
}, timeout);
document.addEventListener("mobileSupportInitialized", function () {
window.clearTimeout(timer);
checkExtensionInfo();
});
}
};
var extJson = null;
if (window.external.GetExtensionInfoListJson && (extJson = window.external.GetExtensionInfoListJson())) {
var ext = _.findWhere(JSON.parse(extJson), { id: "gkbheeokbgmmnbjhhlphckobccejghjn" });
if (ext) {
if (!ext.enabled)
start.reject("disabled");
else {
timeout = 10000;
waitForStart();
}
} else {
waitForStart();
}
} else {
waitForStart();
}
});
})(window, document);

View File

@ -44,7 +44,7 @@
return data;
};
var transferData = function (data, noProcess, noAction) {
var transferData = function (date, data, noProcess, noAction) {
var result = data;
if (!Array.isArray(result.data) || !result.data.length || !result.data[0].queryLeftNewDTO) {
exports.events.fireEvent("requestFailed");
@ -91,7 +91,7 @@
saleTime: t.queryLeftNewDTO.sale_time,
secureStr: t.secretStr,
selltime: null,
date: t.queryLeftNewDTO.start_train_date.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),
date: date,
limitSellInfo: t.buttonTextInfo && t.buttonTextInfo.indexOf("暂售") != -1 ? t.buttonTextInfo.replace(/<[^>]+>/i, "") : null
};
var kp = getTicketInfo(t.queryLeftNewDTO.yp_info);
@ -165,7 +165,7 @@
queryTicketUrl = this.model.c_url;
sendQueryRequest();
} else {
var data = transferData(this.model, noProcess, noAction);
var data = transferData(date, this.model, noProcess, noAction);
def.resolveWith(data);
}
}, function () {

View File

@ -0,0 +1,20 @@
define(function (require, exports, module) {
require("./widget_modalDialog.js");
var btns = [
{
text: "刷新",
type: "primary",
callback: function () {
self.location.reload();
return false;
}
}
];
$.showModalDialog("您启用<u>12306订票助手扩展</u>才可以使用极速版订票,当前已禁用。请进入“我的应用”中启用 :-(", {
image: "/images/cat.png",
buttons: btns,
closeOnAction: false
});
});

View File

@ -169,7 +169,7 @@
});
}
$.showModalDialog("您需要安装" + (isLb ? "" : "<u>猎豹浏览器</u>和") + "<u>最新版12306订票助手扩展</u>才可以使用极速版订票。请安装后刷新此页面 :-)", {
$.showModalDialog("您需要安装" + (isLb ? "" : "<u>猎豹浏览器</u>并") + "启用<u>最新版12306订票助手扩展</u>才可以使用极速版订票。请安装后刷新此页面。如果已安装,请检查是否不小心禁用了 :-(", {
image: "/images/cat.png",
buttons: btns,
closeOnAction: false