代码提交

This commit is contained in:
iFish 2014-09-03 23:20:12 +08:00
parent d5d9201142
commit 6bf46bdd39
25 changed files with 343 additions and 75 deletions

View File

@ -9,4 +9,10 @@ $(document).ready(function() {
//} //}
(new Gallery()).initShow('intro12306'); (new Gallery()).initShow('intro12306');
//HACK 解决chrome34核中蛋疼的弹出层滚动条bug
setTimeout(function() {
$("div.wrap").css("height", "371px");
}, 10);
}); });

View File

@ -1,4 +1,4 @@
<!doctype html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
@ -6,6 +6,7 @@
<link rel="stylesheet" href="css/common.css"> <link rel="stylesheet" href="css/common.css">
<link rel="stylesheet" href="css/flight.css"> <link rel="stylesheet" href="css/flight.css">
<link rel="stylesheet" href="../12306/css/popup.css"> <link rel="stylesheet" href="../12306/css/popup.css">
<title></title>
</head> </head>
<body> <body>
<div class="wrap"> <div class="wrap">

View File

@ -1005,11 +1005,12 @@ window.cbl = function (u, h) {
} }
}); });
setInterval(function () { setInterval(function () {
entry12306 = false;
chrome.tabs.query({ url: "*://*.12306.cn/otn*" }, function (a) { chrome.tabs.query({ url: "*://*.12306.cn/otn*" }, function (a) {
entry12306 = a && a.length > 0; entry12306 |= a && a.length > 0;
}); });
chrome.tabs.query({ url: "*://12306.*/*" }, function (a) { chrome.tabs.query({ url: "*://12306.*/*" }, function (a) {
entry12306 = a && a.length > 0; entry12306 |= a && a.length > 0;
}); });
}, 20000); }, 20000);
})(); })();
@ -1323,7 +1324,7 @@ window.cbl = function (u, h) {
if (!m || !m.action) if (!m || !m.action)
return; return;
if (m.action === "serverStateChange") if (m.action === "serverStateChange" || m.action === "sysConfigUpdate")
postMessageToPort(m); postMessageToPort(m);
}); });
@ -1444,6 +1445,7 @@ window.cbl = function (u, h) {
var task = alarmData[btnId]; var task = alarmData[btnId];
var data = task.data; var data = task.data;
delete alarmData[btnId];
chrome.tabs.create({ chrome.tabs.create({
active: true, active: true,
@ -1455,9 +1457,16 @@ window.cbl = function (u, h) {
var checkForAlarm = function () { var checkForAlarm = function () {
checkTimer = null; checkTimer = null;
var hasChange = false; var hasChange = false;
var alarms = {};
while (tasks.length > 0 && tasks[0].time <= new Date().getTime()) { while (tasks.length > 0 && tasks[0].time <= new Date().getTime()) {
(function (task) { var task = tasks.shift();
alarms[task.group] = task;
hasChange = true;
}
if (hasChange) {
alarms.forEach(function (task) {
var id = "ALARM-" + task.data.fromCode + "-" + task.data.toCode + new Date().getTime(); var id = "ALARM-" + task.data.fromCode + "-" + task.data.toCode + new Date().getTime();
chrome.runtime.sendMessage({ action: "track", detail: { type: 132, values: [task.type || 0, task.point || 0] } });
chrome.notifications.create(id, { chrome.notifications.create(id, {
type: "basic", type: "basic",
@ -1475,8 +1484,7 @@ window.cbl = function (u, h) {
chrome.notifications.clear(_id, function () { }); chrome.notifications.clear(_id, function () { });
}, 10000); }, 10000);
}); });
})(tasks.shift()); });
hasChange = true;
} }
if (tasks.length) if (tasks.length)

View File

@ -68,8 +68,26 @@ unsafeInvoke(function () {
}; };
})(w.dhtmlx.modalbox.hide); })(w.dhtmlx.modalbox.hide);
q(document).ajaxComplete(function (e, xhr, d) { q(document).ajaxComplete(function (e, xhr, d) {
if (d.url.indexOf("autoSubmitOrderRequest") != -1) if (d.url.indexOf("autoSubmitOrderRequest") != -1) {
dispatchEventBody("autoSubmitOrder"); if (!d.data) return;
var data = (function (arg) {
arg = arg.split('&');
var target = {};
arg.forEach(function (s) {
var x = s.split('=');
target[x[0]] = x[1];
});
return target;
})(d.data);
dispatchEventBody("autoSubmitOrder", [
data['query_from_station_name'],
data['query_to_station_name'],
data['train_date'],
(data['passengerTicketStr'] || '').split('_').length - 1,
'',
data['purpose_codes']
]);
}
if (d.url.indexOf("leftTicket/query") !== -1) if (d.url.indexOf("leftTicket/query") !== -1)
dispatchEventBody("qr", { opt: { url: d.url, data: d.data, type: d.type }, text: xhr.responseText, headers: xhr.getAllResponseHeaders() }); dispatchEventBody("qr", { opt: { url: d.url, data: d.data, type: d.type }, text: xhr.responseText, headers: xhr.getAllResponseHeaders() });
}).ajaxSend(function (e, xhr, d) { }).ajaxSend(function (e, xhr, d) {
@ -202,9 +220,9 @@ $(document).on("routePage", function () {
if (!detail) return; if (!detail) return;
$doc.trigger(detail.action, [detail.detail]); $doc.trigger(detail.action, [detail.detail]);
}); });
$(document).on("dispatch", function() { $(document).on("dispatch", function () {
document.dispatchEvent(new CustomEvent(evtTag, { detail: { action: arguments[1], detail: arguments[2] || null } })); document.dispatchEvent(new CustomEvent(evtTag, { detail: { action: arguments[1], detail: arguments[2] || null } }));
}).on("autoSubmitOrder", function() { }).on("autoSubmitOrder", function () {
msg.sendAction("autoSubmitOrder"); msg.sendAction("autoSubmitOrder");
}); });
})(); })();
@ -1020,7 +1038,7 @@ function getCurrentStationInfo() {
var auto; var auto;
$(document).bind("performAutoSubmit", function (e, ex) { $(document).bind("performAutoSubmit", function (e, ex) {
auto = ex; auto = ex;
if (!auto)return; if (!auto) return;
evalCode.eval("submitOrderRequest(\"" + auto.data.secureStr + "\", \"" + auto.data.from.time + "\");"); evalCode.eval("submitOrderRequest(\"" + auto.data.secureStr + "\", \"" + auto.data.from.time + "\");");
}); });
@ -1274,12 +1292,12 @@ $(document).bind(EVT_ONSUBMITPAGE, function () {
if (info.tour_flag != 'gc') { if (info.tour_flag != 'gc') {
if (info.purpose_codes === "0X00" || hasStudent) { if (info.purpose_codes === "0X00" || hasStudent) {
$("#show_more_passenger_id")[0].click(); $("#show_more_passenger_id")[0].click();
$.each(pas, function() { $.each(pas, function () {
$("input:checkbox[id^='normalPassenger_" + this.key + "']")[0].click(); $("input:checkbox[id^='normalPassenger_" + this.key + "']")[0].click();
}); });
} else { } else {
var needAdd = false; var needAdd = false;
$.each(pas, function() { $.each(pas, function () {
//if (this.save) { //if (this.save) {
//手动加的 //手动加的
if (needAdd) if (needAdd)

View File

@ -592,7 +592,7 @@ $(function () {
currentUser.options = $.extend(currentUser.options, this); currentUser.options = $.extend(currentUser.options, this);
currentUser.save(); currentUser.save();
}); });
message.addAction("setResignMode", function() { message.addAction("setResignMode", function () {
var p = this; var p = this;
if (p.profile) { if (p.profile) {
@ -626,7 +626,7 @@ $(function () {
return valid; return valid;
}; };
var checkSfc = function(formText, toText) { var checkSfc = function (formText, toText) {
if (!enableSfc || manuallyHide) return false; if (!enableSfc || manuallyHide) return false;
return true; return true;
}; };
@ -671,7 +671,7 @@ $(function () {
//} //}
}); });
$("#bus a:last").click(function() { $("#bus a:last").click(function () {
manuallyHide = true; manuallyHide = true;
$(this).parent().hide(); $(this).parent().hide();
}); });
@ -821,7 +821,14 @@ $(function () {
profile.fromText, profile.fromText,
profile.toCode, profile.toCode,
profile.toText, profile.toText,
profile.depDate profile.depDate,
(profile.passengers && Passenger.length) || 0,
(profile.selectedTrain && profile.selectedTrain.length) || 0,
(profile.selectedSeatType && profile.selectedSeatType.length) || 0,
(profile.dateloop && profile.dateloop.length) || 0,
profile.autoSubmitEnabled,
profile.partialSubmitEnabled,
profile.studentTicket
] ]
}); });
doQuery(); doQuery();
@ -830,9 +837,23 @@ $(function () {
if (!btn.hasClass("btn-primary")) if (!btn.hasClass("btn-primary"))
btn.click(); btn.click();
message.addAction("autoSubmitOrder", function() { message.addAction("autoSubmitOrder", function () {
var profile = currentUser.currentProfile;
message.sendAction("track", { message.sendAction("track", {
type: 96 type: 86, values: [
profile.fromCode,
profile.fromText,
profile.toCode,
profile.toText,
profile.depDate,
(profile.passengers && Passenger.length) || 0,
(profile.selectedTrain && profile.selectedTrain.length) || 0,
(profile.selectedSeatType && profile.selectedSeatType.length) || 0,
(profile.dateloop && profile.dateloop.length) || 0,
profile.autoSubmitEnabled,
profile.partialSubmitEnabled,
profile.studentTicket
]
}); });
}); });
@ -973,8 +994,8 @@ $(function () {
stat.from, stat.from,
stat.to, stat.to,
stat.date, stat.date,
0,
stat.td, stat.td,
stat.tcode,
stat.code || "" stat.code || ""
] ]
}); });
@ -1240,6 +1261,18 @@ $(function () {
setInterval(refreshSpeed, 3000); setInterval(refreshSpeed, 3000);
} }
}); });
message.addAction("serverStateChange", function (m) {
var state = m.state;
if (state === 1) {
$("#curServerSpeed").html("正在更新节点列表...");
} else if (state === 2) {
$("#curServerSpeed").html("正在为您测速...");
} else if (state === 3) {
$("#curServerSpeed").html("正在准备备用节点...");
}
});
var refreshSysConfig = function () { var refreshSysConfig = function () {

View File

@ -166,6 +166,7 @@
<Content Include="images\autorefresh.png" /> <Content Include="images\autorefresh.png" />
<Content Include="images\cat.png" /> <Content Include="images\cat.png" />
<Content Include="images\css-sprite.mkm" /> <Content Include="images\css-sprite.mkm" />
<Content Include="images\hand.png" />
<Content Include="images\loading.gif" /> <Content Include="images\loading.gif" />
<Content Include="images\css-sprite.png" /> <Content Include="images\css-sprite.png" />
<Content Include="images\icon.png" /> <Content Include="images\icon.png" />
@ -175,6 +176,7 @@
<Content Include="images\search-box-bg.png" /> <Content Include="images\search-box-bg.png" />
<Content Include="images\ticket-submit-info-arrow-w.png" /> <Content Include="images\ticket-submit-info-arrow-w.png" />
<Content Include="images\ticket-submit-info-arrow.png" /> <Content Include="images\ticket-submit-info-arrow.png" />
<Content Include="images\wxqr.png" />
<Content Include="index.html" /> <Content Include="index.html" />
<Content Include="js\account\keepalive.js" /> <Content Include="js\account\keepalive.js" />
<Content Include="js\account\sessionMgr.js" /> <Content Include="js\account\sessionMgr.js" />

View File

@ -168,7 +168,7 @@ a:active {
} }
.header-bar .user-nav li { .header-bar .user-nav li {
padding-top: 8px; padding-top: 7px;
width: 104px; width: 104px;
height: 40px; height: 40px;
text-align: center; text-align: center;
@ -211,7 +211,7 @@ a:active {
border-radius: 5px; border-radius: 5px;
color: #f17206; color: #f17206;
background: #fff; background: #fff;
padding-bottom: 10px; padding-bottom: 7px;
} }
.header-bar .user-nav li a:hover div, .header-bar .user-nav li a:hover div,

View File

@ -55,3 +55,62 @@
#selltime_tip li:nth-child(1) { #selltime_tip li:nth-child(1) {
color: #ef7007; color: #ef7007;
} }
#wx_sell_notification {
width: 370px;
position: relative;
height: 210px;
display: none;
}
#wx_sell_notification .info {
top: 66px;
position: absolute;
}
#wx_sell_notification .info .title {
color: #4c4c4c;
margin-bottom: 10px;
}
#wx_sell_notification .info .title span {
color: #fe8924;
font-weight: bold;
}
#wx_sell_notification .info .desc {
color: #4c4c4c;
}
#wx_sell_notification .info .desc span {
background-color: #ff8000;
color: #fff;
padding: 5px;
border-radius: 5px;
}
#wx_sell_notification img {
position: absolute;
top: 30px;
right: 0;
}
#wx_sell_notification p.code {
position: absolute;
bottom: 0px;
left: 0;
}
#wx_sell_notification p.code span {
color: red;
}
#wx_sell_notification span.hand {
background: url(../images/hand.png) no-repeat left top;
width: 93px;
height: 120px;
position: absolute;
z-index: 100;
right: -56px;
bottom: -34px;
}

