project sync
This commit is contained in:
parent
49f110bc73
commit
39f05dafb9
@ -1,5 +1,5 @@
|
||||
var MANIFEST = chrome.runtime.getManifest();
|
||||
var INFOBAR = chrome.infobars || (chrome.experimental && chrome.experimental.infobars);
|
||||
//var INFOBAR = chrome.infobars || (chrome.experimental && chrome.experimental.infobars);
|
||||
var isDebug = (compressFunc + '').indexOf("false") != -1;
|
||||
var bv = window.external.LiebaoGetVersion && window.external.LiebaoGetVersion() || /Chrome\/([\d\.]+)/i.exec(navigator.userAgent)[1];
|
||||
var entry12306 = false;
|
||||
@ -136,61 +136,61 @@ var notification = (function () {
|
||||
return new notify();
|
||||
})();
|
||||
|
||||
(function () {
|
||||
var notifyId;
|
||||
var tabid, message;
|
||||
//未加载提醒
|
||||
var closeCallback = function (id) {
|
||||
if (id === notifyId) {
|
||||
notifyId = null;
|
||||
}
|
||||
};
|
||||
var clickCallback = function (id, idx) {
|
||||
if (id === notifyId && idx === 0) {
|
||||
chrome.tabs.update(tabid, {
|
||||
url: chrome.extension.getURL(message.detail.url.indexOf("/otn") != -1 ? "/infobar/main.html?new" : "/infobar/main.html"),
|
||||
selected: true
|
||||
}, function () { });
|
||||
chrome.notifications.clear("notLoadMessage", function () { });
|
||||
}
|
||||
};
|
||||
chrome.notifications.onClosed.addListener(closeCallback);
|
||||
chrome.notifications.onButtonClicked.addListener(clickCallback);
|
||||
//(function () {
|
||||
// var notifyId;
|
||||
// var tabid, message;
|
||||
// //未加载提醒
|
||||
// var closeCallback = function (id) {
|
||||
// if (id === notifyId) {
|
||||
// notifyId = null;
|
||||
// }
|
||||
// };
|
||||
// var clickCallback = function (id, idx) {
|
||||
// if (id === notifyId && idx === 0) {
|
||||
// chrome.tabs.update(tabid, {
|
||||
// url: chrome.extension.getURL(message.detail.url.indexOf("/otn") != -1 ? "/infobar/main.html?new" : "/infobar/main.html"),
|
||||
// selected: true
|
||||
// }, function () { });
|
||||
// chrome.notifications.clear("notLoadMessage", function () { });
|
||||
// }
|
||||
// };
|
||||
// chrome.notifications.onClosed.addListener(closeCallback);
|
||||
// chrome.notifications.onButtonClicked.addListener(clickCallback);
|
||||
|
||||
chrome.runtime.onMessage.addListener(function (m, sender, response) {
|
||||
if (m.action && m.action === "notLoadTip") {
|
||||
message = m;
|
||||
tabid = sender.tab.id;
|
||||
if (notifyId) {
|
||||
chrome.notifications.update(notifyId, {
|
||||
type: 'basic',
|
||||
iconUrl: '/icons/icon_n.png',
|
||||
title: '订票助手未启动',
|
||||
message: '订票助手未加载,请点击工具栏『订票助手』图标并点击订票菜单来使用。',
|
||||
buttons: [
|
||||
{ title: '或点击这里启动订票助手', iconUrl: "/infobar/theme/plus_16.png" }
|
||||
]
|
||||
}, function () {
|
||||
});
|
||||
} else {
|
||||
chrome.notifications.create('', {
|
||||
type: 'basic',
|
||||
iconUrl: '/icons/icon_n.png',
|
||||
title: '订票助手未启动',
|
||||
message: '订票助手未加载,请点击工具栏『订票助手』图标并点击订票菜单来使用。',
|
||||
buttons: [
|
||||
{ title: '或点击这里启动订票助手', iconUrl: "/infobar/theme/plus_16.png" }
|
||||
]
|
||||
}, function (id) {
|
||||
notifyId = id;
|
||||
});
|
||||
}
|
||||
setTimeout(function () {
|
||||
closeCallback(notifyId);
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
})();
|
||||
// chrome.runtime.onMessage.addListener(function (m, sender, response) {
|
||||
// if (m.action && m.action === "notLoadTip") {
|
||||
// message = m;
|
||||
// tabid = sender.tab.id;
|
||||
// if (notifyId) {
|
||||
// chrome.notifications.update(notifyId, {
|
||||
// type: 'basic',
|
||||
// iconUrl: '/icons/icon_n.png',
|
||||
// title: '订票助手未启动',
|
||||
// message: '订票助手未加载,请点击工具栏『订票助手』图标并点击订票菜单来使用。',
|
||||
// buttons: [
|
||||
// { title: '或点击这里启动订票助手', iconUrl: "/infobar/theme/plus_16.png" }
|
||||
// ]
|
||||
// }, function () {
|
||||
// });
|
||||
// } else {
|
||||
// chrome.notifications.create('', {
|
||||
// type: 'basic',
|
||||
// iconUrl: '/icons/icon_n.png',
|
||||
// title: '订票助手未启动',
|
||||
// message: '订票助手未加载,请点击工具栏『订票助手』图标并点击订票菜单来使用。',
|
||||
// buttons: [
|
||||
// { title: '或点击这里启动订票助手', iconUrl: "/infobar/theme/plus_16.png" }
|
||||
// ]
|
||||
// }, function (id) {
|
||||
// notifyId = id;
|
||||
// });
|
||||
// }
|
||||
// setTimeout(function () {
|
||||
// closeCallback(notifyId);
|
||||
// }, 5000);
|
||||
// }
|
||||
// });
|
||||
//})();
|
||||
|
||||
//#region 系统配置处理
|
||||
|
||||
@ -336,62 +336,62 @@ var CFG_MANGER = (function () {
|
||||
|
||||
//#region 运行环境检测,以及自动处理启动
|
||||
|
||||
(function checkRunModeAndBootStrap() {
|
||||
localStorage["inforbarMode"] = INFOBAR ? "1" : "0";
|
||||
if (!INFOBAR) return;
|
||||
//(function checkRunModeAndBootStrap() {
|
||||
// localStorage["inforbarMode"] = INFOBAR ? "1" : "0";
|
||||
// if (!INFOBAR) return;
|
||||
|
||||
chrome.runtime.onMessage.addListener(function (msg, sender, resp) {
|
||||
if (msg.action && msg.action == "isInforbarEnabled") {
|
||||
resp(INFOBAR ? true : false);
|
||||
}
|
||||
});
|
||||
// chrome.runtime.onMessage.addListener(function (msg, sender, resp) {
|
||||
// if (msg.action && msg.action == "isInforbarEnabled") {
|
||||
// resp(INFOBAR ? true : false);
|
||||
// }
|
||||
// });
|
||||
|
||||
function checkIfInfobarShown(tabid) {
|
||||
var views = chrome.extension.getViews({ type: "infobar" });
|
||||
for (var i in views) {
|
||||
var v = views[i];
|
||||
if (v.location.search == "?" + tabid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// function checkIfInfobarShown(tabid) {
|
||||
// var views = chrome.extension.getViews({ type: "infobar" });
|
||||
// for (var i in views) {
|
||||
// var v = views[i];
|
||||
// if (v.location.search == "?" + tabid) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
var showInfobar = function (tabid, page, isOtn) {
|
||||
//if (checkIfInfobarShown(tabid)) {
|
||||
// INFOBAR.show({
|
||||
// tabId: tabid,
|
||||
// height: 155
|
||||
// });
|
||||
// var showInfobar = function (tabid, page, isOtn) {
|
||||
// //if (checkIfInfobarShown(tabid)) {
|
||||
// // INFOBAR.show({
|
||||
// // tabId: tabid,
|
||||
// // height: 155
|
||||
// // });
|
||||
|
||||
// return;
|
||||
//}
|
||||
// // return;
|
||||
// //}
|
||||
|
||||
//显示infobar
|
||||
INFOBAR.show({
|
||||
tabId: tabid,
|
||||
height: 155,
|
||||
path: "/infobar/" + page + ".html?" + (isOtn ? "new" : "old") + tabid
|
||||
});
|
||||
};
|
||||
// //显示infobar
|
||||
// INFOBAR.show({
|
||||
// tabId: tabid,
|
||||
// height: 155,
|
||||
// path: "/infobar/" + page + ".html?" + (isOtn ? "new" : "old") + tabid
|
||||
// });
|
||||
// };
|
||||
|
||||
chrome.tabs.onUpdated.addListener(function (tabid, changeinfo, tab) {
|
||||
if (changeinfo.status == "complete") {
|
||||
if (/https?:\/\/(www|dynamic|kyfw)\.12306\.cn\/otn.*/i.test(tab.url)) {
|
||||
showInfobar(tab.id, "main", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
// chrome.tabs.onUpdated.addListener(function (tabid, changeinfo, tab) {
|
||||
// if (changeinfo.status == "complete") {
|
||||
// if (/https?:\/\/(www|dynamic|kyfw)\.12306\.cn\/otn.*/i.test(tab.url)) {
|
||||
// showInfobar(tab.id, "main", true);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
//初始化infobar
|
||||
/*chrome.tabs.query({ url: "*://kyfw.12306.cn/*" }, function (ta) {
|
||||
$.each(ta, function () {
|
||||
if (!checkIfInfobarShown(this.id)) {
|
||||
showInfobar(this.id, true);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
})();
|
||||
// //初始化infobar
|
||||
// /*chrome.tabs.query({ url: "*://kyfw.12306.cn/*" }, function (ta) {
|
||||
// $.each(ta, function () {
|
||||
// if (!checkIfInfobarShown(this.id)) {
|
||||
// showInfobar(this.id, true);
|
||||
// }
|
||||
// });
|
||||
// });*/
|
||||
//})();
|
||||
|
||||
|
||||
//#endregion
|
||||
@ -1195,7 +1195,7 @@ window.cbl = function (u, h) {
|
||||
|
||||
(function () {
|
||||
var cv = parseInt(/Chrome\/(\d+)/i.exec(navigator.userAgent)[1]);
|
||||
var updateurl = "http://www.fishlee.net/service/update2/44/" + (cv < 34 ? "44" : "60") + "/version_v6" + (INFOBAR ? "" : "_1") + ".json?" + Math.random();
|
||||
var updateurl = "http://www.fishlee.net/service/update2/44/" + (cv < 34 ? "44" : "60") + "/version_v6.json?" + Math.random();
|
||||
var lastCheckUpdate = null;
|
||||
var hasUpdate = false, lastVersion = null, lastMessage = null, updateInfo = null;
|
||||
|
||||
|
@ -1,34 +1,6 @@
|
||||
{
|
||||
"content_security_policy": "script-src 'self' https://hm.baidu.com; object-src 'self';",
|
||||
"content_scripts": [
|
||||
{
|
||||
"all_frames": true,
|
||||
"exclude_globs": [ ],
|
||||
"exclude_matches": [ ],
|
||||
"include_globs": [ ],
|
||||
"js": [ "libs/jquery.js", "libs/underscore/underscore.js", "contentscripts/framework.js", "contentscripts/morweb/12306.js" ],
|
||||
"matches": [ "http://dynamic.12306.cn/otsweb/*", "https://dynamic.12306.cn/otsweb/*" ],
|
||||
"run_at": "document_end"
|
||||
},
|
||||
{
|
||||
"all_frames": true,
|
||||
"exclude_globs": [ ],
|
||||
"exclude_matches": [ ],
|
||||
"include_globs": [ ],
|
||||
"js": [ "libs/jquery.js", "libs/underscore/underscore.js", "contentscripts/kyfw/12306_pre.js" ],
|
||||
"matches": [ "http://*.12306.cn/otn/*", "https://*.12306.cn/otn/*" ],
|
||||
"run_at": "document_start"
|
||||
},
|
||||
{
|
||||
"all_frames": true,
|
||||
"exclude_globs": [ ],
|
||||
"exclude_matches": [ ],
|
||||
"include_globs": [ ],
|
||||
"js": [ "libs/jquery.js", "libs/underscore/underscore.js", "contentscripts/framework.js", "contentscripts/kyfw/12306.js" ],
|
||||
"css": [ "contentscripts/kyfw/12306.css" ],
|
||||
"matches": [ "http://*.12306.cn/otn/*", "https://*.12306.cn/otn/*" ],
|
||||
"run_at": "document_end"
|
||||
},
|
||||
{
|
||||
"all_frames": true,
|
||||
"exclude_globs": [ ],
|
||||
@ -37,15 +9,6 @@
|
||||
"js": [ "libs/jquery.js", "12306/mobileproxy.js" ],
|
||||
"matches": [ "http://test.fishlee.net/*", "http://dev.fishlee.net/*", "http://app.fishlee.net/*", "http://12306.liebao.cn/*" ],
|
||||
"run_at": "document_end"
|
||||
},
|
||||
{
|
||||
"all_frames": false,
|
||||
"exclude_globs": [ ],
|
||||
"exclude_matches": [ ],
|
||||
"include_globs": [ ],
|
||||
"css": [ "contentscripts/morweb/12306_style.css" ],
|
||||
"matches": [ "http://www.12306.cn/mormhweb/kyfw/*" ],
|
||||
"run_at": "document_end"
|
||||
}
|
||||
],
|
||||
"browser_action": {
|
||||
@ -65,7 +28,7 @@
|
||||
"128": "icons/icon_128.png"
|
||||
},
|
||||
"homepage_url": "http://www.fishlee.net/",
|
||||
"permissions": [ "management", "tabs", "http://*.12306.cn/*", "https://*.12306.cn/*", "http://*.fishlee.net/*", "http://*.liebao.cn/*", "notifications", "webRequest", "webRequestBlocking", "http://*.fishlee.net/*", "http://*.ijinshan.com/*", "*://*/*", "infobars" ],
|
||||
"permissions": [ "management", "tabs", "http://*.12306.cn/*", "https://*.12306.cn/*", "http://*.fishlee.net/*", "http://*.liebao.cn/*", "notifications", "webRequest", "webRequestBlocking", "http://*.fishlee.net/*", "http://*.ijinshan.com/*", "*://*/*" ],
|
||||
"update_url": "http://www.fishlee.net/service/update2/44/44/update_lb.xml",
|
||||
"background": {
|
||||
"page": "background.html"
|
||||
|
@ -11,7 +11,6 @@ using TrainInfomationProviderService.TrainInfo.Entities;
|
||||
|
||||
namespace TrainInfomationProviderService.Web.Controllers
|
||||
{
|
||||
[AllowOriginFilter(@"(https?://.*?\.(fishlee\.net|liebao\.cn)|chrome-extension://.*)")]
|
||||
public class TransitController : Controller
|
||||
{
|
||||
#region Overrides of Controller
|
||||
@ -24,6 +23,7 @@ namespace TrainInfomationProviderService.Web.Controllers
|
||||
{
|
||||
base.OnAuthorization(filterContext);
|
||||
|
||||
filterContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
|
||||
if (!TrainInfoSearchProvider.Instance.IsReady)
|
||||
filterContext.Result = Json(new { ret = false, msg = "service not ready." }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
@ -119,6 +119,8 @@ namespace TrainInfomationProviderService.Web.Controllers
|
||||
{
|
||||
from = s.First.FromStation.Code,
|
||||
to = s.First.ToStation.Code,
|
||||
fe = s.First.IsBegin,
|
||||
ae = s.First.IsEnd,
|
||||
train = new
|
||||
{
|
||||
id = s.First.Train.Id,
|
||||
@ -131,6 +133,8 @@ namespace TrainInfomationProviderService.Web.Controllers
|
||||
second = new
|
||||
{
|
||||
from = s.Second.FromStation.Code,
|
||||
fe = s.Second.IsBegin,
|
||||
ae = s.Second.IsEnd,
|
||||
to = s.Second.ToStation.Code,
|
||||
train = new
|
||||
{
|
||||
@ -148,6 +152,7 @@ namespace TrainInfomationProviderService.Web.Controllers
|
||||
|
||||
var data = new
|
||||
{
|
||||
@base = result.Date.ToString(),
|
||||
cities,
|
||||
corder = result.CityOrder,
|
||||
lines,
|
||||
|
@ -195,6 +195,8 @@
|
||||
<Content Include="js\data.js" />
|
||||
<Content Include="js\modules\colorbox\jquery.colorbox.js" />
|
||||
<Content Include="js\modules\doT.js" />
|
||||
<Content Include="js\platform\encode.js" />
|
||||
<Content Include="js\ui\ui-oncetrainsitquery.js" />
|
||||
<Content Include="js\otn\orderprocess.js" />
|
||||
<Content Include="js\otn\passenger.js" />
|
||||
<Content Include="js\otn\queryticket.js" />
|
||||
|
@ -348,3 +348,30 @@ div.text-input-wrap {
|
||||
color: #6f7379;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.text-align-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.remark {
|
||||
padding: 5px;
|
||||
background: rgb(102, 102, 102);
|
||||
color: #fff;
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
vertical-align: 10%;
|
||||
font-weight: normal;
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.remark-mini {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.remark-warning {
|
||||
background-color: #C56063;
|
||||
}
|
||||
.remark-primary {
|
||||
background-color: #5088DF;
|
||||
}
|
||||
|
@ -10,22 +10,26 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
#dateSelector:hover {
|
||||
#dateSelector:hover {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
#dateSelector.open {
|
||||
#dateSelector.open {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
#dateSelector.open:hover {
|
||||
#dateSelector.open:hover {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
#dateSelector .month-first, #dateSelector .month-second {
|
||||
#dateSelector .month-first, #dateSelector .month-second {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
#dateSelector .month-second {
|
||||
#dateSelector .month-second {
|
||||
border-left: 1px solid #d1d1d1;
|
||||
}
|
||||
}
|
||||
|
||||
#dateSelector .date-thismonth {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@ -258,7 +258,6 @@
|
||||
.date-selector .date-commonavailable {
|
||||
color: #d8a15e;
|
||||
background-color: #FFF1E0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.date-selector .date-notavailable {
|
||||
@ -271,3 +270,6 @@
|
||||
background: none;
|
||||
color: #ccc;
|
||||
}
|
||||
.date-selector .date-thismonth {
|
||||
font-weight: bold;
|
||||
}
|
@ -281,7 +281,7 @@
|
||||
button#btnResetOptions {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 0;
|
||||
bottom: 3px;
|
||||
}
|
||||
|
||||
.search-traintypes {
|
||||
|
@ -9,9 +9,10 @@
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.options-param >dl {
|
||||
.options-param > dl {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.options-param > dl:nth-child(1) {
|
||||
margin-top: 5px;
|
||||
}
|
||||
@ -117,6 +118,14 @@
|
||||
color: #ff6a00;
|
||||
}
|
||||
|
||||
.options-param .options-seat-type ul li:last-child {
|
||||
float: none;
|
||||
clear: both;
|
||||
border-top: 1px dotted #ccc;
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.options-param .options-train-selectorwarp {
|
||||
position: relative;
|
||||
}
|
||||
|
@ -178,6 +178,11 @@
|
||||
border-top: 1px solid #cccccc;
|
||||
}
|
||||
|
||||
.result .train-list-func {
|
||||
text-align: center;
|
||||
line-height: 60px;
|
||||
}
|
||||
|
||||
/*购票建议*/
|
||||
#suggestion {
|
||||
display: none;
|
||||
@ -275,6 +280,7 @@
|
||||
line-height: 30px;
|
||||
font-weight: bold;
|
||||
text-indent: 10px;
|
||||
background: linear-gradient(to bottom, #efefef, #d9d9d9);
|
||||
}
|
||||
|
||||
#oncetrainsit > header a {
|
||||
@ -283,6 +289,16 @@
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#oncetrainsit > header > ul {
|
||||
float: right;
|
||||
overflow: hidden;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#oncetrainsit > header > ul > li {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#oncetrainsit > footer {
|
||||
padding: 10px;
|
||||
}
|
||||
@ -298,13 +314,21 @@
|
||||
}
|
||||
|
||||
#oncetrainsit th {
|
||||
border-bottom: 1px solid #cccccc;
|
||||
padding: 5px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#oncetrainsit td {
|
||||
#oncetrainsit tr:nth-child(6n+5),
|
||||
#oncetrainsit tr:nth-child(6n+6),
|
||||
#oncetrainsit tr:nth-child(6n+7) {
|
||||
background-color: #FFF9E9;
|
||||
}
|
||||
|
||||
#oncetrainsit .ticket-container td {
|
||||
border-bottom: 1px solid #f8f8f8;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#oncetrainsit tr.recommand th {
|
||||
@ -313,32 +337,35 @@
|
||||
|
||||
#oncetrainsit tr.header th {
|
||||
font-weight: bold;
|
||||
background-color: #f9f9f9;
|
||||
border-bottom: 1px solid #cccccc;
|
||||
}
|
||||
|
||||
#oncetrainsit tr.header th:nth-child(n+2) {
|
||||
border-left: 1px solid #cccccc;
|
||||
}
|
||||
|
||||
#oncetrainsit tr.sub th {
|
||||
}
|
||||
|
||||
#oncetrainsit tr.sub th:nth-child(2),
|
||||
#oncetrainsit tr.sub th:nth-child(4),
|
||||
#oncetrainsit tr.sub th:nth-child(7),
|
||||
#oncetrainsit tr.sub th:nth-child(9),
|
||||
#oncetrainsit tr.sub th:nth-child(11) {
|
||||
border-bottom: none;
|
||||
#oncetrainsit tr.sub th:nth-child(6) {
|
||||
border-left: 1px solid #cccccc;
|
||||
font-weight: bold;
|
||||
font-size: 130%;
|
||||
}
|
||||
|
||||
#oncetrainsit tr.sub th:nth-child(1) {
|
||||
font-weight: bold;
|
||||
font-size: 130%;
|
||||
}
|
||||
#oncetrainsit tr.sub th:nth-child(6) {
|
||||
border-left: 1px solid #cccccc;
|
||||
}
|
||||
|
||||
#oncetrainsit tr.sub th:nth-child(11) {
|
||||
border-left: 1px solid #cccccc;
|
||||
}
|
||||
|
||||
#oncetrainsit tr.sub th:nth-child(3),
|
||||
#oncetrainsit tr.sub th:nth-child(8) {
|
||||
color: #ff6a00;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
#oncetrainsit tr.row td {
|
||||
line-height: 40px;
|
||||
border-bottom: 1px solid #cccccc;
|
||||
@ -354,10 +381,50 @@
|
||||
border-left: 1px solid #cccccc;
|
||||
}
|
||||
|
||||
#oncetrainsit table .button {
|
||||
padding: 0 2px;
|
||||
#oncetrainsit .button {
|
||||
padding: 0 4px;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
#oncetrainsit .remark {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#oncetrainsit tr.catalog th {
|
||||
background: linear-gradient(to bottom, #fff, #f9f9f9);
|
||||
border-bottom: 1px solid #cccccc;
|
||||
text-align: left;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#oncetrainsit .ae, #oncetrainsit .fe {
|
||||
color: red;
|
||||
}
|
||||
|
||||
#oncetrainsit .ae:after,
|
||||
#oncetrainsit .fe:after {
|
||||
content: '终';
|
||||
color: white;
|
||||
display: inline-block;
|
||||
background: #FF9310;
|
||||
border-radius: 5px;
|
||||
padding: 2px 3px;
|
||||
font-weight: normal;
|
||||
font-size: 12px;
|
||||
margin-left: 4px;
|
||||
line-height: 12px;
|
||||
vertical-align: 10%;
|
||||
}
|
||||
|
||||
#oncetrainsit .fe:after {
|
||||
content: '始';
|
||||
}
|
||||
|
||||
#oncetrainsit .btn-ticket-block {
|
||||
margin-right: 5px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
#oncetrainsit time {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
@ -281,7 +281,6 @@
|
||||
padding-top: 10px;
|
||||
font-size: 12px;
|
||||
margin-top: 5px;
|
||||
text-shadow: 0 0 1px rgba(200, 50, 50, 0.4);
|
||||
}
|
||||
|
||||
#ticket-submit-info .ticket-submit-info-status-failed div p,
|
||||
@ -297,5 +296,4 @@
|
||||
|
||||
#ticket-submit-info .ticket-submit-info-status-ok div {
|
||||
color: #4169E1;
|
||||
text-shadow: 0 0 1px rgba(50, 50, 200, 0.4);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<input class="submit-btn" id="btnQuery" type="button" value="查询余票" />
|
||||
<input class="submit-btn" id="btnQuery" type="button" value="立即刷票" />
|
||||
</li>
|
||||
</ul>
|
||||
<a class="search-more-option" href="javascript:;">
|
||||
@ -133,37 +133,37 @@
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" value="G" id="" />
|
||||
高铁(G)
|
||||
高铁
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" value="D" id="" />
|
||||
动车(D)
|
||||
动车
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" value="C" id="" />
|
||||
城铁(C)
|
||||
城铁
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" value="Z" id="" />
|
||||
直达(Z)
|
||||
直达
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" value="T" id="" />
|
||||
特快(T)
|
||||
特快
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" value="K" id="" />
|
||||
快车(K)
|
||||
快车
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
@ -213,6 +213,14 @@
|
||||
<span class="optional-block" data-code="{{=seat}}"> {{=it.getName(seat)}}<span class="close">x</span></span>{{~}}
|
||||
</script>
|
||||
<label><input type="text" class="options-input" id="travel-seat-select" placeholder="添加想要的席别" readonly="readonly" /></label>
|
||||
<label style="display:none;" id="opt_seat_first">
|
||||
<input type="checkbox" data-profile-key="selectSeatFirst" value="1" id="" />
|
||||
席别优先
|
||||
</label>
|
||||
<label style="display:none;" id="opt_seat_tb">
|
||||
<input type="checkbox" data-profile-key="tryBottomSeat" value="1" id="" />
|
||||
尝试预定下铺
|
||||
</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="cl">
|
||||
@ -354,42 +362,6 @@
|
||||
</script>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="cl">
|
||||
<dt>更多选项:</dt>
|
||||
<dd class="param-array">
|
||||
<p>
|
||||
<label>
|
||||
<input type="checkbox" data-profile-key="hideNoTicket" value="1" id="" />
|
||||
隐藏无票车次
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" data-profile-key="hideNotInListTrain" value="1" id="" />
|
||||
隐藏未选车次
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" data-profile-key="autoWaitToSell" value="1" id="" />
|
||||
自动等待起售
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" data-profile-key="tryBottomSeat" value="1" id="" />
|
||||
尝试预定下铺
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" data-profile-key="selectSeatFirst" value="1" id="" />
|
||||
席别优先
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" data-profile-key="autoSubmitEnabled" value="1" id="" />
|
||||
自动提交
|
||||
</label>
|
||||
<label>
|
||||
刷新间隔
|
||||
<input type="number" data-profile-key="autoRefreshDelay" min="1" max="30" value="5" id="" title="两次自动刷新之间的时间间隔,不建议过短" />
|
||||
秒
|
||||
</label>
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<div class="split"></div>
|
||||
<dl class="cl">
|
||||
<dt>出行计划:</dt>
|
||||
@ -412,7 +384,27 @@
|
||||
</button>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<label>
|
||||
<input type="checkbox" data-profile-key="hideNoTicket" value="1" id="" />
|
||||
隐藏无票车次
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" data-profile-key="hideNotInListTrain" value="1" id="" />
|
||||
隐藏未选车次
|
||||
</label>
|
||||
<label style="display:none;">
|
||||
<input type="checkbox" data-profile-key="autoWaitToSell" value="1" id="" />
|
||||
自动等待起售
|
||||
</label>
|
||||
<label style="display:none;">
|
||||
<input type="checkbox" data-profile-key="autoSubmitEnabled" value="1" id="" />
|
||||
自动提交
|
||||
</label>
|
||||
<label>
|
||||
刷新间隔
|
||||
<input type="number" data-profile-key="autoRefreshDelay" min="1" max="30" value="5" id="" title="两次自动刷新之间的时间间隔,不建议过短" />
|
||||
秒
|
||||
</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<button id="btnResetOptions" class="button button-default">重置选项</button>
|
||||
@ -510,77 +502,152 @@
|
||||
</footer>
|
||||
</section>
|
||||
<!--一次中转-->
|
||||
<section id="oncetrainsit">
|
||||
<section id="oncetrainsit" style="display:none;">
|
||||
<header>
|
||||
<a href="javascript:;">
|
||||
<i class="fa fa-times"></i>
|
||||
关闭
|
||||
</a>
|
||||
中转查询
|
||||
车站中转推荐
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<label><input type="radio" name="tt_level" value="3" id="" /> 显示全部线路及不推荐线路</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input type="radio" name="tt_level" value="2" id="" /> 显示全部线路</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input type="radio" name="tt_level" checked="checked" value="1" id="" /> 仅显示推荐线路</label>
|
||||
</li>
|
||||
</ul>
|
||||
</header>
|
||||
<section></section>
|
||||
<script type="text/x-dot-template">
|
||||
{{var lastCity;}}
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width:70px;" />
|
||||
<col style="width:100px;" />
|
||||
<col style="width:30px;" />
|
||||
<col style="width:100px;" />
|
||||
<col style="width:100px;" />
|
||||
</colgroup>
|
||||
<colgroup>
|
||||
<col style="width:70px;" />
|
||||
<col style="width:100px;" />
|
||||
<col style="width:30px;" />
|
||||
<col style="width:100px;" />
|
||||
<col style="width:100px;" />
|
||||
</colgroup>
|
||||
<colgroup style="width:110px;" />
|
||||
<tr class="header">
|
||||
<th colspan="5">前车信息</th>
|
||||
<th colspan="5">后车信息</th>
|
||||
<th>时间</th>
|
||||
</tr>
|
||||
<tr class="sub recommand">
|
||||
<th rowspan="2">K656</th>
|
||||
<th>北京</th>
|
||||
<th rowspan="2">
|
||||
<i class="fa fa-arrow-circle-right"></i>
|
||||
<th>
|
||||
<strong>总耗时</strong> / 等候
|
||||
</th>
|
||||
</tr>
|
||||
{{~it.showLines:line:index}}
|
||||
{{?ext.l>1&&lastCity!==line.first.to}}
|
||||
{{lastCity=line.first.to}}
|
||||
<tr class="catalog">
|
||||
<th colspan="11">
|
||||
<i class="fa fa-star"></i>
|
||||
中转站:<strong>{{!line.first.toName}}</strong>
|
||||
</th>
|
||||
</tr>
|
||||
{{?}}
|
||||
<tr class="sub {{=line.ne?'':'recommand'}}">
|
||||
<th rowspan="2">{{=line.first.train.code}}</th>
|
||||
<th>
|
||||
<span class="{{=line.first.fe?'fe':''}}">
|
||||
{{!line.first.fromName}}
|
||||
</span>
|
||||
</th>
|
||||
<th rowspan="2">
|
||||
<i class="fa fa-arrow-circle-o-right"></i>
|
||||
</th>
|
||||
<th>
|
||||
<span class="{{=line.first.ae?'ae':''}}">
|
||||
{{!line.first.toName}}
|
||||
</span>
|
||||
</th>
|
||||
<th>南京</th>
|
||||
<th rowspan="2">
|
||||
历时
|
||||
<br />
|
||||
10:00
|
||||
{{!line.first.elapsedStr}}
|
||||
</th>
|
||||
<th rowspan="2">{{=line.second.train.code}}</th>
|
||||
<th>
|
||||
<span class="{{=line.second.fe?'fe':''}}">
|
||||
{{!line.second.fromName}}
|
||||
</span>
|
||||
</th>
|
||||
<th rowspan="2">K656</th>
|
||||
<th>北京</th>
|
||||
<th rowspan="2">
|
||||
<i class="fa fa-arrow-circle-right"></i>
|
||||
<i class="fa fa-arrow-circle-o-right"></i>
|
||||
</th>
|
||||
<th>
|
||||
<span class="{{=line.second.ae?'ae':''}}">
|
||||
{{!line.second.toName}}
|
||||
</span>
|
||||
</th>
|
||||
<th>南京</th>
|
||||
<th rowspan="2">
|
||||
历时
|
||||
<br />
|
||||
10:00
|
||||
{{!line.second.elapsedStr}}
|
||||
</th>
|
||||
<th>总历时 24:00</th>
|
||||
<th><strong>{{=line.totalTimeStr}}</strong></th>
|
||||
</tr>
|
||||
<tr class="recommand">
|
||||
<th>10:00</th>
|
||||
<th>13:00</th>
|
||||
<th>3:00</th>
|
||||
<th>16:00</th>
|
||||
<th>等候 2:00</th>
|
||||
<tr class="{{=line.ne?'':'recommand'}}">
|
||||
<th>{{=line.first.leftShort}}</th>
|
||||
<th>
|
||||
{{=line.first.arriveShort}}
|
||||
{{?line.first.days>0}}
|
||||
<span class="remark remark-mini remark-primary" title="隔{{=line.first.days}}天">+{{=line.first.days}}</span>
|
||||
{{?}}
|
||||
</th>
|
||||
<th>
|
||||
{{=line.second.leftShort}}
|
||||
{{?line.second.leftDays>0}}
|
||||
<span class="remark remark-mini remark-primary" title="隔{{=line.second.leftDays}}天">+{{=line.second.leftDays}}</span>
|
||||
{{?}}
|
||||
</th>
|
||||
<th>
|
||||
{{=line.second.arriveShort}}
|
||||
{{?line.second.arriveDays>0}}
|
||||
<span class="remark remark-mini remark-primary" title="隔{{=line.second.arriveDays}}天">+{{=line.second.arriveDays}}</span>
|
||||
{{?}}
|
||||
</th>
|
||||
<th><time>{{=line.waitTimeStr}}</time></th>
|
||||
</tr>
|
||||
<tr class="ticket-container">
|
||||
<td colspan="5">
|
||||
<button class="button button-default">
|
||||
二等座 768张 ¥768.00
|
||||
</button>
|
||||
<td colspan="5" data-traincode="{{=line.first.train.code}}" data-trainid="{{=line.first.train.id}}" data-date="{{=line.first.left.split(' ')[0]}}">
|
||||
<span class="loading">
|
||||
<i class="fa fa-spinner fa-spin"></i>
|
||||
|
||||
正在查询余票...
|
||||
</span>
|
||||
</td>
|
||||
<td colspan="5">
|
||||
<button class="button button-default">
|
||||
二等座 768张 ¥768.00
|
||||
</button>
|
||||
<td colspan="5" data-traincode="{{=line.second.train.code}}" data-trainid="{{=line.second.train.id}}" data-date="{{=line.second.left.split(' ')[0]}}">
|
||||
<span class="loading">
|
||||
<i class="fa fa-spinner fa-spin"></i>
|
||||
|
||||
正在查询余票...
|
||||
</span>
|
||||
</td>
|
||||
<td class="remark">
|
||||
<span>需要换车站</span>
|
||||
<td class="text-align-center">
|
||||
{{?line.ne}}
|
||||
<span class="remark remark-warning">需要换车站</span>
|
||||
{{?}}
|
||||
</td>
|
||||
</tr>
|
||||
{{~}}
|
||||
</table>
|
||||
|
||||
</script>
|
||||
<footer>
|
||||
<button type="button" class="button button-default">
|
||||
<i class="fa fa-angle-double-up"></i>
|
||||
显示更多中转线路
|
||||
</button>
|
||||
<button type="button" class="button button-default">
|
||||
<i class="fa fa-angle-double-up"></i>
|
||||
显示全部中转线路
|
||||
</button>
|
||||
订票助手会在后台为您刷新以上余票信息。
|
||||
</footer>
|
||||
</section>
|
||||
<!-- 月日期选择 -->
|
||||
@ -615,24 +682,6 @@
|
||||
<th style="width:130px;">发/到站</th>
|
||||
<th>余票信息</th>
|
||||
</tr>
|
||||
{{?!it.auto&&it.enableAuto&&!it.notInSellTime}}
|
||||
<tr class="train-needauto" style='{{=it.inAutoRefresh?"display:none;":""}}'>
|
||||
<td colspan="4">
|
||||
没有符合要求的车次和席别
|
||||
<button type="button" class="button button-primary" id="btn_start_autorefresh">
|
||||
<i class="fa fa-refresh"></i>
|
||||
|
||||
开始刷票
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{{??!it.inAutoRefresh&&!it.notInSellTime}}
|
||||
<tr class="train-autotip">
|
||||
<td colspan="4">
|
||||
点击“显示更多选项”并设置您需要的席别和车次以开启刷票模式。
|
||||
</td>
|
||||
</tr>
|
||||
{{?}}
|
||||
{{~it.available:t:index}}
|
||||
<tr class="{{=t.selected?'selected':''}}">
|
||||
<td class="train-num">
|
||||
@ -694,6 +743,16 @@
|
||||
</tr>
|
||||
|
||||
{{?}}
|
||||
<tr style='{{=it.notInSellTime||ext.cp.studentTicket||it.showTransit||ext.cp.resign?"display:none;":""}}'>
|
||||
<td colspan="4" class="train-list-func">
|
||||
<button type="button" class="button button-primary" id="btn_start_transit">
|
||||
<i class="fa fa-exchange"></i>
|
||||
|
||||
查询中转换乘
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</script>
|
||||
<article id="save-travel-method" class="float-dialog">
|
||||
|
@ -129,7 +129,7 @@
|
||||
}
|
||||
}
|
||||
//fix passenger issue
|
||||
profile.currentProfile.passengers = _.filter(profile.currentProfile.passengers || [], function(p) {
|
||||
profile.currentProfile.passengers = _.filter(profile.currentProfile.passengers || [], function (p) {
|
||||
return p.passenger_name || false;
|
||||
});
|
||||
|
||||
@ -189,8 +189,7 @@
|
||||
|
||||
d1 = new $.Deferred();
|
||||
d1.resolve(passengers);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//that.once("passengerLoaded", function () {
|
||||
// callback(passengers);
|
||||
//});
|
||||
@ -222,6 +221,10 @@
|
||||
passengers: [],
|
||||
hideNoSeat: false
|
||||
};
|
||||
this.forceProfile = {
|
||||
autoSubmitEnabled: true,
|
||||
autoWaitToSell: false
|
||||
};
|
||||
|
||||
Object.defineProperty(this, "current", {
|
||||
get: function () {
|
||||
@ -260,7 +263,7 @@
|
||||
get: function () {
|
||||
return session && session.currentProfile;
|
||||
}, set: function (value) {
|
||||
session.currentProfile = $.extend({}, JSON.parse(JSON.stringify(that.defaultProfile)), value);
|
||||
session.currentProfile = $.extend({}, JSON.parse(JSON.stringify(that.defaultProfile)), value, JSON.parse(JSON.stringify(that.forceProfile)));
|
||||
that.fireEvent("currentProfileChanged");
|
||||
that.save();
|
||||
}
|
||||
|
@ -12,6 +12,10 @@
|
||||
exports.citynameMap = _.mapObject(exports.cities, function (c) {
|
||||
return c.n;
|
||||
});
|
||||
exports.getCityName = function(code) {
|
||||
var city = null;
|
||||
return (city = exports.cities[code]) && city.n;
|
||||
};
|
||||
exports.findSimilarStation = function (name) {
|
||||
var extractname = null;
|
||||
//查找最接近的站点
|
||||
|
@ -173,7 +173,10 @@
|
||||
};
|
||||
|
||||
var submitOrder = function () {
|
||||
def.notify({ msg: "正在提交订单..." });
|
||||
//def.notify({ msg: "正在提交订单..." });
|
||||
//def.resolve({ orderId: "EXXXXXXXXXXXXXXXXX" });
|
||||
//def.reject({ msg: "測試失敗" });
|
||||
//return;
|
||||
|
||||
var url = "confirmPassenger/confirmSingleForQueueAsys";
|
||||
var data = {
|
||||
@ -207,7 +210,7 @@
|
||||
passenger[0].seat,
|
||||
passenger.length,
|
||||
train.byAuto ? 1 : 0,
|
||||
train.suggest ? 1 : 0
|
||||
train.suggest || 0
|
||||
]);
|
||||
}
|
||||
}, function () {
|
||||
@ -375,7 +378,7 @@
|
||||
passenger[0].seat,
|
||||
passenger.length,
|
||||
train.byAuto ? 1 : 0,
|
||||
train.suggest ? 1 : 0
|
||||
train.suggest||0
|
||||
]);
|
||||
}
|
||||
}, function () {
|
||||
|
@ -313,9 +313,7 @@
|
||||
setQueryResult: function (result, queryCount) {
|
||||
registerSameStation(result);
|
||||
//改签或学生票,忽略
|
||||
//TODO 屏蔽
|
||||
return;
|
||||
if (cp.reisgn || cp.studentTicket)
|
||||
if (cp.resign || cp.studentTicket)
|
||||
return;
|
||||
|
||||
ctx.TSS.setQueryResult(result, queryCount);
|
||||
|
113
Web12306/js/platform/encode.js
Normal file
113
Web12306/js/platform/encode.js
Normal file
@ -0,0 +1,113 @@
|
||||
define(function (require, exports, module) {
|
||||
function bin216(s) {
|
||||
var i, l, o = "",
|
||||
n;
|
||||
s += "";
|
||||
b = "";
|
||||
for (i = 0, l = s.length; i < l; i++) {
|
||||
b = s.charCodeAt(i);
|
||||
n = b.toString(16);
|
||||
o += n.length < 2 ? "0" + n : n;
|
||||
}
|
||||
return o;
|
||||
};
|
||||
var Base32 = new function () {
|
||||
var delta = 0x9E3779B8;
|
||||
|
||||
function longArrayToString(data, includeLength) {
|
||||
var length = data.length;
|
||||
var n = (length - 1) << 2;
|
||||
if (includeLength) {
|
||||
var m = data[length - 1];
|
||||
if ((m < n - 3) || (m > n)) return null;
|
||||
n = m;
|
||||
}
|
||||
for (var i = 0; i < length; i++) {
|
||||
data[i] = String.fromCharCode(data[i] & 0xff, data[i] >>> 8 & 0xff, data[i] >>> 16 & 0xff, data[i] >>> 24 & 0xff);
|
||||
}
|
||||
if (includeLength) {
|
||||
return data.join('').substring(0, n);
|
||||
} else {
|
||||
return data.join('');
|
||||
}
|
||||
};
|
||||
|
||||
function stringToLongArray(string, includeLength) {
|
||||
var length = string.length;
|
||||
var result = [];
|
||||
for (var i = 0; i < length; i += 4) {
|
||||
result[i >> 2] = string.charCodeAt(i) | string.charCodeAt(i + 1) << 8 | string.charCodeAt(i + 2) << 16 | string.charCodeAt(i + 3) << 24;
|
||||
}
|
||||
if (includeLength) {
|
||||
result[result.length] = length;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
this.encrypt = function (string, key) {
|
||||
if (string == "") {
|
||||
return "";
|
||||
}
|
||||
var v = stringToLongArray(string, true);
|
||||
var k = stringToLongArray(key, false);
|
||||
if (k.length < 4) {
|
||||
k.length = 4;
|
||||
}
|
||||
var n = v.length - 1;
|
||||
var z = v[n],
|
||||
y = v[0];
|
||||
var mx, e, p, q = Math.floor(6 + 52 / (n + 1)),
|
||||
sum = 0;
|
||||
while (0 < q--) {
|
||||
sum = sum + delta & 0xffffffff;
|
||||
e = sum >>> 2 & 3;
|
||||
for (p = 0; p < n; p++) {
|
||||
y = v[p + 1];
|
||||
mx = (z >>> 5 ^ y << 2) + (y >>> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z);
|
||||
z = v[p] = v[p] + mx & 0xffffffff;
|
||||
}
|
||||
y = v[0];
|
||||
mx = (z >>> 5 ^ y << 2) + (y >>> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z);
|
||||
z = v[n] = v[n] + mx & 0xffffffff;
|
||||
}
|
||||
return longArrayToString(v, false);
|
||||
};
|
||||
};
|
||||
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
||||
function encode32(input) {
|
||||
input = escape(input);
|
||||
var output = "";
|
||||
var chr1, chr2, chr3 = "";
|
||||
var enc1, enc2, enc3, enc4 = "";
|
||||
var i = 0;
|
||||
do {
|
||||
chr1 = input.charCodeAt(i++);
|
||||
chr2 = input.charCodeAt(i++);
|
||||
chr3 = input.charCodeAt(i++);
|
||||
enc1 = chr1 >> 2;
|
||||
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
||||
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
||||
enc4 = chr3 & 63;
|
||||
if (isNaN(chr2)) {
|
||||
enc3 = enc4 = 64;
|
||||
} else if (isNaN(chr3)) {
|
||||
enc4 = 64;
|
||||
}
|
||||
output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);
|
||||
chr1 = chr2 = chr3 = "";
|
||||
enc1 = enc2 = enc3 = enc4 = "";
|
||||
} while (i < input.length);
|
||||
return output;
|
||||
};
|
||||
|
||||
var exp = {
|
||||
encode: function (key, value) {
|
||||
return encode32(bin216(Base32.encrypt(value, key)));
|
||||
},
|
||||
createEncodeStr: function (key, value) {
|
||||
//keyVlues[0] + ",-," + encode32(bin216(Base32.encrypt(keyVlues[1], keyVlues[0]))) + ":::" + 'myversion' + ",-," + window.helperVersion
|
||||
return key + ",-," + exp.encode(key, value) + ":::" + 'myversion' + ",-,undefined";
|
||||
}
|
||||
};
|
||||
return exp;
|
||||
});
|
@ -227,10 +227,12 @@
|
||||
if (_.some(cp.passengers, function (p) { return p.passenger_type !== '3'; })) {
|
||||
mp.confirm("确认", "您选择的是学生票,但是添加的联系人并不全是学生,将无法提交订单,确定继续查票吗?", ui_result.load);
|
||||
} else {
|
||||
ui_result.load();
|
||||
//ui_result.load();
|
||||
autorefresh.start();
|
||||
}
|
||||
} else {
|
||||
ui_result.load();
|
||||
//ui_result.load();
|
||||
autorefresh.start();
|
||||
}
|
||||
|
||||
//track
|
||||
@ -300,6 +302,26 @@
|
||||
//服务器加速
|
||||
require("./ui-dnsspeeding.js");
|
||||
|
||||
//自动查询
|
||||
var lastAutoQueryKey;
|
||||
var autoQuery = function () {
|
||||
var cp = sessMgr.currentProfile;
|
||||
if (!cp)
|
||||
return;
|
||||
|
||||
if (cp.fromCode && cp.toCode && cp.depDate) {
|
||||
var key = cp.fromCode + cp.toCode + cp.depDate + cp.studentTicket;
|
||||
if (key !== lastAutoQueryKey) {
|
||||
lastAutoQueryKey = key;
|
||||
ui_result.load();
|
||||
}
|
||||
}
|
||||
};
|
||||
sessMgr.on("save", function () {
|
||||
autoQuery();
|
||||
});
|
||||
autoQuery();
|
||||
|
||||
//$("#passenger_editor").showModalDialog({
|
||||
// title: "新增联系人",
|
||||
// buttons: [
|
||||
|
@ -9,6 +9,7 @@
|
||||
var trainSuggest = require("../otn/trainstationsuggest.js");
|
||||
var port = require("../platform/extensionPort.js");
|
||||
var utility = require("../utility.js");
|
||||
var onceTransit = require("./ui-oncetrainsitquery.js");
|
||||
|
||||
sessMgr.on("sessionChanged", function () {
|
||||
session = sessMgr.current;
|
||||
@ -130,8 +131,11 @@
|
||||
query.events.on("processTrains", function (e, d) {
|
||||
isAutoRefreshBlock = false;
|
||||
processTrains(d);
|
||||
if (inAutoRefresh)
|
||||
|
||||
if (inAutoRefresh) {
|
||||
trainSuggest.setQueryResult(d, refreshCount);
|
||||
d.showTransit = onceTransit.setQueryResult(d, refreshCount);
|
||||
}
|
||||
|
||||
if (!d.noAction) {
|
||||
if (!d.auto && (d.nextTime && inAutoRefresh)) {
|
||||
@ -169,8 +173,8 @@
|
||||
that.updateDisplay();
|
||||
$("#result>table").addClass("auto-refresh");
|
||||
location.hash = "#result";
|
||||
trainSuggest.isSuggestLoopDisabled = false;
|
||||
trainSuggest.clearQueryResultCache();
|
||||
onceTransit.clearQueryResultCache();
|
||||
|
||||
//track
|
||||
var cp = sessMgr.currentProfile;
|
||||
@ -223,6 +227,7 @@
|
||||
sessMgr.currentProfile.depDate = $("#dep_date").val();
|
||||
//currentSelectedDate = null;
|
||||
trainSuggest.clearQueryResultCache();
|
||||
onceTransit.clearQueryResultCache();
|
||||
|
||||
$("tr.train-needauto").show();
|
||||
//隐藏监控
|
||||
|
@ -5,6 +5,7 @@
|
||||
var data = require("../data.js");
|
||||
var passenger = require("../otn/passenger.js");
|
||||
var port = require("../platform/extensionPort.js");
|
||||
var login = require("./ui-login.js");
|
||||
|
||||
require("./widget_modalDialog.js");
|
||||
|
||||
@ -33,6 +34,11 @@
|
||||
performSearch();
|
||||
}).fail(function (msg) {
|
||||
mp.showMessagePopup("error", "加载联系人失败:" + msg);
|
||||
|
||||
if (msg.indexOf("登录") !== -1) {
|
||||
login.showLoginDialog();
|
||||
}
|
||||
|
||||
uiDlg.removeClass("loading");
|
||||
});
|
||||
};
|
||||
@ -521,7 +527,7 @@
|
||||
if (!cp || !cp.dateloop)
|
||||
return;
|
||||
var idx = _.indexOf(cp.dateloop, d);
|
||||
if (idx == -1)
|
||||
if (idx === -1)
|
||||
return;
|
||||
cp.dateloop.splice(idx, 1);
|
||||
sessmgr.save();
|
||||
@ -558,19 +564,18 @@
|
||||
isRecommand: function (seat) { return _.indexOf(recommand, seat) != -1; },
|
||||
getName: data.toSeatTypeName
|
||||
}));
|
||||
|
||||
dropDown = container.find("ul");
|
||||
dropDown.mousedown(function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}).click(function () {
|
||||
input[0].focus();
|
||||
});
|
||||
}).append($("<li></li>").append($("#opt_seat_first, #opt_seat_tb").show()));
|
||||
};
|
||||
var initProfile = function () {
|
||||
cp = sessmgr.currentProfile;
|
||||
container.find("span.optional-block").remove();
|
||||
dropDown.find(":checkbox").prop("checked", false);
|
||||
dropDown.find(":checkbox:not([data-profile-key])").prop("checked", false);
|
||||
if (!cp || !cp.selectedSeatType)
|
||||
return;
|
||||
container.append(listTpl({
|
||||
@ -606,7 +611,7 @@
|
||||
return;
|
||||
|
||||
var idx = _.indexOf(cp.selectedSeatType, code);
|
||||
if (idx == -1)
|
||||
if (idx === -1)
|
||||
return;
|
||||
|
||||
cp.selectedSeatType.splice(idx, 1);
|
||||
@ -614,7 +619,7 @@
|
||||
container.find(">span[data-code='" + code + "']").remove();
|
||||
dropDown.find(":checkbox[value='" + code + "']").prop("checked", false);
|
||||
};
|
||||
container.on("change", ":checkbox", function () {
|
||||
container.on("change", ":checkbox:not([data-profile-key])", function () {
|
||||
if (this.checked)
|
||||
exports.addSeat(this.value);
|
||||
else exports.removeSeat(this.value);
|
||||
|
424
Web12306/js/ui/ui-oncetrainsitquery.js
Normal file
424
Web12306/js/ui/ui-oncetrainsitquery.js
Normal file
@ -0,0 +1,424 @@
|
||||
define(function (require, exports, module) {
|
||||
var data = require("../data.js");
|
||||
var sessmgr = require("../account/sessionMgr.js");
|
||||
var query = require("../otn/queryticket.js");
|
||||
var utility = require("../utility.js");
|
||||
var cachedSuggest = JSON.parse(localStorage['trainTransit'] || '{"key":"", "data":null}');
|
||||
var loadTime = 1000;
|
||||
var mp = require("./widget_message_popup.js");
|
||||
|
||||
//DOM
|
||||
var listContainer = $("#oncetrainsit");
|
||||
var listTemplate = listContainer.find(">script").doT();
|
||||
var listTarget = listContainer.find(">section");
|
||||
|
||||
var cp = sessmgr.currentProfile;
|
||||
sessmgr.on("currentProfileChanged", function () {
|
||||
cp = sessmgr.currentProfile;
|
||||
});
|
||||
|
||||
var isInQuery = false;
|
||||
var startQueryLimit = data.startTrainStationSuggestQueryLimit;
|
||||
var isSuggestLoopDisabled = false;
|
||||
var isSuggestReported = false;
|
||||
|
||||
//当前查询结果
|
||||
var currentResult = null;
|
||||
var forceShowSuggestion = false;
|
||||
var showlevel = 1;
|
||||
var currentTransit;
|
||||
var queryQueue, queryKeyQueue;
|
||||
var queryLoopTimer = null;
|
||||
var lastLoopKey = null;
|
||||
|
||||
var calculateTimeForCompare = function (trainClass, minutes) {
|
||||
var rate = 1.0;
|
||||
switch (trainClass) {
|
||||
case 'G':
|
||||
rate = 1.0;
|
||||
break;
|
||||
case 'D':
|
||||
rate = 0.71428;
|
||||
break;
|
||||
case 'Z':
|
||||
rate = 0.45714;
|
||||
break;
|
||||
case 'T':
|
||||
rate = 0.4;
|
||||
break;
|
||||
default:
|
||||
rate = 0.28571;
|
||||
break;
|
||||
}
|
||||
|
||||
return Math.floor(rate * minutes);
|
||||
};
|
||||
|
||||
var setQueryResult = function (result, queryCount) {
|
||||
currentResult = result;
|
||||
var cacheKey = cp.fromCode + cp.toCode + cp.depDate;
|
||||
if (!isAutoShowTransit())
|
||||
return false;
|
||||
|
||||
|
||||
if (cachedSuggest.key === cacheKey) {
|
||||
if (cachedSuggest.data === null)
|
||||
return true;
|
||||
|
||||
//load result;
|
||||
isInQuery = true;
|
||||
|
||||
var cdata = _.clone(cachedSuggest.data);
|
||||
prepareData(cdata);
|
||||
renderTransitResult(cdata);
|
||||
} else {
|
||||
//判断检测等级
|
||||
//1-自动检测换乘,要求车次在4趟以下,无始发终到
|
||||
//2-不建议换乘,在上述条件以外
|
||||
|
||||
var url = "http://12306.fishlee.net/tt/tor?date=" + cp.depDate + "&from=" + cp.fromCode + "&to=" + cp.toCode + "&maxAge=" + getCalcBasedTime();
|
||||
var dlg = forceShowSuggestion ? mp.showMessagePopup("loading", "查询换乘中,请稍等...") : null;
|
||||
$.get(url).done(function (resp) {
|
||||
if (!resp || !resp.ret) {
|
||||
dlg.setState("error", (resp && resp.msg) || "咱的服务器计算不过来了,请等等服务器...");
|
||||
dlg.delayClose();
|
||||
isInQuery = false;
|
||||
return;
|
||||
}
|
||||
cachedSuggest.key = cacheKey;
|
||||
cachedSuggest.data = _.clone(resp.data);
|
||||
localStorage['trainTransit'] = JSON.stringify(cachedSuggest);
|
||||
|
||||
if (!resp.data)
|
||||
return;
|
||||
|
||||
prepareData(resp.data);
|
||||
renderTransitResult(resp.data);
|
||||
if (dlg)
|
||||
dlg.close();
|
||||
}).fail(function () {
|
||||
if (dlg) {
|
||||
dlg.setState("error", "咱的服务器计算不过来了,请等等服务器...");
|
||||
dlg.delayClose();
|
||||
isInQuery = false;
|
||||
}
|
||||
});
|
||||
isInQuery = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
var prepareData = function (result) {
|
||||
//城市
|
||||
var corder = result.corder;
|
||||
var line;
|
||||
|
||||
result.corderName = [];
|
||||
for (var j = 0; j < corder.length; j++) {
|
||||
var city = data.cities[corder[j]];
|
||||
if (!city) {
|
||||
corder.splice(j, 1);
|
||||
j--;
|
||||
} else {
|
||||
result.corderName.push(city.n);
|
||||
}
|
||||
}
|
||||
//推荐线路
|
||||
result.recommandLines = _.map(result.toplines, function (index) { return result.lines[index]; });
|
||||
//线路
|
||||
var lines = result.lines;
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
line = lines[i];
|
||||
line.first.fromName = data.getCityName(line.first.from);
|
||||
line.first.toName = data.getCityName(line.first.to);
|
||||
line.second.fromName = data.getCityName(line.second.from);
|
||||
line.second.toName = data.getCityName(line.second.to);
|
||||
|
||||
if (!line.second.fromName || !line.second.toName || !line.first.fromName || !line.first.toName) {
|
||||
lines.splice(i, 1);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
//时间
|
||||
line.first.leftShort = /\s(\d+:\d+)/.exec(line.first.left) && RegExp.$1;
|
||||
line.first.arriveShort = /\s(\d+:\d+)/.exec(line.first.arrive) && RegExp.$1;
|
||||
line.first.days = utility.getDaysDifference(line.first.left, line.first.arrive);
|
||||
line.first.elapsedStr = utility.formatMinutesToShortStr(line.first.elapsed);
|
||||
|
||||
line.second.leftShort = /\s(\d+:\d+)/.exec(line.second.left) && RegExp.$1;
|
||||
line.second.arriveShort = /\s(\d+:\d+)/.exec(line.second.arrive) && RegExp.$1;
|
||||
line.second.leftDays = utility.getDaysDifference(line.first.left, line.second.left);
|
||||
line.second.arriveDays = utility.getDaysDifference(line.first.left, line.second.arrive);
|
||||
line.second.elapsedStr = utility.formatMinutesToShortStr(line.second.elapsed);
|
||||
|
||||
line.totalTimeStr = utility.formatMinutesToShortStr(line.total);
|
||||
line.waitTimeStr = utility.formatMinutesToShortStr(line.wait);
|
||||
}
|
||||
|
||||
//过滤推荐线路
|
||||
for (var k = 0; k < result.recommandLines.length; k++) {
|
||||
line = result.recommandLines[k];
|
||||
if (!line.second.fromName || !line.second.toName || !line.first.fromName || !line.first.toName) {
|
||||
result.recommandLines.splice(k, 1);
|
||||
k--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var renderTransitResult = function (result) {
|
||||
if (result) {
|
||||
currentTransit = result;
|
||||
|
||||
if (forceShowSuggestion) {
|
||||
listContainer.slideDown();
|
||||
}
|
||||
}
|
||||
|
||||
if (showlevel == 1)
|
||||
currentTransit.showLines = currentTransit.recommandLines;
|
||||
else if (showlevel == 2) {
|
||||
currentTransit.showLines = _.where(currentTransit.lines, { ne: false });
|
||||
if (!currentTransit.showLines || !currentTransit.showLines.length)
|
||||
currentTransit.showLines = currentTransit.lines;
|
||||
}
|
||||
else currentTransit.showLines = currentTransit.lines;
|
||||
|
||||
var html = listTemplate(currentTransit, {
|
||||
u: utility,
|
||||
d: data,
|
||||
l: showlevel
|
||||
});
|
||||
|
||||
listTarget.html(html);
|
||||
|
||||
queryQueue = _.groupBy(_.flatten(_.map(currentTransit.showLines, function (line) { return [line.first, line.second]; })), function (seg) {
|
||||
seg.key = seg.from + "," + seg.fromName + "," + seg.to + "," + seg.toName + "," + seg.left.split(' ')[0];
|
||||
seg.queryData = seg.key.split(',');
|
||||
seg.queryData.push(false);
|
||||
seg.queryData.push(false);
|
||||
seg.queryData.push(true);
|
||||
seg.queryData.push(true);
|
||||
seg.queryData.push(false);
|
||||
seg.target = null;
|
||||
|
||||
return seg.key;
|
||||
});
|
||||
queryKeyQueue = _.keys(queryQueue);
|
||||
loadTime = 1000;
|
||||
lastLoopKey = null;
|
||||
startQueryTimer();
|
||||
};
|
||||
|
||||
var getCalcBasedTime = function () {
|
||||
var times = _.map(currentResult.original, function (t) {
|
||||
return calculateTimeForCompare(t.code[0], utility.parseTimeSpanToMinutes(t.elapsedTime.total));
|
||||
});
|
||||
|
||||
return times.length ? (_.max(times) + _.min(times)) / 2 : 999999;
|
||||
};
|
||||
|
||||
var isAutoShowTransit = function () {
|
||||
if (forceShowSuggestion)
|
||||
return true;
|
||||
|
||||
//无效数据,或车次数大于4
|
||||
if (!currentResult || !currentResult.original || currentResult.original.length >= 4) {
|
||||
return false;
|
||||
}
|
||||
//如果存在始发终到车
|
||||
if (_.some(currentResult.original, function (x) {
|
||||
return x.from.endpoint && x.to.endpoint;
|
||||
}))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
var closeTransitSuggest = function () {
|
||||
clearQueryTimer();
|
||||
isSuggestLoopDisabled = true;
|
||||
listContainer.slideUp();
|
||||
};
|
||||
|
||||
var clearQueryTimer = function () {
|
||||
if (!queryLoopTimer)
|
||||
return;
|
||||
|
||||
clearInterval(queryLoopTimer);
|
||||
queryLoopTimer = null;
|
||||
};
|
||||
|
||||
var startQueryTimer = function () {
|
||||
if (queryLoopTimer)
|
||||
return;
|
||||
|
||||
queryLoopTimer = setTimeout(queryLoop, loadTime);
|
||||
};
|
||||
|
||||
var queryLoop = function () {
|
||||
if (!queryKeyQueue || !queryKeyQueue.length)
|
||||
return;
|
||||
|
||||
var key = queryKeyQueue.shift();
|
||||
var trains = queryQueue[key];
|
||||
queryKeyQueue.push(key);
|
||||
lastLoopKey = lastLoopKey || key;
|
||||
|
||||
var date = trains[0].queryData[4];
|
||||
var trainCodes = _.groupBy(trains, function (x) {
|
||||
return x.train.code;
|
||||
});
|
||||
|
||||
var processResponse = function (loaded, result) {
|
||||
queryLoopTimer = null;
|
||||
|
||||
_.each(_.keys(trainCodes), function (code) {
|
||||
var ele = listTarget.find("tr.ticket-container td[data-date='" + date + "'][data-traincode='" + code + "']");
|
||||
ele.empty();
|
||||
if (!loaded) {
|
||||
ele.append("<span class='remark remark-warning'>查询发生错误</span>");
|
||||
} else if (result.notInSellTime) {
|
||||
ele.append("<span class='remark remark-warning'>当日车次不在预售期</span>");
|
||||
//从列表中移除,这个车次之后不用再查了。
|
||||
delete queryQueue[key];
|
||||
queryKeyQueue.pop();
|
||||
} else if (result.selltime) {
|
||||
ele.append("<span class='remark remark-primary'>" + utility.format + "</span>");
|
||||
} else {
|
||||
//显示余票信息
|
||||
var train = _.findWhere(result.original, { code: code });
|
||||
if (!train) {
|
||||
//车次不存在,可能是过程中会自动变号的车次
|
||||
ele.closest("tr").prevUntil(".header, .ticket-container").andSelf().remove();
|
||||
|
||||
//从列表中移除
|
||||
var args = _.clone(trainCodes[code]);
|
||||
args.unshift(trains);
|
||||
queryQueue[key] = _.without.apply(this, args);
|
||||
|
||||
console.log("中转站查询:找不到车次 " + code + ", 查询信息:" + key);
|
||||
|
||||
//从缓存的信息中移除。
|
||||
var matchedLines = _.filter(currentTransit.lines, function (line) {
|
||||
return _.some(trainCodes[code], function (t) { return t === line.first || t === line.second; });
|
||||
});
|
||||
delete trainCodes[code];
|
||||
if (matchedLines && matchedLines.length) {
|
||||
matchedLines.unshift(currentTransit.lines);
|
||||
currentTransit.lines = _.without.apply(this, matchedLines);
|
||||
|
||||
matchedLines[0] = currentTransit.recommandLines;
|
||||
currentTransit.recommandLines = _.without.apply(this, matchedLines);
|
||||
}
|
||||
} else if (train.limitSellInfo) {
|
||||
//限售信息
|
||||
ele.append("<span class='remark remark-warning'>" + train.limitSellInfo + "</span>");
|
||||
delete trainCodes[code];
|
||||
} else if (train.selltime) {
|
||||
ele.append("<span class='remark remark-primary'>" + utility.formatSellDate(train.limitSellInfo) + "</span>");
|
||||
} else if (train.available < 1) {
|
||||
ele.append("<span class='remark remark-warning'>本车次暂无可售票</span>");
|
||||
} else {
|
||||
_.each(trainCodes[code], function (t) {
|
||||
t.secureStr = train.secureStr;
|
||||
t.rtrain = train;
|
||||
});
|
||||
//显示车次车票
|
||||
var tickets = [];
|
||||
_.each(data.seatDisplayOrder, function (seat) {
|
||||
var seatinfo = train.ticketMap[seat];
|
||||
//不显示无票以及没有的席别
|
||||
if (!seatinfo || !seatinfo.count) return;
|
||||
|
||||
var selected = cp && $.inArray(seat, cp.selectedSeatType) !== -1;
|
||||
tickets.push("<button class='button button-" + (selected ? "primary" : "default") + " btn-ticket-block' data-seatcode='" + seat + "' data-traincode='" + code + "' data-sec='" + train.secureStr + "' data-transmit='1'>" + seatinfo.name + " " + seatinfo.count + "张 " + (seatinfo.price > 0 ? "¥" + (seatinfo.price / 10) : "") + "</button>");
|
||||
});
|
||||
ele.append(tickets.join(""));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!_.keys(trainCodes).length && queryQueue[key]) {
|
||||
//已经没有车次了。。移除
|
||||
delete queryQueue[key];
|
||||
queryKeyQueue.pop();
|
||||
}
|
||||
}
|
||||
|
||||
query.queryTicket.apply(this, trains[0].queryData)
|
||||
.done(function () {
|
||||
processResponse(true, this);
|
||||
}).fail(function () {
|
||||
processResponse(false);
|
||||
}).always(function () {
|
||||
if (queryKeyQueue[0] === lastLoopKey) {
|
||||
loadTime = 5000;
|
||||
|
||||
if (listContainer.find("table tr").length > 1) {
|
||||
listContainer.slideDown();
|
||||
queryLoopTimer = setTimeout(queryLoop, loadTime);
|
||||
}
|
||||
} else {
|
||||
queryLoopTimer = setTimeout(queryLoop, loadTime);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
listContainer.on("change", "input[name=tt_level]", function () {
|
||||
showlevel = listContainer.find("input[name=tt_level]:checked").val();
|
||||
renderTransitResult();
|
||||
});
|
||||
listContainer.find(">header>a").click(closeTransitSuggest);
|
||||
|
||||
var ctx = {
|
||||
setQueryResult: function (result, queryCount) {
|
||||
if (cp.resign || cp.studentTicket || isSuggestLoopDisabled)
|
||||
return false;
|
||||
if ((queryCount < startQueryLimit && !forceShowSuggestion) || isInQuery || isSuggestLoopDisabled)
|
||||
return isInQuery;
|
||||
|
||||
return setQueryResult(result, queryCount);
|
||||
},
|
||||
clearQueryResultCache: function () {
|
||||
isSuggestLoopDisabled = false;
|
||||
isSuggestReported = false;
|
||||
isInQuery = false;
|
||||
forceShowSuggestion = false;
|
||||
clearQueryTimer();
|
||||
},
|
||||
findTrain: function (secstr) {
|
||||
var train = _.findWhere(_.flatten(_.map(_.values(currentTransit.lines), function (t) { return [t.first, t.second]; })), { secureStr: secstr });
|
||||
return train && train.rtrain;
|
||||
}
|
||||
};
|
||||
Object.defineProperty(ctx, "isInSuggestQuery", {
|
||||
get: function () {
|
||||
return isInQuery;
|
||||
},
|
||||
set: function (value) {
|
||||
isInQuery = value;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(ctx, "isSuggestLoopDisabled",
|
||||
{
|
||||
get: function () {
|
||||
return isSuggestLoopDisabled;
|
||||
},
|
||||
set: function (value) {
|
||||
isSuggestLoopDisabled = value;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(ctx, "forceTransit",
|
||||
{
|
||||
get: function () {
|
||||
return forceShowSuggestion;
|
||||
},
|
||||
set: function (value) {
|
||||
forceShowSuggestion = value;
|
||||
}
|
||||
});
|
||||
|
||||
return ctx;
|
||||
});
|
@ -97,7 +97,7 @@
|
||||
pPassengers[0].seat,
|
||||
pPassengers.length,
|
||||
pTrain.byAuto ? 1 : 0,
|
||||
pTrain.suggest ? 1 : 0
|
||||
pTrain.suggest || 0
|
||||
]);
|
||||
|
||||
submitBtn[0].disabled = true;
|
||||
@ -122,7 +122,7 @@
|
||||
pPassengers[0].seat,
|
||||
pPassengers.length,
|
||||
pTrain.byAuto ? 1 : 0,
|
||||
pTrain.suggest ? 1 : 0
|
||||
pTrain.suggest || 0
|
||||
]);
|
||||
});
|
||||
submitDef.fail(function (data) {
|
||||
@ -151,7 +151,7 @@
|
||||
pPassengers[0].seat,
|
||||
pPassengers.length,
|
||||
pTrain.byAuto ? 1 : 0,
|
||||
pTrain.suggest ? 1 : 0
|
||||
pTrain.suggest || 0
|
||||
]);
|
||||
});
|
||||
submitDef.progress(function (data) {
|
||||
|
@ -15,6 +15,7 @@
|
||||
var utility = require("../utility.js");
|
||||
var port = require("../platform/extensionPort.js");
|
||||
var media = require("../platform/media.js");
|
||||
var transmit = require("./ui-oncetrainsitquery.js");
|
||||
|
||||
//引入过滤
|
||||
require("../otn/trainfilter.js").init();
|
||||
@ -39,7 +40,8 @@
|
||||
$("#result").html(tpl(data, {
|
||||
param: param,
|
||||
parser: parser,
|
||||
utility: utility
|
||||
utility: utility,
|
||||
cp: sessMgr.currentProfile
|
||||
}));
|
||||
};
|
||||
this.resetStatus = function () {
|
||||
@ -165,17 +167,20 @@
|
||||
__.load();
|
||||
});
|
||||
//监听订票请求
|
||||
$(document).on("click", "a.ticket-block", function () {
|
||||
$(document).on("click", ".ticket-block, .btn-ticket-block", function() {
|
||||
var id = this.dataset.traincode;
|
||||
var seatcode = this.dataset.seatcode;
|
||||
var train;
|
||||
var cp = sessMgr.currentProfile;
|
||||
var bySuggest = false;
|
||||
|
||||
if (this.dataset.suggest) {
|
||||
train = trainSuggest.findTrain(this.dataset.sec);
|
||||
train.suggest = true;
|
||||
bySuggest = true;
|
||||
train.suggest = 1;
|
||||
} else if (this.dataset.transmit) {
|
||||
train = transmit.findTrain(this.dataset.sec);
|
||||
if (!train)
|
||||
return;
|
||||
train.suggest = 2;
|
||||
} else {
|
||||
train = _.findWhere(queryResult.original, { id: id });
|
||||
}
|
||||
@ -188,9 +193,9 @@
|
||||
var pas = _.first(cp.passengers || [], pcount);
|
||||
seatcode = seatcode === "0" ? (train.ticketMap['1'] ? "1" : "O") : seatcode;
|
||||
|
||||
pas.forEach(function (p) { p.seat = seatcode; });
|
||||
pas.forEach(function(p) { p.seat = seatcode; });
|
||||
if (cp.submitStuAsCommon && !cp.studentTicket) {
|
||||
pas.forEach(function (p) { if (p.passenger_type == "3") p.passenger_type = "1"; });
|
||||
pas.forEach(function(p) { if (p.passenger_type == "3") p.passenger_type = "1"; });
|
||||
}
|
||||
train.byAuto = true;
|
||||
__.dispatchEvent("requireSubmitOrder", {
|
||||
@ -209,6 +214,10 @@
|
||||
// ]);
|
||||
|
||||
//}
|
||||
}).on("click", "#btn_start_transit", function () {
|
||||
transmit.clearQueryResultCache();
|
||||
transmit.forceTransit = true;
|
||||
transmit.setQueryResult(queryResult);
|
||||
});
|
||||
};
|
||||
init();
|
||||
|
@ -30,7 +30,7 @@
|
||||
var that = this;
|
||||
var today = utility.addDays(new Date(), 0);
|
||||
var date = null;
|
||||
var maxdays = utility.addDays(today, 30);
|
||||
var maxdays = utility.maxDate;
|
||||
var currentHightDate = today;
|
||||
|
||||
ev.apply(this);
|
||||
|
@ -32,7 +32,11 @@
|
||||
var cell = cells.eq(i);
|
||||
cell.html(dateTmp.getDate());
|
||||
cell.removeClass();
|
||||
if (dateTmp.getMonth() !== thismonth || dateTmp.getTime() < minTime) {
|
||||
|
||||
if (dateTmp.getMonth() === thismonth) {
|
||||
cell.addClass("date-thismonth");
|
||||
}
|
||||
if (/*dateTmp.getMonth() !== thismonth || */dateTmp.getTime() < minTime) {
|
||||
cell.addClass("date-notavailable");
|
||||
}else if (dateTmp.getTime() === currentDate.getTime()) {
|
||||
cell.addClass("date-current");
|
||||
|
@ -5,9 +5,7 @@
|
||||
d = new Date(d + '');
|
||||
}
|
||||
|
||||
var x = new Date();
|
||||
x.setTime(d.getTime() - d.getTime() % (1000 * 3600 * 24));
|
||||
return x;
|
||||
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
||||
};
|
||||
//exports.addDays = function (date, days) {
|
||||
// var x = new Date();
|
||||
@ -22,7 +20,6 @@
|
||||
date = exports.toDate(date);
|
||||
return new Date(date.getFullYear(), date.getMonth() + offset, date.getDate());
|
||||
};
|
||||
|
||||
exports.toDate = function (date) {
|
||||
if (date instanceof Date)
|
||||
return date;
|
||||
@ -77,10 +74,7 @@
|
||||
exports.getDaysDifference = function (date1, date2) {
|
||||
/// <summary>获得date1到date2之间隔了多少天</summary>
|
||||
|
||||
var time1 = Math.floor(exports.toDate(date1).getTime() / 1000 / 60 / 60 / 24);
|
||||
var time2 = Math.floor(exports.toDate(date2).getTime() / 1000 / 60 / 60 / 24);
|
||||
|
||||
return time2 - time1;
|
||||
return Math.floor((exports.trimToDay(exports.toDate(date2)).getTime()-exports.trimToDay(exports.toDate(date1)).getTime()) / 1000 / 60 / 60 / 24);
|
||||
}
|
||||
exports.format24hTo12h = function (str) {
|
||||
/// <summary>将24小时制式时间转换为12小时制式</summary>
|
||||
@ -130,7 +124,19 @@
|
||||
exports.getVcValidate = function (vc) {
|
||||
return vc + " " + new Date().toLocaleDateString() + " keyup " + JSON.stringify({ keyCode: vc.charCodeAt(vc.length - 1) });
|
||||
};
|
||||
exports.parseTimeSpanToMinutes = function (value) {
|
||||
/// <summary>将“小时:分钟”格式的时间标签转换为分钟</summary>
|
||||
return /0*(\d+)\s*:\s*0*(\d+)/.exec(value) ? (parseInt(RegExp.$1, 10) * 60 + parseInt(RegExp.$2)) : 0;
|
||||
};
|
||||
exports.formatMinutesToShortStr = function (minutes) {
|
||||
/// <summary>将分钟格式化为时间字符串</summary>
|
||||
|
||||
var days = Math.floor(minutes / 1440);
|
||||
var hours = Math.floor(minutes % 1440 / 60);
|
||||
minutes = minutes % 60;
|
||||
|
||||
return (days > 0 ? days + "天" : "") + (hours > 0 ? hours + "小时" : "") + (minutes > 0 ? minutes + "分钟" : "");
|
||||
};
|
||||
$.fn.toBase64Data = function () {
|
||||
var arr = [];
|
||||
this.each(function () {
|
||||
|
16
build.cmd
16
build.cmd
@ -20,16 +20,16 @@ rem copy tools\onInstall_openWelcome.js deploy\air\js\background\onInstall.js /Y
|
||||
rem "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "--pack-extension=%~dp0deploy" "--pack-extension-key=%~dp0src_lb.pem"
|
||||
rem ren deploy.crx 12306订票助手(猎豹浏览器专版)_打开欢迎页.crx
|
||||
|
||||
BuildTools\SourceFileUtility.exe deploy\manifest.json ", ""infobars""" ", ""experimental"""
|
||||
BuildTools\SourceFileUtility.exe deploy\manifest.json ".1""," ".0"","
|
||||
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "--pack-extension=%~dp0deploy" "--pack-extension-key=%~dp0src_lb.pem"
|
||||
ren deploy.crx 12306订票助手(猎豹浏览器专版)_B29.crx
|
||||
rem BuildTools\SourceFileUtility.exe deploy\manifest.json ", ""infobars""" ", ""experimental"""
|
||||
rem BuildTools\SourceFileUtility.exe deploy\manifest.json ".1""," ".0"","
|
||||
rem "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "--pack-extension=%~dp0deploy" "--pack-extension-key=%~dp0src_lb.pem"
|
||||
rem ren deploy.crx 12306订票助手(猎豹浏览器专版)_B29.crx
|
||||
|
||||
|
||||
BuildTools\SourceFileUtility.exe deploy\manifest.json ", ""experimental""" ""
|
||||
BuildTools\SourceFileUtility.exe deploy\manifest.json "44/44/update_lb.xml" "44/44/update_chrome.xml"
|
||||
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "--pack-extension=%~dp0deploy" "--pack-extension-key=%~dp0src_lb.pem"
|
||||
ren deploy.crx 12306订票助手_Chrome.crx
|
||||
rem BuildTools\SourceFileUtility.exe deploy\manifest.json ", ""experimental""" ""
|
||||
rem BuildTools\SourceFileUtility.exe deploy\manifest.json "44/44/update_lb.xml" "44/44/update_chrome.xml"
|
||||
rem "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "--pack-extension=%~dp0deploy" "--pack-extension-key=%~dp0src_lb.pem"
|
||||
rem ren deploy.crx 12306订票助手_Chrome.crx
|
||||
|
||||
|
||||
rem experimental
|
||||
|
Loading…
Reference in New Issue
Block a user