Light12306/Web12306/js/ui/index.js
2014-06-13 19:52:22 +08:00

58 lines
1.7 KiB
JavaScript

define(function(require) {
var param = require("../data.js");
var ajax = require("../platform/webRequest.js");
var storage = require('../platform/storage.js');
var widget = require("./widget.js");
var sessMgr = require("../account/sessionMgr.js");
var mp = require("./widget_message_popup.js");
//初始化UI
(function() {
$("#passenger-selector-id").focus(function () {
$(this).parent().parent().addClass("hover");
}).blur(function () {
$(this).parent().parent().removeClass("hover");
});
$("#travel-theme-select").focus(function () {
$(this).parent().parent().addClass("hover");
}).blur(function () {
$(this).parent().parent().removeClass("hover");
});
$("#btn-save-travel-theme").click(function() {
widget.showFloatDialog($("#save-travel-method"));
});
})();
//初始化日期
require("./widget_datedropdown.js").init("input.ui-date");
require("./widget_cityselector.js").init("input.ui-cityselector");
require("./widget_verifycode.js").init();
//加载各模块
var ui_login = require("./ui-login.js");
//界面交互初始化
(function() {
$("#index-tip-body").click(function() {
$(this).next().fadeIn();
});
$("section.search-tips-container i.fa-times").click(function() {
$(this).closest("section.search-tips-container").fadeOut();
});
//登录失效
sessMgr.on("userForcedOut", function() {
mp.showMessagePopup("error", "您的登录出现了问题,请重新登录");
});
$(".search-more-option").click(function() {
var div = $("div.options-param");
div.is(":visible") ? (div.hide(), $(this).html("显示更多选项")) : (div.show(), $(this).html("隐藏更多选项"));
});
})();
//初始化
$("#J-search-form").submit(function() {
return false;
});
});