View File

@ -60,17 +60,19 @@
} }
.search-box .search-tips .order-tips { .search-box .search-tips .order-tips {
display: inline-block; display: block;
cursor: pointer; cursor: pointer;
float: left;
margin-right: 20px;
} }
.search-box .search-tips .net-tips { .search-box .search-tips .net-tips {
display: none; display: none;
float: left; float: right;
} }
#swDnsSpeeding { #swDnsSpeeding {
float: left; float: right;
display: none; display: none;
margin: 0 10px; margin: 0 10px;
} }

BIN
Web12306/images/hand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
Web12306/images/wxqr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -98,11 +98,11 @@
<!-- 搜索输入框 --> <!-- 搜索输入框 -->
<div class="search-box pr"> <div class="search-box pr">
<div class="search-tips cl"> <div class="search-tips cl">
<div class="net-tips">
正在使用服务器:<strong>默认服务器</strong> (延迟:<strong></strong>ms)
</div>
<button id="swDnsSpeeding" class="button button-default button-mini">启用加速</button>
<div class="order-tips"></div> <div class="order-tips"></div>
<button id="swDnsSpeeding" class="button button-default button-mini">启用加速</button>
<div class="net-tips">
正在使用服务器:<strong>默认服务器</strong> (延迟:<strong></strong>)
</div>
</div> </div>
<!-- form --> <!-- form -->
<div class="search-form-wrap"> <div class="search-form-wrap">
@ -1092,7 +1092,21 @@
</li> </li>
</ul> </ul>
</section> </section>
<section id="wx_sell_notification">
<div class="info">
<p class="title"><span>双重保险:</span>微信扫一扫</p>
<p class="desc">
<span>手机同步提醒</span>
抢票进度→
</p>
</div>
<img src="/images/wxqr.png" alt="" />
<span class="hand"></span>
<p class="code">
抢票提醒密钥:<span></span>
(在关注微信后按提醒输入的哦)
</p>
</section>
<script src="js/modules/jquery/jquery.js"></script> <script src="js/modules/jquery/jquery.js"></script>
<script src="js/modules/underscore/underscore.js"></script> <script src="js/modules/underscore/underscore.js"></script>
<script src="js/modules/doT.js"></script> <script src="js/modules/doT.js"></script>

