diff --git a/Web12306/Web.config b/Web12306/Web.config
index e5266dd..623389d 100644
--- a/Web12306/Web.config
+++ b/Web12306/Web.config
@@ -20,30 +20,34 @@
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
diff --git a/Web12306/Web12306.csproj b/Web12306/Web12306.csproj
index 70995e6..d44178c 100644
--- a/Web12306/Web12306.csproj
+++ b/Web12306/Web12306.csproj
@@ -44,6 +44,10 @@
+
+ True
+ ..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll
+
@@ -54,6 +58,30 @@
+
+ False
+ ..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.Helpers.dll
+
+
+ False
+ ..\packages\Microsoft.AspNet.Mvc.5.2.0\lib\net45\System.Web.Mvc.dll
+
+
+ False
+ ..\packages\Microsoft.AspNet.Razor.3.2.0\lib\net45\System.Web.Razor.dll
+
+
+ False
+ ..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.dll
+
+
+ False
+ ..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Deployment.dll
+
+
+ False
+ ..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Razor.dll
+
@@ -71,37 +99,9 @@
-
- True
- ..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.Helpers.dll
-
-
- True
- ..\packages\Microsoft.AspNet.Mvc.5.0.0\lib\net45\System.Web.Mvc.dll
-
..\packages\Microsoft.AspNet.Web.Optimization.1.1.1\lib\net40\System.Web.Optimization.dll
-
- True
- ..\packages\Microsoft.AspNet.Razor.3.0.0\lib\net45\System.Web.Razor.dll
-
-
- True
- ..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.dll
-
-
- True
- ..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.Deployment.dll
-
-
- True
- ..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.Razor.dll
-
-
- True
- ..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll
-
True
..\packages\WebGrease.1.5.2\lib\WebGrease.dll
@@ -135,6 +135,7 @@
Global.asax
+
diff --git a/Web12306/css/ui/chat/chat-container.css b/Web12306/css/ui/chat/chat-container.css
index c23a1d5..23ef996 100644
--- a/Web12306/css/ui/chat/chat-container.css
+++ b/Web12306/css/ui/chat/chat-container.css
@@ -35,13 +35,20 @@
margin-right: 5px;
}
+ #chat_container .chat-items .chat-item em {
+ font-weight: normal;
+ color: gray;
+ margin-left: 5px;
+ margin-right: 5px;
+ font-style: normal;
+ }
+
#chat_container .chat-items .chat-item > header {
font-weight: bold;
float: left;
}
#chat_container .chat-items .chat-item > section {
- display: inline;
}
#chat_container .chat-items .chat-item > time {
@@ -54,18 +61,28 @@
}
#chat_container .chat-items .chat-item-self {
- color: rgb(73, 174, 73);
- background-color: #E5F8E5;
+ color: rgb(55, 153, 55);
+ background-color: #EFFAEF;
}
#chat_container .chat-items .chat-item-receive {
- color: rgb(147, 95, 224);
- background-color: #e4e4ff;
+ color: rgb(50, 83, 168);
+ background-color: #F9FAFF;
+ }
+
+ #chat_container .chat-items .chat-item-target {
+ color: rgb(50, 83, 168);
+ background-color: #BBE7FF;
}
#chat_container .chat-items .chat-item-private {
border-width: 2px;
}
+
+ #chat_container .chat-items .chat-state-disconnect {
+ background-color: #ffeeee;
+ color: rgb(50, 83, 168);
+ }
#chat_container .chat-item-at {
color: inherit;
@@ -118,8 +135,17 @@
border: 1px solid #bbb;
border-radius: 5px;
padding: 10px;
+ line-height: 24px;
}
+ #chat_container .chat-editor > section .chat-editor-at {
+ padding: 5px;
+ background-color: royalblue;
+ color: #fff;
+ margin-right: 5px;
+ border-radius: 5px;
+ }
+
#chat_container .chat-editor > section:focus {
outline: none;
}
diff --git a/Web12306/css/ui/query-result.css b/Web12306/css/ui/query-result.css
index 1523212..65e888f 100644
--- a/Web12306/css/ui/query-result.css
+++ b/Web12306/css/ui/query-result.css
@@ -72,6 +72,7 @@
color: #cccccc;
}
+ .result .train-seats .train-limitsell,
.result .train-seats .train-notsell {
font-size: 20px;
color: #999;
diff --git a/Web12306/index.html b/Web12306/index.html
index 608651f..0121ebb 100644
--- a/Web12306/index.html
+++ b/Web12306/index.html
@@ -401,7 +401,7 @@
, 需要加价。
{{}}}
{{}}}
-
+
@@ -494,6 +494,8 @@
{{?t.available==0||t.available==-1}}
{{?t.selltime}}
{{=ext.utility.formatSellDate(t.selltime)}} 起售
+ {{??t.limitSellInfo}}
+ 本车次{{!t.limitSellInfo}}
{{??}}
本车次票已售完
{{?}}
@@ -501,7 +503,6 @@
本车次不在您的选择列表中
{{?}}
-
{{~}}
{{?!it.original||!it.original.length}}
@@ -852,45 +853,41 @@
{{!it.msg}}
+ {{=it.exinfo}}
+
+
+
-
-
-
-
diff --git a/Web12306/js/boot.js b/Web12306/js/boot.js
index 963a82e..c1368c2 100644
--- a/Web12306/js/boot.js
+++ b/Web12306/js/boot.js
@@ -110,58 +110,46 @@
var notInstallExtension = function () {
seajs.use("ui/noextension");
};
- var entryPoint = function () {
- if (!window.targetExtensionId) {
- notInstallExtension();
- } else {
- //确保内容脚本启动
- var start = $.Deferred();
- start.done(function () {
- chrome.runtime.sendMessage(window.targetExtensionId, { action: "getStorage" }, function (m) {
- window.storage = m.detail;
-
- seajs.use("ui/" + pagename);
- });
- });
- start.fail(function () {
- notInstallExtension();
- });
-
- if (document.body.dataset["mobileSupportInitialized"]) {
- start.resolve();
- } else {
- var timer = setTimeout(function () {
- start.reject();
- }, 3000);
- document.addEventListener("mobileSupportInitialized", function () {
- window.clearTimeout(timer);
- start.resolve();
- });
- }
- }
- };
- var targetExtension = [
- "bpbefagpafkfgoihbmcgeileodldkpnf",
- "gkbheeokbgmmnbjhhlphckobccejghjn"
- ];
window.targetExtensionId = null;
- var nextTest = function () {
- if (targetExtension.length) {
- var id = targetExtension.pop();
- chrome.runtime.sendMessage(id, { action: "getStorage" }, function (m) {
- if (m) {
- window.targetExtensionId = id;
- window.storage = m.detail;
- entryPoint();
- } else {
- nextTest();
- }
- });
- } else entryPoint();
- };
$(function() {
- if (typeof (chrome) !== 'undefined') {
- nextTest();
- } else entryPoint();
+ //确保内容脚本启动
+ var start = $.Deferred();
+ start.done(function () {
+ chrome.runtime.sendMessage(window.targetExtensionId, { action: "getStorage" }, function (m) {
+ window.storage = m.detail;
+
+ seajs.use("ui/" + pagename);
+ });
+ });
+ start.fail(function () {
+ notInstallExtension();
+ });
+
+ var checkExtensionInfo = function() {
+ window.targetExtensionId = document.body.dataset["targetExtensionId"];
+ window.targetExtensionVersion = document.body.dataset["targetExtensionVersion"];
+
+ if (!window.targetExtensionId) {
+ start.reject();
+ return;
+ }
+ //检测版本吗?暂时不需要
+
+
+ //完成!
+ start.resolve();
+ };
+
+ if (document.body.dataset["mobileSupportInitialized"]) {
+ checkExtensionInfo();
+ } else {
+ var timer = setTimeout(function () {
+ start.reject();
+ }, 3000);
+ document.addEventListener("mobileSupportInitialized", function () {
+ window.clearTimeout(timer);
+ checkExtensionInfo();
+ });
+ }
});
})(window, document);
diff --git a/Web12306/js/otn/queryticket.js b/Web12306/js/otn/queryticket.js
index 654925f..5a51c5f 100644
--- a/Web12306/js/otn/queryticket.js
+++ b/Web12306/js/otn/queryticket.js
@@ -86,7 +86,8 @@
saleTime: t.queryLeftNewDTO.sale_time,
secureStr: t.secretStr,
selltime: null,
- date: t.queryLeftNewDTO.start_train_date.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3")
+ date: t.queryLeftNewDTO.start_train_date.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3"),
+ limitSellInfo: t.buttonTextInfo && t.buttonTextInfo.indexOf("暂售") != -1 ? t.buttonTextInfo.replace(/<[^>]+>/i, "") : null
};
var kp = getTicketInfo(t.queryLeftNewDTO.yp_info);
train.tickets = kp;
diff --git a/Web12306/js/otn/trainstationsuggest.js b/Web12306/js/otn/trainstationsuggest.js
index bb02338..172307f 100644
--- a/Web12306/js/otn/trainstationsuggest.js
+++ b/Web12306/js/otn/trainstationsuggest.js
@@ -73,6 +73,8 @@
var checkSuggestion = function () {
var suggestion = [];
+ console.log(JSON.stringify(trainStops));
+
for (var ts in trainStops) {
var tinfo = trainStops[ts].info;
var tstops = trainStops[ts].stops;
diff --git a/Web12306/js/ui/chat/roomsession.js b/Web12306/js/ui/chat/roomsession.js
index 67f4778..eb36755 100644
--- a/Web12306/js/ui/chat/roomsession.js
+++ b/Web12306/js/ui/chat/roomsession.js
@@ -7,6 +7,7 @@
var param = require("../../data.js");
var page = $("#chat_container");
var user = sessMgr.current;
+ var utility = require("../../utility.js");
sessMgr.on("sessionChanged", function () {
user = sessMgr.current;
@@ -20,6 +21,7 @@
var chatListContainerDom = chatListContainer[0];
var roomStateTemplate = $("#chat_connect_server").doT();
var roomSystemNoticeTemplate = $("#chat_sys_alert").doT();
+ var chatMsgItem = $("#chat_msg_item").doT();
this.enterRoom = function (targetRoom) {
if (targetRoom === room)
@@ -47,7 +49,7 @@
};
this.appendMessageItem = function (html) {
chatListContainer.append(html);
- chatListContainerDom.scrollTop = chatListContainerDom.clientHeight;
+ chatListContainerDom.scrollTop = chatListContainerDom.scrollHeight;
};
this.clearDisplay = function () {
chatListContainer.empty();
@@ -59,7 +61,8 @@
realname: user.dispname,
username: user.username
},
- target: []
+ target: msg.target || [],
+ time: new Date().getTime()
}
port.postMessage("chatRoomSendMsg", data);
};
@@ -81,13 +84,33 @@
});
port.on("chatRoomReceiveMsg", function (e, data) {
that.fireEvent("chatRoomReceiveMsg");
- alert(JSON.stringify(data))
+
+ if (data.time) {
+ data.time = new Date(data.time);
+ data.timeStr = utility.formatDate(data.time, "hh:mm:ss");
+ }
+ data.self = data.from.username == sessMgr.current.username;
+ data.tome = false;
+ if (data.target && data.target.length) {
+ var selfTarget = _.findWhere(data.target, { username: sessMgr.current.username });
+ if (selfTarget) {
+ data.tome = true;
+ selfTarget.username = null;
+ selfTarget.realname = "我";
+ }
+ }
+ that.appendMessageItem(chatMsgItem(data));
});
port.on("chatRoomDisconnected", function () {
- that.appendMessageItem(roomStateTemplate({ state: "disconnect", stateIcon: "fa-spin fa-spinner", msg: "服务器已断开连接。" }));
+ that.appendMessageItem(roomStateTemplate({ state: "disconnect", stateIcon: "fa-times", msg: "服务器已断开连接。", exinfo: "重新连接" }));
that.fireEvent("chatRoomDisconnected");
page.find("button.button-primary").prop("disabled", true);
});
+ port.on("chatUpdateOnline", function () {
+ if (!room)
+ return;
+ room.onlinecount = this.detail.count;
+ });
return this;
};
@@ -99,6 +122,7 @@
(function chatEditor() {
var editor = page.find("section.chat-editor");
var sendBtn = editor.find(">footer>button.button-primary");
+ var editorArea = editor.find(".chat-editor-container");
var initEditor = function () {
if (!sessMgr.current)
@@ -115,7 +139,7 @@
};
initEditor();
- editor.find(".chat-editor-container").keyup(function(e) {
+ editor.find(".chat-editor-container").keyup(function (e) {
if (e.keyCode === 13 && e.ctrlKey) {
sendBtn.click();
}
@@ -138,9 +162,23 @@
session.exitRoom();
});
editor.find(">footer>button.button-primary").click(function () {
+ var editorObj = editor.find(".chat-editor-container");
+ var target = [];
+ var addedUser = [];
+ editorObj.find("span.chat-editor-at").each(function () {
+ var username = this.dataset.un;
+ if (addedUser[username])
+ return;
+ addedUser[username] = true;
+ target.push({
+ realname: $.trim($(this).text()).substr(1),
+ username: username
+ });
+ }).remove();
var msg = {
color: user.options.chatColor,
- text: $.trim(editor.find(".chat-editor-container").text())
+ text: $.trim(editorObj.text()),
+ target: target
}
if (!msg.text)
return;
@@ -148,6 +186,21 @@
session.sendMsg(msg);
delayEnableSend();
});
+ $(document).on("click", "a.chat-item-at", function () {
+ var un = this.dataset.un;
+ var name = this.innerHTML;
+
+ var html = "@" + name + " ";
+ editorArea.append(html);
+
+ var range = document.createRange();
+ range.selectNodeContents(editorArea[0]);
+ range.collapse(false);
+ var selection = window.getSelection();
+ selection.removeAllRanges();
+ selection.addRange(range);
+ editorArea[0].focus();
+ });
})();
return {
diff --git a/Web12306/js/ui/index.js b/Web12306/js/ui/index.js
index 4350a9d..aec0ae8 100644
--- a/Web12306/js/ui/index.js
+++ b/Web12306/js/ui/index.js
@@ -61,7 +61,7 @@
//界面交互初始化
(function () {
- $(".order-tips").html("今日可预定:" + utility.formatDate(param.minDate, "MM月dd日") + "-" + utility.formatDate(param.maxDate, "MM月dd日") + "的火车票");
+ $(".order-tips").html("今日可订票:" + utility.formatDate(param.minDate, "MM月dd日") + "-" + utility.formatDate(param.maxDate, "MM月dd日") + "车票");
//自动加速关闭
$(".net-tips, .reset-btn").hide();
diff --git a/Web12306/js/ui/widget_message_popup.js b/Web12306/js/ui/widget_message_popup.js
index 64bc9aa..f81d25d 100644
--- a/Web12306/js/ui/widget_message_popup.js
+++ b/Web12306/js/ui/widget_message_popup.js
@@ -88,7 +88,7 @@
exports.MessagePopup = MessagePopup;
exports.showMessagePopup = function (icon, content, options) {
- options = $.extend({ closeAfter: 1000 }, options);
+ options = $.extend({ closeAfter: 2000 }, options);
var popup = new MessagePopup(icon, content, options);
popup.show();
diff --git a/Web12306/packages.config b/Web12306/packages.config
index 52c1b19..f18c23d 100644
--- a/Web12306/packages.config
+++ b/Web12306/packages.config
@@ -4,10 +4,8 @@
-
-
-
-
+
+
@@ -17,11 +15,10 @@
-
-
+
-
+