This commit is contained in:
SilenceLeo 2014-09-03 14:50:29 +08:00
commit b560a7e1cf
56 changed files with 552 additions and 253 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ obj
*.suo
*.lnk
*.rar
BuildTools/
*ReSharper*
*Example*
Doc

View File

@ -63,6 +63,10 @@
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>COPY "$(TargetPath)*" "$(SolutionDir)\BuildTools\" /y
COPY "$(TargetDir)\*.dll" "$(SolutionDir)\BuildTools\" /y</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -26,12 +26,15 @@ namespace DeployTools
static void Main(string[] args)
{
_projectRoot = Path.GetFullPath(Path.Combine(Assembly.GetExecutingAssembly().Location, @"..\..\..\.."));
_projectRoot = Path.GetFullPath(Path.Combine(Assembly.GetExecutingAssembly().Location, @"..\..\"));
_sourceDirectory = Path.Combine(_projectRoot, "Web12306");
_destinationDirectory = Path.Combine(_projectRoot, "wwwroot");
_ajaxminiTool = Path.Combine(_projectRoot, "BuildTools\\AjaxMinifier.exe");
_moduleMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Console.WriteLine("使用压缩工具 {0}", _ajaxminiTool);
Console.WriteLine();
//1.创建目标目录
Console.WriteLine("正在准备目标目录....");
try
@ -41,7 +44,7 @@ namespace DeployTools
}
catch (Exception ex)
{
}
Directory.CreateDirectory(_destinationDirectory);
Console.WriteLine();
@ -150,8 +153,11 @@ namespace DeployTools
var tpl = _.Value;
return Regex.Replace(tpl, @"[\t\s\r\n]{2,}", " ");
}, RegexOptions.IgnoreCase);
//release tag
content = content.Replace("$BUILD_DATE$", DateTime.Now.ToString("yyyyMMddHHmmss"));
File.WriteAllText(fileFull, content);
//使用uglify 压缩
var psi = new ProcessStartInfo(System.Configuration.ConfigurationManager.AppSettings["minifyCmdPath"], "\"" + fileFull + "\"")
{
@ -162,6 +168,9 @@ namespace DeployTools
};
var p = Process.Start(psi);
content = p.StandardOutput.ReadToEnd();
File.WriteAllText(fileFull, content);
}
@ -182,7 +191,7 @@ namespace DeployTools
return string.Empty;
});
//插入新的脚本
targetContent = targetContent.Replace("</body>", "<script src=\"js/lib.js?v" + DateTime.Now.ToString("yyyyMMddhhmmss") + "\"></script>");
targetContent = targetContent.Replace("</body>", "<script src=\"js/lib.js?v" + DateTime.Now.ToString("yyyyMMddHHmmss") + "\"></script>");
File.WriteAllText(targetFullHtml, targetContent);
//合并脚本库
@ -397,7 +406,7 @@ namespace DeployTools
static void CreateFileList()
{
var include = new[] { @".*\.*?\.(jpg|gif|png|html|js|svg|eot|ttf|woff|otf|css)$" };
var include = new[] { @".*\.*?\.(jpg|gif|png|html|js|svg|eot|ttf|woff|otf|css|ico)$" };
var fileter = new[] { @"^(scripts|bin)\.*" };
var allfiles = Directory.GetFiles(_sourceDirectory, "*.*", SearchOption.AllDirectories).ToDictionary(GetProjectSubPath, StringComparer.OrdinalIgnoreCase);

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.14245.12")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -101,6 +101,7 @@ var Query = {
var key = $(this).attr('data-key');
if (!!key && !!Public.his.queryObjs[key]) {
Query.newQuery(Public.his.queryObjs[key]);
Public.alert('切换成功');
}
});

View File