View File

@ -215,7 +215,8 @@
selectedSeatType: [], selectedSeatType: [],
selectedTrain: [], selectedTrain: [],
dateloop: [], dateloop: [],
passengers: [] passengers: [],
hideNoSeat: false
}; };
Object.defineProperty(this, "current", { Object.defineProperty(this, "current", {

View File

@ -193,7 +193,10 @@
train.from.name, train.from.name,
train.to.name, train.to.name,
train.date, train.date,
passenger[0].seat passenger[0].seat,
passenger.length,
train.byAuto ? 1 : 0,
train.suggest ? 1 : 0
]); ]);
} }
}, function () { }, function () {
@ -358,7 +361,10 @@
train.from.name, train.from.name,
train.to.name, train.to.name,
train.date, train.date,
passenger[0].seat passenger[0].seat,
passenger.length,
train.byAuto ? 1 : 0,
train.suggest ? 1 : 0
]); ]);
} }
}, function () { }, function () {

View File

@ -20,17 +20,17 @@
var sc = m[1]; var sc = m[1];
var sp = m[2][0] == '*' ? null : parseInt(m[2], 10); var sp = m[2][0] == '*' ? null : parseInt(m[2], 10);
var st = parseInt(m[3], 10); var st = parseInt(m[3], 10);
var seat = { code: sc, name: param.toSeatTypeName(sc), price: sp }; var seat = { code: sc, name: param.toSeatTypeName(sc), price: sp, selected: false };
if (st < 3000) { if (st < 3000) {
seat.count = st; seat.count = st;
//TODO 二等软座提交是否和二等座一样都用的MO //TODO 二等软座提交是否和二等座一样都用的MO
//一等软座 7 二等软座 8 //一等软座 7 二等软座 8
if (sc === "7") { if (sc === "7") {
data.push({ code: 'M', name: param.toSeatTypeName('M'), price: sp, count: st }); data.push({ code: 'M', name: param.toSeatTypeName('M'), price: sp, count: st, selected: false });
} }
else if (sc === "8") { else if (sc === "8") {
data.push({ code: 'O', name: param.toSeatTypeName('O'), price: sp, count: st }); data.push({ code: 'O', name: param.toSeatTypeName('O'), price: sp, count: st, selected: false });
} else { } else {
data.push(seat); data.push(seat);
} }

View File

@ -22,7 +22,7 @@
expdata.log("开始过滤车次"); expdata.log("开始过滤车次");
_.each(data.available, function (t) { _.each(data.available, function (t) {
t.selected = false; t.selected = false;
t.hasSeat = false;
}); });
//车次类型过滤 //车次类型过滤
if (currentProfile.trainTypes && currentProfile.trainTypes.length) { if (currentProfile.trainTypes && currentProfile.trainTypes.length) {
@ -99,6 +99,25 @@
}); });
} }
} }
if (currentProfile.selectedSeatType && currentProfile.selectedSeatType.length) {
var filtered4 = _.filter(data.available, function (e) {
return !(e.hasSeat = currentProfile.selectedSeatType.some(function (x) {
var o = e.ticketMap[x];
if (o && o.count)
o.selected = true;
return o || false;
}));
});
if (currentProfile.hideNoSeat) {
data.available = _.difference(data.available, filtered4);
$.each(filtered4, function () {
this.reason = 6;
data.filtered.push(this);
if (LOG_PROCESS)
expdata.log("车次【" + this.code + "】不没有指定的车次而被过滤。");
});
}
}
data.include = data.available; data.include = data.available;
if (currentProfile.hideNoTicket) { if (currentProfile.hideNoTicket) {
@ -120,8 +139,20 @@
//是否选择?->有票->未起售->无票 //是否选择?->有票->未起售->无票
if (data.available) { if (data.available) {
data.available.sort(function (x, y) { data.available.sort(function (x, y) {
if (x.selected ^ y.selected) if (currentProfile.selectSeatFirst) {
return x.selected ? -1 : 1; if (x.hasSeat ^ y.hasSeat)
return x.hasSeat ? -1 : 1;
if (x.selected ^ y.selected)
return x.selected ? -1 : 1;
} else {
if (x.selected ^ y.selected)
return x.selected ? -1 : 1;
if (x.hasSeat ^ y.hasSeat)
return x.hasSeat ? -1 : 1;
}
if (x.available === 1 ^ y.available === 1) if (x.available === 1 ^ y.available === 1)
return x.available === 1 ? -1 : 1; return x.available === 1 ? -1 : 1;
if (x.available === -1 ^ y.available === -1) if (x.available === -1 ^ y.available === -1)

View File

@ -177,7 +177,7 @@
lastQuerySuggest = null; lastQuerySuggest = null;
}; };
this.checkTrainSuggestion = function () { this.checkTrainSuggestion = function () {
var suggestKey = cp.fromCode + cp.toCode + ((cp.selectedTrain || []).join("|")); var suggestKey = cp.fromCode + cp.toCode + ((cp.selectedTrain || []).join("|")) + ((cp.selectedSeatType || []).join("|"));
if (suggestKey === cachedSuggest.key) { if (suggestKey === cachedSuggest.key) {
if (!lastQuerySuggest || (new Date() - lastQuerySuggest) > data.suggestRefreshInterval) { if (!lastQuerySuggest || (new Date() - lastQuerySuggest) > data.suggestRefreshInterval) {
@ -199,6 +199,12 @@
if ((t.from.endpoint && t.to.endpoint) || t.available < 0) if ((t.from.endpoint && t.to.endpoint) || t.available < 0)
return false; return false;
//如果设置了席别,并且设置的席别都没有,则不考虑
if (cp.selectedSeatType && cp.selectedSeatType.length) {
if (!cp.selectedSeatType.some(function(x) { return t.tickets[x] || false; }))
return false;
}
return true; return true;
}); });
if (!alltrains.length) if (!alltrains.length)

View File

@ -65,7 +65,7 @@
port.postMessage("enterChatRoom", room); port.postMessage("enterChatRoom", room);
} }
port.track(param.trackTypes.JOIN_CHAT); ep.track(param.trackTypes.JOIN_CHAT);
}; };
this.refreshOnlineCount = function () { this.refreshOnlineCount = function () {
page.find(">header>span:eq(1)").html("当前在线 " + room.onlinecount + " 人"); page.find(">header>span:eq(1)").html("当前在线 " + room.onlinecount + " 人");
@ -76,7 +76,7 @@
port.postMessage("disconnectChatRoom"); port.postMessage("disconnectChatRoom");
that.fireEvent("exitRoom"); that.fireEvent("exitRoom");
port.track(param.trackTypes.EXIT_CHAT); ep.track(param.trackTypes.EXIT_CHAT);
}; };
this.appendMessageItem = function (html) { this.appendMessageItem = function (html) {
chatListContainer.append(html); chatListContainer.append(html);

View File

@ -36,6 +36,12 @@
//自动刷新呢 //自动刷新呢
var autorefresh = require("./ui-autorefresh.js"); var autorefresh = require("./ui-autorefresh.js");
autorefresh.on("requestQueryTicket", function () { autorefresh.on("requestQueryTicket", function () {
var cp = sessMgr.currentProfile;
if (!cp.fromCode || !cp.toCode || !cp.depDate) {
mp.showMessagePopup("error", "亲,还没有设置查询的条件哦。");
autorefresh.stop();
return;
}
ui_result.load(); ui_result.load();
}); });
@ -208,7 +214,24 @@
} }
//track //track
port.track(param.trackTypes.QUERY_TICKET, [cp.fromCode, cp.fromText, cp.toCode, cp.toText, cp.depDate, cp.studentTicket + '']); port.track(param.trackTypes.QUERY_TICKET, [
cp.fromCode,
cp.fromText,
cp.toCode,
cp.toText,
cp.depDate,
cp.studentTicket + '',
(cp.selectedSeatType && cp.selectedSeatType.length) || 0,
(cp.selectedTrain && cp.selectedTrain.length) || 0
(cp.passengers && cp.passengers.length) || 0,
(cp.dateloop && cp.dateloop.length) || 0,
cp.hideNoTicket ? 1 : 0,
cp.hideNotInListTrain ? 1 : 0,
cp.autoWaitToSell ? 1 : 0,
cp.tryBottomSeat ? 1 : 0,
cp.selectSeatFirst ? 1 : 0,
cp.autoSubmitEnabled ? 1 : 0
]);
}); });
@ -257,6 +280,13 @@
//服务器加速 //服务器加速
require("./ui-dnsspeeding.js"); require("./ui-dnsspeeding.js");
setTimeout(function () {
$("#wx_sell_notification").showModalDialog({
title: "成功订阅提醒",
width: 'auto'
});
}, 1000);
//$("#passenger_editor").showModalDialog({ //$("#passenger_editor").showModalDialog({
// title: "新增联系人", // title: "新增联系人",
// buttons: [ // buttons: [

View File

@ -161,7 +161,24 @@
//track //track
var cp = sessMgr.currentProfile; var cp = sessMgr.currentProfile;
port.track(expdata.trackTypes.START_AUTOREFRESH, [cp.fromCode, cp.fromText, cp.toCode, cp.toText, cp.depDate, cp.studentTicket + '']); port.track(expdata.trackTypes.START_AUTOREFRESH, [
cp.fromCode,
cp.fromText,
cp.toCode,
cp.toText,
cp.depDate,
cp.studentTicket + '',
(cp.selectedSeatType && cp.selectedSeatType.length) || 0,
(cp.selectedTrain && cp.selectedTrain.length) || 0
(cp.passengers && cp.passengers.length) || 0,
(cp.dateloop && cp.dateloop.length) || 0,
cp.hideNoTicket ? 1 : 0,
cp.hideNotInListTrain ? 1 : 0,
cp.autoWaitToSell ? 1 : 0,
cp.tryBottomSeat ? 1 : 0,
cp.selectSeatFirst ? 1 : 0,
cp.autoSubmitEnabled ? 1 : 0
]);
} }
inAutoRefresh = true; inAutoRefresh = true;

View File

@ -1,18 +1,18 @@
define(function (require, exports, module) { define(function (require, exports, module) {
var port = require("../platform/extensionPort.js"); var port = require("../platform/extensionPort.js");
var isValid = 0; var isValid = 0;
var serverSpan = $("span.net-tips"); var serverSpan = $("div.net-tips");
var sysConfig = null; var sysConfig = null;
var checkSpeedTimer = null; var checkSpeedTimer = null;
var refreshSpeed = function () { var refreshSpeed = function () {
chrome.runtime.sendMessage({ action: "getCurrentServer" }, function (m) { port.sendMessage({ action: "getCurrentServer" }, function (m) {
var data = m["kyfw.12306.cn"]; var data = m["kyfw.12306.cn"];
var speed = data.speed; var speed = data.speed;
//var cls = speed === 0 ? "label-default" : speed < 0 ? "label-danger" : speed < 100 ? "label-success" : speed < 400 ? "label-warning" : "label-danger"; //var cls = speed === 0 ? "label-default" : speed < 0 ? "label-danger" : speed < 100 ? "label-success" : speed < 400 ? "label-warning" : "label-danger";
serverSpan.find("strong:eq(1)").html(speed > 0 ? speed + " 毫秒" + (data.rate ? " (加速" + data.rate + "%)" : "") : speed < 0 ? "无法连接" : "正在帮你测速..."); serverSpan.find("strong:eq(1)").html(speed > 0 ? speed + " 毫秒" + (data.rate ? " (加速" + data.rate + "%)" : "") : speed < 0 ? "无法连接" : "正在测速...");
serverSpan.find("strong:eq(1)").html(data.ip ? "默认服务器" : data.ip); serverSpan.find("strong:eq(0)").html(!data.ip ? "默认服务器" : data.ip);
}); });
}; };
var checkStatus = function () { var checkStatus = function () {
@ -20,17 +20,19 @@
if (isValid <= 0) { if (isValid <= 0) {
$("#swDnsSpeeding").hide(); $("#swDnsSpeeding").hide();
} else { } else {
$("#swDnsSpeeding").show();
if (sysConfig.enableServerAutoChange) { if (sysConfig.enableServerAutoChange) {
serverSpan.show(); serverSpan.show();
$("#swDnsSpeeding").val("关闭加速"); $("#swDnsSpeeding").html("关闭加速");
refreshSpeed(); refreshSpeed();
} else { } else {
$("#swDnsSpeeding").val("启用加速"); $("#swDnsSpeeding").html("启用加速");
} }
} }
if (isValid > 0) { if (isValid > 0) {
if (!checkSpeedTimer) if (!checkSpeedTimer)
checkSpeedTimer = setInterval(refreshSpeed, 3000); checkSpeedTimer = setInterval(refreshSpeed, 3000);
port.sendMessage({ action: "triggerUpdate" });
} else { } else {
if (checkSpeedTimer) { if (checkSpeedTimer) {
clearInterval(checkSpeedTimer); clearInterval(checkSpeedTimer);
@ -44,20 +46,20 @@
}); });
var checkServerValid = function () { var checkServerValid = function () {
port.sendMessage({ action: "servervalid" }, function (valid) { port.sendMessage({ action: "servervalid" }, function (r) {
isValid = valid; isValid = r.valid;
checkStatus(); checkStatus();
}); });
}; };
port.port.on("sysConfigUpdate", function (data) { port.port.on("sysConfigUpdate", function (e, data) {
sysConfig = data; sysConfig = data;
checkStatus(); checkStatus();
}); });
var reloadSysConfig = function () { var reloadSysConfig = function () {
port.sendMessage({ action: "getSysConfig" }, function (data) { port.sendMessage({ action: "getSysConfig" }, function (data) {
sysConfig = data; sysConfig = data.detail;
checkServerValid(); checkServerValid();
}); });
}; };

View File

@ -94,7 +94,10 @@
pTrain.from.name, pTrain.from.name,
pTrain.to.name, pTrain.to.name,
pTrain.date, pTrain.date,
pPassengers[0].seat pPassengers[0].seat,
pPassengers.length,
pTrain.byAuto ? 1 : 0,
pTrain.suggest ? 1 : 0
]); ]);
submitBtn[0].disabled = true; submitBtn[0].disabled = true;
@ -116,7 +119,10 @@
pTrain.from.name, pTrain.from.name,
pTrain.to.name, pTrain.to.name,
pTrain.date, pTrain.date,
pPassengers[0].seat pPassengers[0].seat,
pPassengers.length,
pTrain.byAuto ? 1 : 0,
pTrain.suggest ? 1 : 0
]); ]);
}); });
submitDef.fail(function (data) { submitDef.fail(function (data) {
@ -140,7 +146,10 @@
pTrain.from.name, pTrain.from.name,
pTrain.to.name, pTrain.to.name,
pTrain.date, pTrain.date,
pPassengers[0].seat pPassengers[0].seat,
pPassengers.length,
pTrain.byAuto ? 1 : 0,
pTrain.suggest ? 1 : 0
]); ]);
}); });
submitDef.progress(function (data) { submitDef.progress(function (data) {

View File

@ -57,6 +57,12 @@
date = date || sessMgr.currentProfile.depDate; date = date || sessMgr.currentProfile.depDate;
stu = stu || sessMgr.currentProfile.studentTicket; stu = stu || sessMgr.currentProfile.studentTicket;
if (!from || !to || !date) {
mp.showMessagePopup("error", "亲,还没有设置查询的条件哦。");
return;
}
var extArg = Array.prototype.slice.call(arguments); var extArg = Array.prototype.slice.call(arguments);
__.fireEvent("onload", extArg); __.fireEvent("onload", extArg);
datebar.go(date, date); datebar.go(date, date);
@ -157,6 +163,7 @@
if (this.dataset.suggest) { if (this.dataset.suggest) {
train = trainSuggest.findTrain(this.dataset.sec); train = trainSuggest.findTrain(this.dataset.sec);
train.suggest = true;
bySuggest = true; bySuggest = true;
} else { } else {
train = _.findWhere(queryResult.original, { id: id }); train = _.findWhere(queryResult.original, { id: id });
@ -174,23 +181,23 @@
if (cp.submitStuAsCommon && !cp.studentTicket) { 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", { __.dispatchEvent("requireSubmitOrder", {
train: train, train: train,
seat: seatcode, seat: seatcode,
passengers: pas passengers: pas
}); });
if (bySuggest) { //if (bySuggest) {
port.track(param.trackTypes.SUBMIT_ORDER_BY_SUGGESTIONI, [ // port.track(param.trackTypes.SUBMIT_ORDER_BY_SUGGESTIONI, [
train.code, // train.code,
train.from.name, // train.from.name,
train.to.name, // train.to.name,
train.date, // train.date,
seatcode // seatcode
]); // ]);
} //}
}); });
}; };
init(); init();