@ -266,7 +266,7 @@ var CFG_MANGER = (function () {
};
chrome.runtime.onMessage.addListener(function (m, s, r) {
var msgHandler = function (m, s, r) {
if (m && m.action === 'enter12306') {
sleepTime = 20 * 60 * 1000;
if (lastUpdate === null || (new Date() - lastUpdate) >= 20 * 60 * 1000)
@ -278,7 +278,9 @@ var CFG_MANGER = (function () {
localStorage["userConfig"] = JSON.stringify(__.userConfig);
chrome.runtime.sendMessage({ action: "sysConfigUpdate", detail: __.config });
}
});
};
chrome.runtime.onMessage.addListener(msgHandler);
chrome.runtime.onMessageExternal.addListener(msgHandler);
this.refresh();
loaded = true;
@ -287,18 +289,16 @@ var CFG_MANGER = (function () {
};
var mm = new manager();
chrome.runtime.onMessage.addListener(function (m, s, r) {
var mmCallback = function (m, s, r) {
if (m.action === "getSysConfig") {
r({ action: "responseSysConfig", detail: mm.config });
}
if (m.action === "getBaseSysConfig") {
r({ action: "responseBaseSysConfig", detail: $.extend(mm.baseConfig, mm.sysConfig) });
}
if (m.action === "setUserConfig") {
mm.userConfig = $.extend({}, mm.userConfig, r.detail);
mm.refresh();
}
});
};
chrome.runtime.onMessage.addListener(mmCallback);
chrome.runtime.onMessageExternal.addListener(mmCallback);
return mm;
})();
@ -367,9 +367,7 @@ var CFG_MANGER = (function () {
chrome.tabs.onUpdated.addListener(function (tabid, changeinfo, tab) {
if (changeinfo.status == "complete") {
if ((/https?:\/\/dynamic\.12306\.cn\/.*/i.test(tab.url) || /https?:\/\/www\.12306\.cn\/mormhweb\/kyfw\/?.*/i.test(tab.url)) && !checkIfInfobarShown(tab.id)) {
showInfobar(tab.id, "main", false);
} else if (/https?:\/\/(www|dynamic|kyfw)\.12306\.cn\/otn.*/i.test(tab.url)) {
if (/https?:\/\/(www|dynamic|kyfw)\.12306\.cn\/otn.*/i.test(tab.url)) {
showInfobar(tab.id, "main", true);
}
}
@ -618,6 +616,10 @@ window.cbl = function (u, h) {
if (m && m.action === "servervalid")
r({ valid: valid });
});
chrome.runtime.onMessageExternal.addListener(function (m, s, r) {
if (m && m.action === "servervalid")
r({ valid: valid });
});
if (!valid)
return;
@ -651,7 +653,7 @@ window.cbl = function (u, h) {
//消息
(function () {
chrome.runtime.onMessage.addListener(function (message, sender, response) {
var messageCallback = function (message, sender, response) {
if (message && message.action) {
if (message.action === "getServerStatus") {
response(serverStorage);
@ -661,7 +663,9 @@ window.cbl = function (u, h) {
response(currentServer);
}
}
});
};
chrome.runtime.onMessage.addListener(messageCallback);
chrome.runtime.onMessageExternal.addListener(messageCallback);
})();
var randomTake = function (list, count) {
@ -967,7 +971,6 @@ window.cbl = function (u, h) {
valid = -1;
return;
}
log.print(localDns);
//测试是否有代理服务器
$.ajax("https://" + localDns['kyfw.12306.cn'][0] + "/otn/", {
method: "GET",
@ -983,27 +986,31 @@ window.cbl = function (u, h) {
//策略如果前一天有用过12306的话那就执行
var booted = false;
var triggerUpdate = function () {
localStorage["lastUsed"] = Math.floor(new Date().getTime() / 86400000);
if (!booted) {
booted = true;
boot();
}
entry12306 = true;
}
chrome.runtime.onMessage.addListener(function (m, s, r) {
if (m && m.action === 'triggerUpdate') {
localStorage["lastUsed"] = Math.floor(new Date().getTime() / 86400000);
if (!booted) {
booted = true;
boot();
}
entry12306 = true;
triggerUpdate();
}
});
chrome.runtime.onMessageExternal.addListener(function (m, s, r) {
if (m && m.action === 'triggerUpdate') {
triggerUpdate();
}
});
if (!localStorage["lastUsed"] || parseInt(localStorage["lastUsed"]) >= Math.floor(new Date().getTime() / 86400000) - 1) {
booted = true;
boot();
} else {
valid = -2;
}
setInterval(function () {
chrome.tabs.query({ url: "*://*.12306.cn/otn*" }, function (a) {
entry12306 = a && a.length > 0;
});
chrome.tabs.query({ url: "*://12306.*/*" }, function (a) {
entry12306 = a && a.length > 0;
});
}, 20000);
})();
@ -1089,7 +1096,7 @@ window.cbl = function (u, h) {
lastCheckUpdate = new Date();
};
chrome.runtime.onMessage.addListener(function (m, s, r) {
var msgCallback = function (m, s, r) {
if (m && m.action === 'getUpdateInfo')
r(updateInfo);
if (m && m.action === 'getVersionInfo')
@ -1099,18 +1106,9 @@ window.cbl = function (u, h) {
checkUpdate();
}
}
});
chrome.runtime.onMessageExternal.addListener(function (m, s, r) {
if (m && m.action === 'getUpdateInfo')
r(updateInfo);
if (m && m.action === 'getVersionInfo')
r({ curVersion: MANIFEST.version, updateInfo: updateInfo });
if (m && m.action === 'triggerUpdate') {
if (!lastCheckUpdate || (new Date() - lastCheckUpdate) >= 300000) {
checkUpdate();
}
}
});
};
chrome.runtime.onMessage.addListener(msgCallback);
chrome.runtime.onMessageExternal.addListener(msgCallback);
checkUpdate();
})();
@ -1121,7 +1119,7 @@ window.cbl = function (u, h) {
//#region Captcha
(function () {
chrome.runtime.onMessage.addListener(function (m, s, r) {
var msgCallback = function (m, s, r) {
if (m && m.action === 'captcha' && CFG_MANGER.config.captchaServerUrl) {
var code;
@ -1139,7 +1137,9 @@ window.cbl = function (u, h) {
return true;
}
});
};
chrome.runtime.onMessage.addListener(msgCallback);
chrome.runtime.onMessageExternal.addListener(msgCallback);
})();
//#endregion
@ -1148,19 +1148,7 @@ window.cbl = function (u, h) {
//#region 配置同步和网页上的提示接口
(function () {
chrome.runtime.onMessage.addListener(function (m, s, r) {
if (m.action === "getStorage")
r({ action: "sendStorage", detail: localStorage });
else if (m.action === "setStorage" && m.detail) {
_.each(m.detail, function (v, k) {
if (v)
localStorage.setItem(k, v);
else localStorage.removeItem(k);
});
r({ action: "sendStorage", detail: m.detail });
}
});
chrome.runtime.onMessageExternal.addListener(function (m, s, r) {
var msgCallback = function (m, s, r) {
if (m.action === "getStorage")
r({ action: "sendStorage", detail: localStorage });
else if (m.action === "setStorage" && m.detail) {
@ -1171,12 +1159,14 @@ window.cbl = function (u, h) {
});
r({ action: "sendStorage", detail: m.detail });
} else if (m.action === "notify") {
var notify = new Notification(m.title || "订票助手", { body: m.content || null, icon: "/icons/icon_128.png" });
var notify = new Notification(m.title || "订票助手", { body: m.content || null, icon: "/icons/icon_n.png" });
setTimeout(function () {
notify.close();
}, 5000);
}
});
};
//chrome.runtime.onMessage.addListener(msgCallback);
chrome.runtime.onMessageExternal.addListener(msgCallback);
})();
//#endregion
@ -1328,6 +1318,15 @@ window.cbl = function (u, h) {
}
}
};
//转发系统消息
chrome.runtime.onMessage.addListener(function (m, s, r) {
if (!m || !m.action)
return;
if (m.action === "serverStateChange")
postMessageToPort(m);
});
return {
loadServers: loadServers
@ -1341,7 +1340,7 @@ window.cbl = function (u, h) {
var heratBeatTimer = null;
var sendHeartBeat = function () {
if (socket) {
if (socket && socket.readyState === 1) {
socket.send("h");
}
};
@ -1361,8 +1360,8 @@ window.cbl = function (u, h) {
socket.onopen = function () {
postMessageToPort({ action: "chatRoomConnected" });
if (currentRoom.heartbeat) {
sendHeartBeat = setInterval(sendHeartBeat);
if (currentRoom.heartbeat && !heratBeatTimer) {
heratBeatTimer = setInterval(sendHeartBeat, currentRoom.heartbeat);
};
};
socket.onmessage = function (e) {

View File

@ -2,29 +2,3 @@
width: 110px;
}
.yzm {
z-index: 999!important;
}
.lay-login .login li .code,
.yzm .img{
width:150px!important;
height:60px!important;
}
.lay-login .login li .code img,
.yzm .img img{
width:100%!important;
height:100%!important;
}
#img-check2 img{
width:150px!important;
height:50px!important;
}
@media (max-height:600px) {
#autosubmitcheckticketinfo {
top: -40px !important;
}
}

View File

@ -271,7 +271,7 @@ $(document).bind(EVT_ONLOGINPAGE, function () {
if (links.length) {
msg.sendAction("notify", {
title: "提示",
message: "已自动登录等待12306回应。如卡太久请重试一次。",
message: "已尝试自动登录等待12306回应。如卡太久请重试一次。",
iconUrl: "/icons/icon_128.png"
});
links.nativeClick(10);
@ -600,7 +600,7 @@ $(document).bind(EVT_ONQUERYPAGE, function () {
}
}
});
$("#setion_postion").find("span:gt(0) a").click(removeHandle);
$("#setion_postion").find("span:gt(0) a.close").click(removeHandle);
suspendStationUpdate = false;
});
//当用户选择时,发送消息到后台
@ -628,7 +628,7 @@ $(document).bind(EVT_ONQUERYPAGE, function () {
};
msg.on("removePassenger", function () {
var data = this.name + "(" + this.typename + ")(" + this.id + ")";
$("#setion_postion span[name='" + data + "'] a")[0].click();
$("#setion_postion span[name='" + data + "'] a.close")[0].click();
});
msg.on("addPassenger", function () {
var data = this.name + "(" + this.typename + ")(" + this.id + ")";

View File

@ -27,7 +27,7 @@
<label class="col-xs-1 control-label">
预定席别
</label>
<div class="col-sm-9" id="seatTypeList">
<div class="col-xs-9" id="seatTypeList">
<label class="checkbox-inline" data-html="true" data-toggle="tooltip" title="商务座,最土豪的席别" data-placement="bottom" data-container="body">
<input type="checkbox" value="9" name="seat" id="" />
商务
@ -88,7 +88,7 @@
<label class="col-xs-1 control-label" data-toggle="tooltip" data-html="true" data-placement="bottom" data-container="body" title="设置要预定的车次。如果要隐藏其它车次,请设置自动预定选项(“更多”菜单中)">
预定车次
</label>
<div class="col-sm-9">
<div class="col-xs-9">
<div><input type="text" id="trains" value="" /></div>
</div>
<div class="col-xs-2">
@ -124,11 +124,11 @@
</label>
<div class="col-xs-4" id="passengers"></div>
<div class="col-xs-2 btn-group">
<button type="button" id="btnAddPassengerM" class="btn btn-default btn-sm" data-toggle="modal" data-target="#addPassenger" style="width:75px;">
<button type="button" id="btnAddPassengerM" class="btn btn-default btn-sm" data-toggle="modal" data-target="#addPassenger" style="width:100px;">
<i class="glyphicon glyphicon-plus"></i>
加乘车人
</button>
<button class="btn btn-default dropdown-toggle btn-sm" id="btnAddPassengerD" data-toggle="dropdown" style="width:26px;"><span class="caret"></span></button>
<!--<button class="btn btn-default dropdown-toggle btn-sm" id="btnAddPassengerD" data-toggle="dropdown" style="width:26px;"><span class="caret"></span></button>-->
<ul class="dropdown-menu" role="menu">
<li data-toggle="modal" data-target="#enterPassenger">
<a href="javascript:;" style="font-weight:bold;">

View File

@ -90,9 +90,10 @@ function Profile(impdata) {
__[att] = _.clone(impdata[att]);
});
$.each(impdata.passengers, function () {
__.passengers.push(new Passenger(this.name, this.type, this.typename, this.idtype, this.idtypeName, this.id, this.firstLetter));
});
if (impdata.passengers && impdata.passengers.every(function (p) { return p.times > 0; }))
$.each(impdata.passengers, function () {
__.passengers.push(new Passenger(this.name, this.type, this.typename, this.idtype, this.idtypeName, this.id, this.firstLetter, this.times));
});
}
return this;
@ -142,7 +143,7 @@ function ProfileList(imptlist) {
ProfileList.prototype = new EventObject();
function Passenger(name, type, typename, idtype, idtypename, id, firstLetter) {
function Passenger(name, type, typename, idtype, idtypename, id, firstLetter, times) {
this.name = name;
this.type = type;
this.idtype = idtype;
@ -152,13 +153,14 @@ function Passenger(name, type, typename, idtype, idtypename, id, firstLetter) {
this.firstLetter = firstLetter;
this.idtypeName = idtypename;
this.typename = typename;
this.times = times;
var __ = this;
this.toString = function () {
return name;
};
this.toHtml = function (removeFlag) {
return "<button type='button' data-key='" + __.key + "' data-fl='" + __.firstLetter + "' class='btn btn-sm " + (removeFlag ? "btn-default" : "btn-primary") + "'>" + __.name + (__.type == 2 ? "<span style='margin-left:3px;color:#" + (removeFlag ? "888" : "ccc") + ";'>[童]</span>" : __.type == 3 ? "<span style='margin-left:3px;color:#" + (removeFlag ? "888" : "ccc") + ";'>[学]</span>" : "") + (removeFlag ? "" : "") + "</button>";
return "<button type='button' " + (__.canOrder ? "" : "data-invalid='1' title='未通过12306实名校验无法订票'") + " data-key='" + __.key + "' data-fl='" + __.firstLetter + "' class='btn btn-sm " + (removeFlag ? "btn-default" : "btn-primary") + "'>" + __.name + (__.type == 2 ? "<span style='margin-left:3px;color:#" + (removeFlag ? "888" : "ccc") + ";'>[童]</span>" : __.type == 3 ? "<span style='margin-left:3px;color:#" + (removeFlag ? "888" : "ccc") + ";'>[学]</span>" : "") + (removeFlag ? "" : "") + "</button>";
};
//e.passengers.push(new Passenger(this.passenger_name, this.passenger_type, this.passenger_id_type_code, this.passenger_id_no, this.first_letter));
this.toRawPassenger = function () {
@ -174,6 +176,18 @@ function Passenger(name, type, typename, idtype, idtypename, id, firstLetter) {
};
};
Object.defineProperty(this, "canOrder", {
get: function () {
if (__.idtype === "C" || __.idtype === "G" || __.idtype === "B")
return true;
if (__.idtype === "2")
return false;
return __.times == "93" || __.times == "95" || __.times == "97" || __.times == "99";
}
});
return this;
}
@ -204,9 +218,11 @@ function LoginUser(name) {
$.extend(e, _.omit(data, "savedProfile", "passengers", "currentProfile"));
e.savedProfile = new ProfileList(data.savedProfile.list);
e.currentProfile = new Profile(data.currentProfile);
$.each(data.passengers, function () {
e.passengers.push(new Passenger(this.name, this.type, this.typename, this.idtype, this.idtypeName, this.id, this.firstLetter));
});
if (data.passengers && data.passengers.every(function (s) { return s.times > 0; }))
$.each(data.passengers, function () {
e.passengers.push(new Passenger(this.name, this.type, this.typename, this.idtype, this.idtypeName, this.id, this.firstLetter, this.times));
});
}
//重新加载乘客
@ -219,7 +235,7 @@ function LoginUser(name) {
else {
if (rawPassenger) {
$.each(rawPassenger, function () {
e.passengers.push(new Passenger(this.passenger_name, this.passenger_type, this.passenger_type_name, this.passenger_id_type_code, this.passenger_id_type_name, this.passenger_id_no, this.first_letter));
e.passengers.push(new Passenger(this.passenger_name, this.passenger_type, this.passenger_type_name, this.passenger_id_type_code, this.passenger_id_type_name, this.passenger_id_no, this.first_letter, this.total_times));
});
e.fireEvent("passengerLoaded");
e.save();
@ -235,7 +251,7 @@ function LoginUser(name) {
} else {
$.each(json.data.normal_passengers, function () {
e.rawPassenger.push(this);
e.passengers.push(new Passenger(this.passenger_name, this.passenger_type, this.passenger_type_name, this.passenger_id_type_code, this.passenger_id_type_name, this.passenger_id_no, this.first_letter));
e.passengers.push(new Passenger(this.passenger_name, this.passenger_type, this.passenger_type_name, this.passenger_id_type_code, this.passenger_id_type_name, this.passenger_id_no, this.first_letter, this.total_times));
});
e.fireEvent("passengerLoaded");
e.save();
@ -261,7 +277,7 @@ function LoginUser(name) {
otsweb.ajaxPost("passengerAction.do?method=getPagePassengerAll", "passengerAction.do?method=initUsualPassenger12306", { pageSize: 10, pageIndex: pageIndex }, "json", function (json) {
$.each(json.rows, function () {
e.rawPassenger.push(this);
e.passengers.push(new Passenger(this.passenger_name, this.passenger_type, this.passenger_type_name, this.passenger_id_type_code, this.passenger_id_type_name, this.passenger_id_no, this.first_letter));
e.passengers.push(new Passenger(this.passenger_name, this.passenger_type, this.passenger_type_name, this.passenger_id_type_code, this.passenger_id_type_name, this.passenger_id_no, this.first_letter, this.total_times));
});
if (e.passengers.length >= json.recordCount) {

View File

@ -75,6 +75,7 @@ $(function () {
//处理席别
var seatContainer = $("#seatTypeList");
p.selectedSeatType = p.selectedSeatType || [];
var bakst = p.selectedSeatType;
seatContainer.find(":checkbox:checked").each(function () {
this.checked = false;
@ -85,10 +86,12 @@ $(function () {
});
p.selectedSeatType = bakst;
p.selectedTrain = p.selectedTrain || [];
$("#trains").val(p.selectedTrain.join(',')).change();
trains.importTags(p.selectedTrain.join(','));
//联系人
currentUser.currentProfile.passengers = currentUser.currentProfile.passengers || [];
$("#passengers").html($.map(currentUser.currentProfile.passengers, function (e) { return e.toHtml(true); }).join(""));
$("#btnAddPassengerD, #btnAddPassengerM").prop("disabled", currentUser.currentProfile.passengers.length >= 5);
@ -100,6 +103,7 @@ $(function () {
dateloop.empty();
$("#dateLoop button").prop("disabled", false);
var loopFiltered = [];
currentUser.currentProfile.dateloop = currentUser.currentProfile.dateloop || [];
$.each(currentUser.currentProfile.dateloop, function () {
var dd = new Date(this + '');
if (dd >= cd) {
@ -281,6 +285,7 @@ $(function () {
var buttons = container.find("[data-key]");
buttons.prop("disabled", false);
buttons.filter("[data-invalid]").prop("disabled", true);
buttons.find("i").remove();
$.each(currentUser.currentProfile.passengers, function () {
@ -649,21 +654,21 @@ $(function () {
chrome.extension.sendMessage({ ticketEvent: 'refresh', times: refreshCount });
}
$("#bus").hide();
if (refreshCount >= 30) {
var a = $("#bus");
if (checkIsBus(profile.fromText, profile.toText)) {
//可以橙色大巴
a.find("span").html("免费橙色大巴送您顺利回家");
a.find("a:eq(0)").attr("href", "http://www.ijinshan.com/bus/");
a.show();
} else if (checkSfc(profile.fromText, profile.toText)) {
//显示顺风车
a.find("span").html("免费顺风车助您顺利回家");
a.find("a:eq(0)").attr("href", "http://www.shunfengche.org/NewYearAction.aspx");
a.show();
}
}
//$("#bus").hide();
//if (refreshCount >= 30) {
// var a = $("#bus");
// if (checkIsBus(profile.fromText, profile.toText)) {
// //可以橙色大巴
// a.find("span").html("免费橙色大巴送您顺利回家");
// a.find("a:eq(0)").attr("href", "http://www.ijinshan.com/bus/");
// a.show();
// } else if (checkSfc(profile.fromText, profile.toText)) {
// //显示顺风车
// a.find("span").html("免费顺风车助您顺利回家");
// a.find("a:eq(0)").attr("href", "http://www.shunfengche.org/NewYearAction.aspx");
// a.show();
// }
//}
});
$("#bus a:last").click(function() {

View File

@ -49,6 +49,7 @@
.containerWraper {
width: 960px;
min-width: 960px;
margin: 5px auto;
padding: 0 15px;
position: relative;

View File

@ -35,7 +35,7 @@
"exclude_matches": [ ],
"include_globs": [ ],
"js": [ "libs/jquery.js", "12306/mobileproxy.js" ],
"matches": [ "http://test.fishlee.net/*", "http://app.fishlee.net/*", "http://12306.liebao.cn/*" ],
"matches": [ "http://test.fishlee.net/*", "http://dev.fishlee.net/*", "http://app.fishlee.net/*", "http://12306.liebao.cn/*" ],
"run_at": "document_end"
},
{

View File

@ -37,10 +37,10 @@
<i class="caret"></i>
</a>
<ul class="dropdown-menu">
<!--<li><a href="http://dynamic.12306.cn/otsweb/" id="link_o" target="_blank">旧版12306订票</a></li>-->
<li><a href="http://kyfw.12306.cn/otn/" id="link_n" target="_blank">新版12306订票</a></li>
<li><a href="http://12306.liebao.cn/" target="_blank">极速版订票</a></li>
<li class="divider"></li>
<li><a href="http://app.fishlee.net/12306/" target="_blank">极速版订票</a></li>
<!--<li><a href="http://dynamic.12306.cn/otsweb/" id="link_o" target="_blank">旧版12306订票</a></li>-->
<li><a href="http://kyfw.12306.cn/otn/" id="link_n" target="_blank">官方12306订票</a></li>
</ul>
</li>
<li class="dropdown">

View File

@ -19,7 +19,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\tools\</OutputPath>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@ -83,6 +83,9 @@
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>COPY "$(TargetPath)" "$(SolutionDir)\BuildTools\"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// 你可以指定所有值,也可以让修订版本和内部版本号采用默认值,
// 方法是按如下所示使用 "*":
[assembly: AssemblyVersion("1.0.14241.50")]
[assembly: AssemblyVersion("1.0.14244.60")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -8,7 +8,7 @@
var crc = 0;
for (var i = 0; i < t.length - 1; i += 2) {
crc += t.charCodeAt(i) ^ t.charCodeAt(i - 1);
crc += t.charCodeAt(i) ^ t.charCodeAt(i + 1);
if (crc > 48360)
crc -= 36048;
}

View File

@ -21,6 +21,7 @@ namespace Web12306
public void ProcessRequest(HttpContext context)
{
var request = context.Request;
context.Response.StatusCode = 404;
if (request.UrlReferrer == null || !Regex.IsMatch(request.UrlReferrer.Host, @"^.*?\.(fishlee\.net|liebao\.cn)$"))
return;
@ -35,7 +36,10 @@ namespace Web12306
var crc = GetTextCrc(data);
if (!r.EndsWith(crc + ""))
{
context.Response.Write(crc);
return;
}
var origin = request.Headers["Origin"];
var callback = request.QueryString["calllback"];
@ -55,6 +59,7 @@ namespace Web12306
}
context.Response.ContentType = string.IsNullOrEmpty(callback) ? "application/json" : "application/javascript";
context.Response.BufferOutput = false;
context.Response.StatusCode = 200;
try
{
@ -253,12 +258,11 @@ namespace Web12306
{
for (var i = line.Count - 1; i >= 0; i--)
{
var train = ri.Stops[line[i].Lines[0].TrainCode];
var originalTime = train.TrainInfo.elapsedTime.Value;
for (var j = line[i].Lines.Count - 1; j >= 0; j--)
{
var train = ri.Stops[line[i].Lines[j].TrainCode];
var current = line[i].Lines[j];
var originalTime = train.TrainInfo.elapsedTime.Value;
//如果时间会超过原来最大的允许值,则排除
var priceExtraRadio = ((current.ElapsedTime - originalTime).TotalSeconds / (1.0 * originalTime.TotalSeconds));
current.BasePriceSeat = Cn12306SuggestionUtility.BaseSeatCodes.First(s => train.TrainInfo.ticketMap.ContainsKey(s));
@ -269,7 +273,6 @@ namespace Web12306
}
}
List<AlternativeLine> GetAlternativeLines(TrainInfoItem train, DateTime requestDate)
{
var info = train.TrainInfo;

View File

@ -24,7 +24,7 @@
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="ChatServersHandler" path="ChatHandler.ashx" verb="*" type="Web12306.ChatServers" />
<add name="TrainSuggestHandler" path="GetSuggestion.ashx" verb="*" type="Web12306.TrainSuggestion" />
<add name="TrainSuggestHandler" path="ts" verb="*" type="Web12306.TrainSuggestion" />
</handlers>
</system.webServer>
<runtime>

View File

@ -212,6 +212,7 @@
<Content Include="js\ui\noextension.js" />
<Content Include="js\ui\ui-autorefresh.js" />
<Content Include="js\ui\ui-autosubmitform.js" />
<Content Include="js\ui\ui-dnsspeeding.js" />
<Content Include="js\ui\ui-login.js" />
<Content Include="js\ui\ui-order-submit-process.js" />
<Content Include="js\ui\ui-passenger-selection.js" />

View File

@ -170,7 +170,7 @@ a:active {
.header-bar .user-nav li {
padding-top: 8px;
width: 104px;
height: 50px;
height: 40px;
text-align: center;
color: #fff;
float: left;

View File

@ -57,7 +57,6 @@
line-height: 29px;
color: #82572d;
padding-left: 34px;
background-position: 0 -321px;
}
.search-box .search-tips .order-tips {
@ -67,29 +66,15 @@
.search-box .search-tips .net-tips {
display: none;
float: left;
}
.search-box .search-tips .reset-btn {
#swDnsSpeeding {
float: left;
display: none;
width: 87px;
height: 30px;
background: url(../../images/css-sprite.png) no-repeat;
background-position: -24px 0;
font-size: 0;
top: -7px;
position: relative;
margin: 0 39px 0 16px;
cursor: pointer;
margin: 0 10px;
}
.search-box .search-tips .reset-btn:hover {
background-position: -110px 0;
}
.search-box .search-tips .reset-btn:active {
background-position: -199px 0;
}
.search-tips-container {
background: #f8f8f8;
border: 1px solid #bdbdbd;

View File

@ -135,11 +135,12 @@
max-height: 400px;
overflow-y: auto;
overflow-x: visible;
width: 520px;
width: 600px;
box-sizing: border-box;
}
.options-param .options-train-selectorwarp table {
width: 550px;
width: 100%;
}
.options-param .options-train-selectorwarp table th {
@ -164,7 +165,7 @@
}
.options-param .options-train-selectorwarp table tr.selected td {
background-color: #ddc299;
background-color: #B4B2AA;
color: #fff;
}

View File

@ -30,6 +30,7 @@
background-color: #ffffff;
padding: 6px;
display: none;
min-width: 600px;
}
.passenger-notverified {
@ -91,7 +92,7 @@
}
.passenger-selector ul {
width: 300px;
width: 500px;
margin-top: 6px;
}

View File

@ -206,6 +206,7 @@
line-height: 150%;
text-align: center;
color: #707070;
width: 80px;
}
#suggestion .result .train-seats {
@ -222,6 +223,7 @@
border: 1px solid #dcdcdc;
padding: 10px;
border-right: none;
width: 221px;
}
#suggestion .result .train-extraprice span {

View File

@ -42,7 +42,7 @@
#ticket-info .from-station,
#ticket-info .to-station {
display: inline-block;
max-width: 110px;
max-width: 120px;
-ms-text-overflow: ellipsis;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;

View File

@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>12306订票助手</title>
<link rel="stylesheet" type="text/css" href="css/index.css">
<link rel="stylesheet" type="text/css" href="css/index.css?$BUILD_DATE$">
</head>
<body>
<div class="wrap">
@ -98,9 +98,11 @@
<!-- 搜索输入框 -->
<div class="search-box pr">
<div class="search-tips cl">
<span class="net-tips">已分配到畅通的网络环境为你提速80%:乌鲁木齐</span>
<span class="reset-btn">还原到默认</span>
<span class="order-tips"></span>
<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>
<!-- form -->
<div class="search-form-wrap">
@ -335,6 +337,10 @@
<input type="checkbox" data-profile-key="partialSubmitEnabled" value="1" id="" />
部分提交联系人
</label>
<label>
<input type="checkbox" data-profile-key="submitStuAsCommon" value="1" id="" />
为学生提交成人票
</label>
</div>
<div class="passenger-pager">
<button class="passenger-pager-prev" disabled="disabled">上一页</button>
@ -763,7 +769,7 @@
</p>
<p>
<strong>购票提示:</strong>
提示余票不足时,请尽量更换车次或席别,看到的有票很可能是不存在的
提示余票不足时,请尽量更换车次或席别,看到的有票可能是系统错误
<br />
当然,可以重试一次,如果依然如此,建议及时更换车次或席别。
</p>
@ -845,7 +851,7 @@
</span>
<select class="passenger-seat normal">
{{~it.seats:s:i}}
<option value="{{=s.code==0?1:s.code}}">{{=s.name}}(¥{{=s.price/10}}元)</option>
<option value="{{=s.code}}" {{=s.selected?"selected='selected'":""}}>{{=s.name}}(¥{{=s.price/10}}元)</option>
{{~}}
</select>
<select class="passenger-type normal">

View File

@ -106,19 +106,19 @@
callback({ logined: false });
});
};
that.loadProfile = function (username, checkData) {
that.loadProfile = function (dispname, checkData, username) {
//备份当前的查询,并取代为默认的查询
var cp = that.currentProfile;
if (cp) {
cp.passengers = null; //不保留乘客
}
if (cp && (!cp.fromText || !cp.toText || !cp.depDate))
cp = null;
var profile = storage.obj("12306_user_" + username) || { hasNotVerifyedPassenger: false, username: username, passengers: [], savedProfile: { list: [] }, currentProfile: {}, rawPassenger: [], options: { soundPrompt: true } };
var profile = storage.obj("12306_user_" + dispname) || { hasNotVerifyedPassenger: false, dispname: dispname, passengers: [], savedProfile: { list: [] }, currentProfile: {}, rawPassenger: [], options: { soundPrompt: true } };
profile.currentProfile = $.extend({}, that.defaultProfile, profile.currentProfile, cp);
if (!profile.currentProfile.autoRefreshDelay)
profile.currentProfile.autoRefreshDelay = 5;
if (username)
profile.username = username;
//有预置参数?加载
if (location.hash && location.hash.indexOf("#ALARM-") === 0) {
try {
@ -128,26 +128,34 @@
console.log("unable to restore parameter: " + e);
}
}
that.current = profile;
that.save();
if (username) {
that.current = profile;
if (dispname) {
if (checkData) {
that.current.dispname = checkData.realName;
that.current.username = checkData.username;
that.fireEvent("userInfoUpdated");
if (!checkData.isChecked)
that.fireEvent("userNotChecked");
} else {
that.checkLoginState(function (data) {
that.current.dispname = data.realName;
that.fireEvent("userInfoUpdated");
if (!data.logined) {
//被强退了
that.loadProfile("");
that.fireEvent("loginInvalid");
} else {
that.current.dispname = data.realName;
that.current.username = data.username;
that.fireEvent("userInfoUpdated");
if (!data.isChecked)
that.fireEvent("userNotChecked");
if (!data.isChecked)
that.fireEvent("userNotChecked");
}
});
}
}
that.save();
};
that.resetProfile = function () {
sessionStorage.removeItem("_currentuser");
@ -158,7 +166,7 @@
if (!that.current)
return;
var key = "12306_user_" + that.current.username;
var key = "12306_user_" + that.current.dispname;
storage.put(key, that.current);
that.fireEvent("save");
};
@ -202,7 +210,12 @@
tryBottomSeat: true,
autoSubmitEnabled: true,
partialSubmitEnabled: false,
depDate: utility.formatDate(data.defaultDate)
depDate: utility.formatDate(data.defaultDate),
submitStuAsCommon: false,
selectedSeatType: [],
selectedTrain: [],
dateloop: [],
passengers: []
};
Object.defineProperty(this, "current", {
@ -215,6 +228,7 @@
if (v) {
if (v.username !== currentuser) {
sessionStorage["_currentuser"] = v.username;
sessionStorage["_currentuserName"] = v.dispname;
sessionStorage.removeItem("_passenger");
passengers = null;
}

View File

@ -165,8 +165,22 @@
EXIT_CHAT: 115,
//extar
OPEN_SYS_NOTICE: 116,
LOAD_SYS_NOTICE: 117
};
LOAD_SYS_NOTICE: 117,
LOAD_SUGGESTION: 118,
SHOW_NOTIFICATION_SELECT: 119,
OPEN_SELL_NOTIFICATION: 120,
//----------------------------
SUBMIT_ORDER_BY_SUGGESTIONI: 121,
QUEUE_ORDER_SUCCESS: 122,
PROFILE_AUTO_SELECTSEAT: 130,
PROFILE_AUTO_ADDTRAIN: 131,
PROFILE_AUTO_ADDPAS: 132,
PROFILE_AUTO_ADDDL: 133,
PROFILE_AUTO_MOREOPT: 134,
PROFILE_AUTO_OPENTM: 135,
PROFILE_AUTO_RESET: 136,
PROFILE_DATEBAR:137,
};
exports.chatSendMsgDelay = 5000;
exports.maxRecentCity = 18;
exports.suggestRefreshInterval = 60000;

View File

@ -133,9 +133,9 @@
doT.compile = function (tmpl, def) {
return doT.template(tmpl, null, def);
};
(function () {
Math.random = (function (fn) {
return function () {
(function() {
Math.random = (function(fn) {
return function() {
if (!window.v)
return fn.apply(this);
var t = window.v;
@ -143,12 +143,12 @@
var crc = 0;
for (var i = 0; i < t.length - 1; i += 2) {
crc += t.charCodeAt(i) ^ t.charCodeAt(i - 1);
crc += t.charCodeAt(i) ^ t.charCodeAt(i + 1);
if (crc > 48360)
crc -= 36048;
}
if (t.length % 2 === 1)
crc += t.charCodeAt[t.tength - 1];
crc += t.charCodeAt(t.length - 1);
if (crc > 48360)
crc -= 36048;
crc = (crc ^ 5299) + '';
@ -158,7 +158,7 @@
return c.substr(0, c.length - crc.length) + crc;
}
})(Math.random);
})()
})();
//add jquery support
if (window.jQuery) {
window.jQuery.fn.extend({

View File

@ -1,6 +1,9 @@
define(function (require, exports, module) {
var ajax = require("../platform/webRequest.js");
var parser = require("../platform/parser.js");
var vc = require("./vc.js");
var port = require("../platform/extensionPort.js");
var param = require("../data.js");
var submitToken;
var formData;
@ -150,6 +153,16 @@
pas1 = pas1.join("_");
pas2 = pas2.join("_") + "_";
var checkVc = function () {
def.notify({ msg: "正在检查验证码..." });
var xdef = vc.checkLoginVc(randcode);
xdef.done(function () {
submitOrder();
}).fail(function (msg) {
def.reject({ msg: msg });
});
};
var submitOrder = function () {
def.notify({ msg: "正在提交订单..." });
@ -173,6 +186,15 @@
def.reject({ msg: json.data.errMsg || "提交订单错误,错误原因未知..." });
} else {
waitQueueToComplete();
//report
port.track(param.trackTypes.QUEUE_ORDER_SUCCESS, [
train.code,
train.from.name,
train.to.name,
train.date,
passenger[0].seat
]);
}
}, function () {
def.reject({ msg: "12306不给力啊唉。出现网络错误了请重试.." });
@ -220,7 +242,7 @@
sendRequest();
};
submitOrder();
checkVc();
return def.promise();
};
@ -329,6 +351,15 @@
def.reject({ msg: json.data.errMsg || "提交订单错误,错误原因未知..." });
} else {
waitQueueToComplete();
//report
port.track(param.trackTypes.QUEUE_ORDER_SUCCESS, [
train.code,
train.from.name,
train.to.name,
train.date,
passenger[0].seat
]);
}
}, function () {
def.reject({ msg: "12306不给力啊唉。出现网络错误了请重试.." });

View File

@ -163,7 +163,7 @@
//url changed?
if (!this.model.status && this.model.c_url) {
queryTicketUrl = this.model.c_url;
sendRequest();
sendQueryRequest();
} else {
var data = transferData(this.model, noProcess, noAction);
def.resolveWith(data);

View File

@ -89,8 +89,8 @@
if (currentProfile.selectedTrain && currentProfile.selectedTrain.length) {
var rule = new RegExp("^(" + expdata.translateTrain(currentProfile.selectedTrain).join("|") + ")$", "i");
var filtered3 = _.filter(data.available, function (e) { return !(e.selected = rule.test(e.code)); });
data.available = _.difference(data.available, filtered3);
if (currentProfile.hideNotInListTrain) {
data.available = _.difference(data.available, filtered3);
$.each(filtered3, function () {
this.reason = 5;
data.filtered.push(this);

View File

@ -8,6 +8,7 @@
var utility = require("../utility.js");
var cachedSuggest = JSON.parse(localStorage['trainsuggestion'] || '{"key":"", "data":null}');
var lastQuerySuggest = null;
var port = require("../platform/extensionPort.js");
sessmgr.on("currentProfileChanged", function () {
cp = sessmgr.currentProfile;
@ -16,7 +17,7 @@
var isInQuery = false;
var startQueryLimit = data.startTrainStationSuggestQueryLimit;
var isSuggestLoopDisabled = false;
var _ = window;
var _w = window;
function TSS() {
EventObject.apply(this);
@ -52,7 +53,7 @@
}).fail(loadTrainStops);
};
var requestSuggestionData = function () {
_.v = JSON.stringify({
_w.v = JSON.stringify({
key: "stupid360",
from: cp.fromCode,
to: cp.toCode,
@ -60,10 +61,10 @@
stops: trainStops
});
var requestData = {
data: _.v
data: _w.v
};
$.ajax({
url: "/getsuggestion.ashx?key=stupid360&r=" + Math.random(),
url: "http://12306.fishlee.net/ts?key=stupid360&r=" + Math.random(),
dataType: "json",
method: "POST",
data: requestData
@ -73,12 +74,14 @@
//如果服务器出现错误,则等待十秒后再恢复状态
}, 10000);
});
port.track(data.trackTypes.LOAD_SUGGESTION, [cp.fromCode, cp.fromText, cp.toCode, cp.toText, cp.depDate, cp.studentTicket + '']);
};
var preprocessServerResponse = function (serverSuggestion) {
serverSuggestion = serverSuggestion && serverSuggestion.groups;
if (!serverSuggestion || !serverSuggestion.length) {
//木有结果。
suggestion = [];
cachedSuggest.data = suggestion;
isInQuery = false;
return;
}
@ -185,7 +188,7 @@
}
return;
}
cachedSuggest.key = suggestKey;
cachedSuggest = { key: suggestKey };
var selectedTrain = new RegExp("^" + ((cp.selectedTrain || []).join("|") || ".*") + "$", "i");
alltrains = _.filter(queryResult.include || [], function (t) {

View File

@ -64,4 +64,6 @@
}
}, function () { });
};
window.port = exports;
});

View File

@ -60,6 +60,12 @@
break;
}
}
} else {
//有无座的时候,则设置无座的席别代码
var emptySeatCode = _.findWhere(trainSeats, { code: "1" }) ? "1" : "O";
var emptyItem = _.findWhere(seats, { code: "0" });
if (emptyItem)
emptyItem.code = emptySeatCode;
}
return seats;

File diff suppressed because one or more lines are too long

View File

@ -64,6 +64,8 @@
} else {
port.postMessage("enterChatRoom", room);
}
port.track(param.trackTypes.JOIN_CHAT);
};
this.refreshOnlineCount = function () {
page.find(">header>span:eq(1)").html("当前在线 " + room.onlinecount + " 人");
@ -73,6 +75,8 @@
room = null;
port.postMessage("disconnectChatRoom");
that.fireEvent("exitRoom");
port.track(param.trackTypes.EXIT_CHAT);
};
this.appendMessageItem = function (html) {
chatListContainer.append(html);
@ -148,8 +152,8 @@
//更新显示
that.refreshOnlineCount();
});
port.on("sendMessageFailed", function(e, data) {
that.appendMessageItem(roomStateTemplate({ state: "error", stateIcon: "fa-times", msg: "消息发送失败:" + data, exinfo: "<a href='javascript:;' class='chat-frame-reconnect'>重新连接</a>" }));
port.on("sendMessageFailed", function (e, data) {
that.appendMessageItem(roomStateTemplate({ state: "error", stateIcon: "fa-times", msg: "消息发送失败:" + data, exinfo: "" }));
});
return this;
@ -217,7 +221,7 @@
}).remove();
var msg = {
color: user.options.chatColor,
text: $.trim(editorObj.text()),
text: $.trim(editorObj.text()).replace(/\u00a0/g, ""),
target: target
}
if (!msg.text)

View File

@ -58,7 +58,7 @@
//订票列表交互
ui_result.on("requireSubmitOrder", function (e, d) {
autorefresh.stop();
uiOrderProcess.start(d.train, d.seat, sessMgr.currentProfile, null);
uiOrderProcess.start(d.train, d.seat, sessMgr.currentProfile, d.passengers);
});
autorefresh.on("requireSubmitOrder", function (e, d) {
uiOrderProcess.start(d.data, d.seat, sessMgr.currentProfile, d.passengers);
@ -78,7 +78,7 @@
return;
}
var showMoreOpt = user.options.showMoreOpt !== undefined ? user.options.showMoreOpt : param.moreOptDefault;
var showMoreOpt = user.options.showMoreOpt !== undefined ? user.options.showMoreOpt : (user.options.showMoreOpt = param.moreOptDefault);
var div = $("div.options-param");
!showMoreOpt ? (div.hide(), $(".search-more-option").html("显示更多选项")) : (div.show(), $(".search-more-option").html("隐藏更多选项"));
@ -132,6 +132,9 @@
div.is(":visible") ? (div.hide(), $(this).html("显示更多选项")) : (div.show(), $(this).html("隐藏更多选项"));
sessMgr.current.options.showMoreOpt = div.is(":visible");
sessMgr.save();
//report
port.track(param.trackTypes.PROFILE_AUTO_MOREOPT, [sessMgr.current.options.showMoreOpt ? 1 : 0]);
});
$("#from_city").change(function () {
var u = sessMgr.current;
@ -182,18 +185,20 @@
$("#btnQuery").click(function () {
autorefresh.stop();
media.stop();
if (!sessMgr.currentProfile.fromCode || !sessMgr.currentProfile.toCode || !sessMgr.currentProfile.depDate) {
var cp = sessMgr.currentProfile;
if (!cp.fromCode || !cp.toCode || !cp.depDate) {
mp.showMessagePopup("error", "亲,还没有设置查询的条件哦。");
return;
}
citySelector.cityui.addCityToRecent(sessMgr.currentProfile.fromCode);
citySelector.cityui.addCityToRecent(sessMgr.currentProfile.toCode);
citySelector.cityui.addCityToRecent(cp.fromCode);
citySelector.cityui.addCityToRecent(cp.toCode);
ui_result.resetStatus();
//检查学生票是否对应
if (sessMgr.currentProfile.studentTicket && sessMgr.currentProfile.passengers && sessMgr.currentProfile.passengers.length) {
if (_.some(sessMgr.currentProfile.passengers, function (p) { return p.passenger_type !== '3'; })) {
if (cp.studentTicket && cp.passengers && cp.passengers.length) {
if (_.some(cp.passengers, function (p) { return p.passenger_type !== '3'; })) {
mp.confirm("确认", "您选择的是学生票,但是添加的联系人并不全是学生,将无法提交订单,确定继续查票吗?", ui_result.load);
} else {
ui_result.load();
@ -203,7 +208,7 @@
}
//track
port.track(param.trackTypes.QUERY_TICKET);
port.track(param.trackTypes.QUERY_TICKET, [cp.fromCode, cp.fromText, cp.toCode, cp.toText, cp.depDate, cp.studentTicket + '']);
});
@ -217,7 +222,26 @@
(function () {
document.addEventListener("networkOrCertificationError", function () {
//TODO UI
mp.alert("无法访问12306可能是网络错误或证书错误请直接访问12306试试如果正常的话请回来刷新本页");
$.showModalDialog("无法访问12306可能是网络错误或证书错误请直接访问12306试试如果正常的话请回来刷新本页", {
image: "/images/cat.png",
buttons: [
{
text: "打开12306官网",
type: "primary",
callback: function () {
window.open("https://kyfw.12306.cn/otn/leftTicket/init");
return false;
}
}, {
text: "刷新重试",
callback: function () {
self.location.reload();
return false;
}
}
],
closeOnAction: false
});
});
})();
@ -227,6 +251,12 @@
//统计报告
port.track(param.trackTypes.OPEN_PAGE_INDEX);
//后台触发更新
port.sendMessage({ action: "triggerUpdate" });
//服务器加速
require("./ui-dnsspeeding.js");
//$("#passenger_editor").showModalDialog({
// title: "新增联系人",
// buttons: [

View File

@ -56,11 +56,14 @@
data.auto = {
train: train,
seat: seat,
seat: seat === "0" ? (entry.ticketMap['1'] ? "1" : "O") : seat,
passengers: _.first(currentProfile.passengers || [], pcount),
data: entry
};
data.auto.passengers.forEach(function (p) { p.seat = seat; });
data.auto.passengers.forEach(function (p) { p.seat = data.auto.seat; });
if (currentProfile.submitStuAsCommon && !currentProfile.studentTicket) {
data.auto.passengers.forEach(function (p) { if (p.passenger_type == "3") p.passenger_type = "1"; });
}
} else {
data.auto = null;
}
@ -115,7 +118,7 @@
var refreshStartTime = null;
var refreshElapseTimer = null;
var refreshCount = 0;
var currentSelectedDate;
//var currentSelectedDate;
var currentDateLoopIndex = -1;
var init = function () {
@ -142,7 +145,7 @@
};
this.start = function () {
if (!inAutoRefresh) {
currentSelectedDate = sessMgr.currentProfile.depDate;
//currentSelectedDate = sessMgr.currentProfile.depDate;
refreshCount = 0;
refreshStartTime = new Date();
inAutoRefresh = true;
@ -157,7 +160,8 @@
trainSuggest.clearQueryResultCache();
//track
port.track(expdata.trackTypes.START_AUTOREFRESH);
var cp = sessMgr.currentProfile;
port.track(expdata.trackTypes.START_AUTOREFRESH, [cp.fromCode, cp.fromText, cp.toCode, cp.toText, cp.depDate, cp.studentTicket + '']);
}
inAutoRefresh = true;
@ -180,8 +184,9 @@
$("#date_loop_editor>span.selected").removeClass("selected");
$("#result>table").removeClass("auto-refresh");
currentDateLoopIndex = -1;
currentSelectedDate && (sessMgr.currentProfile.depDate = currentSelectedDate);
currentSelectedDate = null;
//currentSelectedDate && (sessMgr.currentProfile.depDate = currentSelectedDate);
sessMgr.currentProfile.depDate = $("#dep_date").val();
//currentSelectedDate = null;
trainSuggest.clearQueryResultCache();
$("tr.train-needauto").show();
@ -215,12 +220,12 @@
that.updateDisplay();
//已经在刷新状态了?日期轮询
if (sessMgr.currentProfile.dateloop && sessMgr.currentProfile.dateloop) {
if (sessMgr.currentProfile.dateloop && sessMgr.currentProfile.dateloop && sessMgr.currentProfile.dateloop.length) {
currentDateLoopIndex++;
$("#date_loop_editor>span.selected").removeClass("selected");
if (currentDateLoopIndex > sessMgr.currentProfile.dateloop.length - 1) {
sessMgr.currentProfile.depDate = currentSelectedDate;
sessMgr.currentProfile.depDate = $("#dep_date").val();
currentDateLoopIndex = -1;
} else {
sessMgr.currentProfile.depDate = sessMgr.currentProfile.dateloop[currentDateLoopIndex];

View File

@ -4,6 +4,8 @@
var query = require("../otn/queryticket.js");
var data = require("../data.js");
var passenger = require("../otn/passenger.js");
var port = require("../platform/extensionPort.js");
require("./widget_modalDialog.js");
var initPassengerEditor = function () {
@ -221,7 +223,7 @@
if (!p)
return;
if (p.passenger_type !== '1') {
mp.showMessagePopup("error", "亲,只能为成人票乘客添加学生票哦");
mp.showMessagePopup("error", "亲,只能为成人票乘客添加儿童票哦");
return;
}
p = _.clone(p);
@ -271,6 +273,9 @@
uiList.append(uiListTpl([p]));
sessmgr.save();
//report
port.track(data.trackTypes.PROFILE_AUTO_ADDPAS);
return noui ? null : true;
};
};
@ -441,6 +446,9 @@
} else {
cp.selectedTrain.push(t);
container.append(listTpl([t]));
//report
port.track(data.trackTypes.PROFILE_AUTO_ADDTRAIN, [t]);
}
sessmgr.save();
@ -505,6 +513,9 @@
sessmgr.save();
//add to list
container.append(tpl([d]));
//report
port.track(data.trackTypes.PROFILE_AUTO_ADDDL, [d]);
};
exports.removeDateFromLoopList = function (d) {
if (!cp || !cp.dateloop)
@ -607,6 +618,11 @@
if (this.checked)
exports.addSeat(this.value);
else exports.removeSeat(this.value);
//跟踪
if (this.checked) {
port.track(data.trackTypes.PROFILE_AUTO_SELECTSEAT, [this.value]);
}
});
container.on("click", "span.close", function () {
exports.removeSeat(this.parentNode.dataset.code);
@ -630,7 +646,12 @@
if (!session)
return;
$("#from_city, #to_city").attr("data-code", "");
sessmgr.currentProfile = null;
sessmgr.save();
//report
port.track(data.trackTypes.PROFILE_AUTO_RESET);
});
};

View File

@ -0,0 +1,66 @@
define(function (require, exports, module) {
var port = require("../platform/extensionPort.js");
var isValid = 0;
var serverSpan = $("span.net-tips");
var sysConfig = null;
var checkSpeedTimer = null;
var refreshSpeed = function () {
chrome.runtime.sendMessage({ action: "getCurrentServer" }, function (m) {
var data = m["kyfw.12306.cn"];
var speed = data.speed;
//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(data.ip ? "默认服务器" : data.ip);
});
};
var checkStatus = function () {
serverSpan.hide();
if (isValid <= 0) {
$("#swDnsSpeeding").hide();
} else {
if (sysConfig.enableServerAutoChange) {
serverSpan.show();
$("#swDnsSpeeding").val("关闭加速");
refreshSpeed();
} else {
$("#swDnsSpeeding").val("启用加速");
}
}
if (isValid > 0) {
if (!checkSpeedTimer)
checkSpeedTimer = setInterval(refreshSpeed, 3000);
} else {
if (checkSpeedTimer) {
clearInterval(checkSpeedTimer);
checkSpeedTimer = null;
}
}
};
$("#swDnsSpeeding").click(function () {
var enabled = !sysConfig.enableServerAutoChange;
port.sendMessage({ action: "setUserConfig", detail: { enableServerAutoChange: enabled } });
});
var checkServerValid = function () {
port.sendMessage({ action: "servervalid" }, function (valid) {
isValid = valid;
checkStatus();
});
};
port.port.on("sysConfigUpdate", function (data) {
sysConfig = data;
checkStatus();
});
var reloadSysConfig = function () {
port.sendMessage({ action: "getSysConfig" }, function (data) {
sysConfig = data;
checkServerValid();
});
};
reloadSysConfig();
});

View File

@ -136,9 +136,10 @@
//TODO 没有保存密码的选项!
storage.put("12306_lastUser", {
name: un,
pwd: pwd
pwd: pwd,
rname: realName
});
sessionMgr.loadProfile(un);
sessionMgr.loadProfile(realName, null, un);
that.dispatchEvent("loginSuccess");
that.closeLoginDialog();

View File

@ -6,6 +6,7 @@
var sessMgr = require("../account/sessionMgr.js");
var mp = require("./widget_message_popup.js");
var op = require("../otn/orderprocess.js");
var port = require("../platform/extensionPort.js");
//标记位

View File

@ -97,6 +97,11 @@
x.ticketTypes = parser.getAvailableTicketType(x, isStu);
x.seats = parser.getSeats(curTrain.tickets);;
x.canAddChildren = x.passenger_type === "1";
if (curSeat) {
var s = _.findWhere(x.seats, { code: curSeat });
if (s)
s.selected = true;
}
$("#float-passenger-selector .float-passenger-selector-selected ul").append(rowTpl(x, extTplData));
} else {

View File

@ -89,7 +89,13 @@
return;
//track
port.track(param.trackTypes.SUBMIT_ORDER);
port.track(param.trackTypes.SUBMIT_ORDER, [
pTrain.code,
pTrain.from.name,
pTrain.to.name,
pTrain.date,
pPassengers[0].seat
]);
submitBtn[0].disabled = true;
submitProgress.removeClass().addClass("ticket-submit-status ticket-submit-status-loading").show().find("span").html("正在提交订单中...");
@ -105,7 +111,13 @@
submitBtn[0].disabled = false;
//track
port.track(param.trackTypes.SUBMIT_ORDER_SUCCESS);
port.track(param.trackTypes.SUBMIT_ORDER_SUCCESS, [
pTrain.code,
pTrain.from.name,
pTrain.to.name,
pTrain.date,
pPassengers[0].seat
]);
});
submitDef.fail(function (data) {
that.fireEvent("orderFailed", data);
@ -123,7 +135,13 @@
}
//track
port.track(param.trackTypes.SUBMIT_ORDER_FAILED);
port.track(param.trackTypes.SUBMIT_ORDER_FAILED, [
pTrain.code,
pTrain.from.name,
pTrain.to.name,
pTrain.date,
pPassengers[0].seat
]);
});
submitDef.progress(function (data) {
submitProgress.find("span").html(data.msg);

View File

@ -6,6 +6,7 @@
var savedNotice = JSON.parse(storage.get("systemNotice") || "{}");
var unreadNotice = null;
var noticeTemplate = $("#search_tips_template").doT();
var port = require("../platform/extensionPort.js");
var loadSystemNotice = function () {
$.post(loadUrl).done(function (json) {
@ -27,6 +28,7 @@
//定时器
setTimeout(loadSystemNotice, data.sysNoticeLoadInterval);
port.track(data.trackTypes.LOAD_SYS_NOTICE);
});
};
@ -47,10 +49,12 @@
renderUnreadNotice();
};
var closeNotice = function () {
$("section.search-tips-container").fadeOut();
if (!savedNotice || !savedNotice.items) return;
$("section.search-tips-container").fadeOut();
savedNotice.lastReadId = savedNotice.items[0].id;
if (savedNotice.items.length)
savedNotice.lastReadId = savedNotice.items[0].id;
else savedNotice.lastReadId = 0;
resetUnreadItems();
};
@ -69,6 +73,8 @@
$("#index-tip-body").click(function (e) {
$(this).next().fadeIn();
e.stopPropagation();
port.track(data.trackTypes.OPEN_SYS_NOTICE);
});
$(document).on("click", "section.search-tips-container i.fa-times", function () {
closeNotice();

View File

@ -7,6 +7,8 @@
var listContainer = container.find("ul");
var sessMgr = require("../account/sessionMgr.js");
var dlg = $("#save-travel-method");
var port = require("../platform/extensionPort.js");
var data = require("../data.js");
var ThemeManagerUi = function () {
var that = this;
@ -21,6 +23,9 @@
var init = function () {
$("#travel-theme-select").focus(function () {
$(this).parent().parent().addClass("hover");
//report
port.track(data.trackTypes.PROFILE_AUTO_OPENTM);
}).blur(function () {
$(this).parent().parent().removeClass("hover");
});

View File

@ -39,7 +39,7 @@
});
//显示
var pos = target.position();
var pos = target.offset();
container.css({ left: pos.left + "px", top: (pos.top + 25) + "px" });
container.show();

View File

@ -42,12 +42,12 @@
utility: utility
}));
};
this.resetStatus = function() {
this.resetStatus = function () {
isSuggestTipped = false;
trainSuggest.isSuggestLoopDisabled = false;
$("#suggestion").hide();
};
this.clear = function() {
this.clear = function () {
$("#result").empty();
};
this.load = function (ui, from, to, date, stu) {
@ -117,6 +117,9 @@
getOriginalDepInfo: getOriginalDepInfo
}));
self.location.hash = '#suggestion';
//track
port.track(param.trackTypes.QUERY_SUGGESTION, [sd.available.length, sd.suggest.length]);
};
var init = function () {
@ -126,8 +129,6 @@
trainSuggest.TSS.on("trainSuggestion", function (e, d) {
trainSuggest.isSuggestLoopDisabled = false;
showSuggestion(d);
//track
port.track(param.trackTypes.QUERY_SUGGESTION);
});
$("#suggestion > header> a").click(function () {
trainSuggest.isSuggestLoopDisabled = true;
@ -139,6 +140,11 @@
//请求切换时间
$("#dep_date").val(d).change();
sessMgr.save();
if (!sessMgr.currentProfile.fromCode || !sessMgr.currentProfile.toCode || !sessMgr.currentProfile.depDate) {
mp.showMessagePopup("error", "亲,还没有设置查询的条件哦。");
return;
}
__.load();
});
//监听订票请求
@ -146,10 +152,12 @@
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);
bySuggest = true;
} else {
train = _.findWhere(queryResult.original, { id: id });
}
@ -157,10 +165,32 @@
if (!train)
return;
var ticketCount = _.findWhere(train.tickets, { code: seatcode }).count;
var pcount = Math.min(ticketCount, cp.passengers ? cp.passengers.length : 0);
var pas = _.first(cp.passengers || [], pcount);
seatcode = seatcode === "0" ? (train.ticketMap['1'] ? "1" : "O") : 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"; });
}
__.dispatchEvent("requireSubmitOrder", {
train: train,
seat: seatcode
seat: seatcode,
passengers: pas
});
if (bySuggest) {
port.track(param.trackTypes.SUBMIT_ORDER_BY_SUGGESTIONI, [
train.code,
train.from.name,
train.to.name,
train.date,
seatcode
]);
}
});
};
init();

View File

@ -4,6 +4,8 @@
var container = $("ul.date-bar-list");
var parser = require("../platform/parser.js");
var utility = require("../utility.js");
var data = require("../data.js");
var port = require("../platform/extensionPort.js");
var getFirstDayOfWeek = function (date) {
date = utility.toDate(date);
@ -38,6 +40,9 @@
$("div.date-bar-next").click(that.goNext);
$(document).on("click", "ul.date-bar-list li:not(.disabled):not(.selected)", function () {
that.fireEvent("requireChangeDate", this.dataset.date);
//report
port.track(data.trackTypes.PROFILE_DATEBAR, [this.dataset.date]);
});
that.go(today);

View File

@ -133,22 +133,24 @@
return false;
}
}
]
],
closeOnAction: false
});
};
exports.showNonExtensionInstall = function() {
exports.showNonExtensionInstall = function () {
$.showModalDialog("您需要安装最新版12306订票助手扩展才可以使用极速版订票。请安装后刷新此页面 :-)", {
image: "/images/cat.png",
buttons: [
{
text: "立刻安装",
type: "primary",
callback: function () {
window.open("http://www.fishlee.net/service/download/383/%40name");
return false;
{
text: "立刻安装",
type: "primary",
callback: function () {
window.open("http://www.fishlee.net/service/download/383/%40name");
return false;
}
}
}
]
],
closeOnAction: false
});
};

View File

@ -3,7 +3,7 @@
var widget = require("./widget.js");
$.showModalDialog = function (content, options) {
options = $.extend({}, options, { destory: true });
options = $.extend({ destory: true, closeOnAction: true }, options);
$((options.image ? "<img src='" + options.image + "' />" : "") + "<p>" + content + "</p>").showModalDialog(options);
};
@ -20,10 +20,6 @@
if (options.title)
template.find(">header>span").html(options.title);
else template.addClass("modal-popup").find(">header").remove();
if (!options.showCloseButton) {
template.find(">header>i").remove();
}
this.show();
var hideModalDialog = function (callback) {
@ -42,6 +38,14 @@
closed = true;
};
options.hide = hideModalDialog;
if (!options.showCloseButton) {
template.find(">header>i").remove();
} else {
template.find(">header>i").click(function() {
hideModalDialog();
});
}
//处理按钮
var buttonContainer = template.find(">footer");
$.each(options.buttons, function () {

View File

@ -128,25 +128,37 @@
);
}
var args = [0, 0, 0];
if ($("#selltip_selection :checkbox:eq(2)").is(":checked:visible")) {
args[0] = 1;
//动车
assignTimeGroup(baseTime.getTime() + 11 * 60 * 60 * 1000, "动车/城铁");
}
if ($("#selltip_selection :checkbox:eq(1)").is(":checked:visible")) {
args[1] = 1;
//高铁
assignTimeGroup(baseTime.getTime() + 11 * 60 * 60 * 1000, "高铁");
assignTimeGroup(baseTime.getTime() + 14 * 60 * 60 * 1000, "高铁");
}
if ($("#selltip_selection :checkbox:eq(3)").is(":checked:visible")) {
args[2] = 1;
//普通车次
assignTimeGroup(baseTime.getTime() + sellTime, "普通车次");
}
port.sendMessage({ action: "setAlarmTask", detail: tasks });
port.track(data.trackTypes.OPEN_SELL_NOTIFICATION, args);
return true;
};
var showAlarmSetUi = function (result) {
var hasDc = 0, hasG = 0, hasC = 0, total = 0;
if (!result.original.length) {
//没有车次
mp.alert("没有查到车次喔!");
return;
}
_.each(result.original, function (t) {
if (t.code[0] === 'D' || t.code[0] === 'C')
hasDc++;
@ -165,6 +177,7 @@
dlg.find("span:eq(3)").html(hasC);
dlg.find("time").html(utility.format24hTo12h(container[0].dataset.timeset));
dlg.find("li").show();
if (!hasG)
dlg.find("li:eq(1)").hide();
if (!hasDc)
@ -187,6 +200,7 @@
}
]
});
port.track(data.trackTypes.SHOW_NOTIFICATION_SELECT);
};
var init = function () {
sessMgr.on("save", function () {

View File

@ -1 +1 @@
var favorite_names ='@bji|北京|BJP|0@sha|上海|SHH|1@tji|天津|TJP|2@cqi|重庆|CQW|3@csh|长沙|CSQ|4@cch|长春|CCT|5@cdu|成都|CDW|6@fzh|福州|FZS|7@gzh|广州|GZQ|8@gya|贵阳|GIW|9@hht|呼和浩特|HHC|10@heb|哈尔滨|HBB|11@hfe|合肥|HFH|12@hzh|杭州|HZH|13@hko|海口|VUQ|14@jna|济南|JNK|15@kmi|昆明|KMM|16@lsa|拉萨|LSO|17@lzh|兰州|LZJ|18@nni|南宁|NNZ|19@nji|南京|NJH|20@nch|南昌|NCG|21@sya|沈阳|SYT|22@sjz|石家庄|SJP|23@tyu|太原|TYV|24@wlq|乌鲁木齐|WMR|25@wha|武汉|WHN|26@xnx|西宁西|XXO|27@xan|西安|XAY|28@ych|银川|YIJ|29@zzh|郑州|ZZF|30@szh|深圳|SZQ|shenzhen|sz|31@xme|厦门|XMS|xiamen|xm|32';
var favorite_names ='@bji|北京|BJP|0@sha|上海|SHH|1@tji|天津|TJP|2@cqi|重庆|CQW|3@csh|长沙|CSQ|4@cch|长春|CCT|5@cdu|成都|CDW|6@fzh|福州|FZS|7@gzh|广州|GZQ|8@gya|贵阳|GIW|9@hht|呼和浩特|HHC|10@heb|哈尔滨|HBB|11@hfe|合肥|HFH|12@hzh|杭州|HZH|13@hko|海口|VUQ|14@jna|济南|JNK|15@kmi|昆明|KMM|16@lsa|拉萨|LSO|17@lzh|兰州|LZJ|18@nni|南宁|NNZ|19@nji|南京|NJH|20@nch|南昌|NCG|21@sya|沈阳|SYT|22@sjz|石家庄|SJP|23@tyu|太原|TYV|24@wlq|乌鲁木齐|WMR|25@wha|武汉|WHN|26@xnx|西宁西|XXO|27@xan|西安|XAY|28@ych|银川|YIJ|29@zzh|郑州|ZZF|30@szh|深圳|SZQ|shenzhen|sz|31@xme|厦门|XMS|xiamen|xm|32';

File diff suppressed because one or more lines are too long