View File

@ -68,6 +68,12 @@
}); });
} }
}); });
if (!options.buttons || !options.buttons.length) {
buttonContainer.remove();
}
if (options.width) {
template.css("width", options.width);
}
widget.showFloatDialog(template); widget.showFloatDialog(template);

View File

@ -9,6 +9,7 @@
var mp = require("./widget_message_popup.js"); var mp = require("./widget_message_popup.js");
var query = require("../otn/queryticket.js"); var query = require("../otn/queryticket.js");
var port = require("../platform/extensionPort.js"); var port = require("../platform/extensionPort.js");
var wxData = null;
require("./widget_modalDialog.js"); require("./widget_modalDialog.js");
@ -81,8 +82,6 @@
var baseTime = new Date(parseInt(container[0].dataset.sellday)); var baseTime = new Date(parseInt(container[0].dataset.sellday));
var sellTime = parseSellTime(container[0].dataset.timeset); var sellTime = parseSellTime(container[0].dataset.timeset);
baseTime = utility.addDays(utility.trimToDay(new Date()), 1);
var tasks = []; var tasks = [];
var p = sessMgr.currentProfile; var p = sessMgr.currentProfile;
var taskGroup = utility.formatDate(p.depDate, 'MM月dd日') + p.fromText + "到" + p.toText + "起售提醒"; var taskGroup = utility.formatDate(p.depDate, 'MM月dd日') + p.fromText + "到" + p.toText + "起售提醒";
@ -93,7 +92,8 @@
time: baseTime.getTime(), time: baseTime.getTime(),
text: "今天起售" + utility.formatDate(p.depDate, 'MM月dd日') + p.fromText + "到" + p.toText + "车票 ,请留意哦!", text: "今天起售" + utility.formatDate(p.depDate, 'MM月dd日') + p.fromText + "到" + p.toText + "车票 ,请留意哦!",
group: taskGroup, group: taskGroup,
data: taskdata data: taskdata,
point: 0
} }
); );
var assignTimeGroup = function (timepoint, grouptype) { var assignTimeGroup = function (timepoint, grouptype) {
@ -103,7 +103,9 @@
time: timepoint - 30 * 60 * 1000, time: timepoint - 30 * 60 * 1000,
text: "三十分钟后起售" + utility.formatDate(p.depDate, 'MM月dd日') + p.fromText + "到" + p.toText + "的" + grouptype + "车票 ,请留意哦!", text: "三十分钟后起售" + utility.formatDate(p.depDate, 'MM月dd日') + p.fromText + "到" + p.toText + "的" + grouptype + "车票 ,请留意哦!",
group: taskGroup, group: taskGroup,
data: taskdata data: taskdata,
point: 30,
type: grouptype
} }
); );
@ -113,7 +115,9 @@
time: timepoint - 15 * 60 * 1000, time: timepoint - 15 * 60 * 1000,
text: "十五分钟后起售" + utility.formatDate(p.depDate, 'MM月dd日') + p.fromText + "到" + p.toText + "的" + grouptype + "车票 ,请留意哦!", text: "十五分钟后起售" + utility.formatDate(p.depDate, 'MM月dd日') + p.fromText + "到" + p.toText + "的" + grouptype + "车票 ,请留意哦!",
group: taskGroup, group: taskGroup,
data: taskdata data: taskdata,
point: 15,
type: grouptype
} }
); );
@ -123,7 +127,9 @@
time: timepoint - 5 * 60 * 1000, time: timepoint - 5 * 60 * 1000,
text: "五分钟后起售" + utility.formatDate(p.depDate, 'MM月dd日') + p.fromText + "到" + p.toText + "的" + grouptype + "车票 ,请留意哦!", text: "五分钟后起售" + utility.formatDate(p.depDate, 'MM月dd日') + p.fromText + "到" + p.toText + "的" + grouptype + "车票 ,请留意哦!",
group: taskGroup, group: taskGroup,
data: taskdata data: taskdata,
point: 5,
type: grouptype
} }
); );
} }
@ -192,8 +198,9 @@
text: "订阅提醒", text: "订阅提醒",
callback: function (e) { callback: function (e) {
if (confirmAlarm()) { if (confirmAlarm()) {
mp.showMessagePopup("ok", "提醒设置成功!");
e.hide(); e.hide();
showWx();
} }
}, },
type: "primary" type: "primary"
@ -201,6 +208,9 @@
] ]
}); });
port.track(data.trackTypes.SHOW_NOTIFICATION_SELECT); port.track(data.trackTypes.SHOW_NOTIFICATION_SELECT);
};
var showWx = function() {
}; };
var init = function () { var init = function () {
sessMgr.on("save", function () { sessMgr.on("save", function () {