完成打包工具项目;部分bug更新。

This commit is contained in:
iFish 2014-09-01 01:51:08 +08:00
parent 88ba24077c
commit d701cb486a
24 changed files with 4049 additions and 2100 deletions

3
.gitignore vendored
View File

@ -24,7 +24,7 @@ ipch/
*.dvi
*.log
*.ps
modules.json
*.sdf
*.opensdf
@ -73,3 +73,4 @@ deploy/
*.crx
/Mobile12306New/js/_dev
/Mobile12306New/css/_dev
wwwroot/

View File

@ -18,6 +18,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RwTicketAssistantV2", "RwTi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mobile12306New", "Mobile12306New\Mobile12306New.csproj", "{4B41EA5E-B7CD-4FC6-B9E3-9AE5222695F6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BuildTools", "BuildTools", "{F6960416-F825-4800-8FD4-C72908A4A6CC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeployTools", "DeployTools\DeployTools.csproj", "{E958D106-A3EE-46AF-B3E5-E62FC96F2F94}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -40,6 +44,10 @@ Global
{4B41EA5E-B7CD-4FC6-B9E3-9AE5222695F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4B41EA5E-B7CD-4FC6-B9E3-9AE5222695F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4B41EA5E-B7CD-4FC6-B9E3-9AE5222695F6}.Release|Any CPU.Build.0 = Release|Any CPU
{E958D106-A3EE-46AF-B3E5-E62FC96F2F94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E958D106-A3EE-46AF-B3E5-E62FC96F2F94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E958D106-A3EE-46AF-B3E5-E62FC96F2F94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E958D106-A3EE-46AF-B3E5-E62FC96F2F94}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

BIN
BuildTools/AjaxMinifier.exe Normal file

Binary file not shown.

BIN
BuildTools/compiler.jar Normal file

Binary file not shown.

6
DeployTools/App.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="minifyCmdPath" value="C:\Software\nodejs\minify.cmd"/>
</appSettings>
</configuration>

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E958D106-A3EE-46AF-B3E5-E62FC96F2F94}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DeployTools</RootNamespace>
<AssemblyName>DeployTools</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- 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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

424
DeployTools/Program.cs Normal file
View File

@ -0,0 +1,424 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DeployTools
{
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Security.Cryptography;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
class Program
{
static string _projectRoot;
static string _sourceDirectory;
static string _destinationDirectory;
static string _ajaxminiTool;
static Dictionary<string, string> _sourceFiles;
static Dictionary<string, string> _moduleMap;
static void Main(string[] args)
{
_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);
//1.创建目标目录
Console.WriteLine("正在准备目标目录....");
try
{
if (Directory.Exists(_destinationDirectory))
Directory.Delete(_destinationDirectory, true);
}
catch (Exception ex)
{
}
Directory.CreateDirectory(_destinationDirectory);
Console.WriteLine();
//2.创建文件列表
Console.WriteLine("正在扫描文件列表...");
CreateFileList();
Console.WriteLine("文件总数: {0}", _sourceFiles.Count);
Console.WriteLine();
//3.复制文件
Console.WriteLine("正在将文件复制到目标目录...");
CopySourceFiles();
//4.合并处理css文件
Console.WriteLine("正在合并样式表文件...");
ProcessCss("css\\index.css");
Console.WriteLine();
//5.处理js文件
ProcessScriptFiles();
//6.合并js文件
CombineScript();
//7.压缩html
ProcessHtml();
//8.写入记录
WriteModuleMap();
//9.清理目录
CleanupDirectory();
Console.WriteLine(_projectRoot);
Console.ReadKey();
}
static void CleanupDirectory()
{
Console.WriteLine("正在清理目标目录...");
foreach (var directory in Directory.GetDirectories(_destinationDirectory))
{
CleanupDirectory(directory);
}
Console.WriteLine("清理目标目录完成");
Console.WriteLine();
}
static void CleanupDirectory(string path)
{
var directorys = Directory.GetDirectories(path);
foreach (var directory in directorys)
{
CleanupDirectory(directory);
}
if (Directory.GetDirectories(path).Length > 0 || Directory.GetFiles(path).Length > 0)
return;
Directory.Delete(path);
Console.WriteLine("\t已删除空目录 {0}", path);
}
static void WriteModuleMap()
{
Console.WriteLine("正在写入模块列表记录...");
var file = "modules.json";
var fullFile = Path.Combine(_projectRoot, file);
File.WriteAllText(fullFile, JsonConvert.SerializeObject(_moduleMap.Select(s => new
{
module = s.Key,
path = s.Value
}).ToArray()));
Console.WriteLine("模块列表记录完成");
Console.WriteLine();
}
static void ProcessHtml()
{
Console.WriteLine("正在处理HTML页面文件...");
var htmlFiles = new[] { "index.html" };
foreach (var htmlFile in htmlFiles)
{
Console.Write("正在处理文件 {0} ...", htmlFile);
ProcessHtml(htmlFile);
Console.WriteLine("完成");
}
Console.WriteLine("HTML页面文件处理完成");
Console.WriteLine();
}
static void ProcessHtml(string file)
{
var fileFull = Path.GetFullPath(Path.Combine(_destinationDirectory, file));
var content = File.ReadAllText(fileFull);
//处理模板
content = Regex.Replace(content, @"<script[^>]*?type=['""]?text/x-dot-template['""]?[^>]*?>[\w\W]+?</script>", _ =>
{
var tpl = _.Value;
return Regex.Replace(tpl, @"[\t\s\r\n]{2,}", " ");
}, RegexOptions.IgnoreCase);
File.WriteAllText(fileFull, content);
//使用uglify 压缩
var psi = new ProcessStartInfo(System.Configuration.ConfigurationManager.AppSettings["minifyCmdPath"], "\"" + fileFull + "\"")
{
WindowStyle = ProcessWindowStyle.Hidden,
RedirectStandardOutput = true,
UseShellExecute = false,
StandardOutputEncoding = Encoding.UTF8
};
var p = Process.Start(psi);
content = p.StandardOutput.ReadToEnd();
File.WriteAllText(fileFull, content);
}
static void CombineScript()
{
Console.WriteLine("正在合并脚本文件...");
var targetHtml = "index.html";
var targetFullHtml = Path.Combine(_destinationDirectory, targetHtml);
var targetContent = File.ReadAllText(targetFullHtml);
var scripts = _sourceFiles.Keys.ToArray().Where(s => s.EndsWith(".js", StringComparison.OrdinalIgnoreCase)).ToList();
//处理script标签
var allScriptTags = new List<string>();
targetContent = Regex.Replace(targetContent, @"<script.*?src=['""]?([^\s'"">]+?)['""\s>].*?</script>", _ =>
{
allScriptTags.Add(Path.GetFullPath(Path.Combine(_destinationDirectory, _.Groups[1].Value)));
return string.Empty;
});
//插入新的脚本
targetContent = targetContent.Replace("</body>", "<script src=\"js/lib.js?v" + DateTime.Now.ToString("yyyyMMddhhmmss") + "\"></script>");
File.WriteAllText(targetFullHtml, targetContent);
//合并脚本库
var extLibs = allScriptTags.Take(allScriptTags.Count - 1).ToArray();
var extLibContent = string.Join(";", extLibs.Select(s =>
{
var path = Path.Combine(_destinationDirectory, s);
var content = File.ReadAllText(path);
File.Delete(path);
return content;
}));
//页面脚本
var scriptsHash = new HashSet<string>(allScriptTags, StringComparer.OrdinalIgnoreCase);
var pageLibContent = string.Join(";", scripts.Select(s =>
{
var path = Path.GetFullPath(Path.Combine(_destinationDirectory, s));
if (scriptsHash.Contains(path))
return string.Empty;
var content = File.ReadAllText(path);
File.Delete(path);
return content;
}).Where(s => !string.IsNullOrEmpty(s)));
//引导脚本
var bootScriptFile = Path.GetFullPath(Path.Combine(_destinationDirectory, allScriptTags.Last()));
var bootScript = File.ReadAllText(bootScriptFile);
File.Delete(bootScriptFile);
var extLibFile = "js/lib.js";
var extLibFullFile = Path.Combine(_destinationDirectory, extLibFile);
File.WriteAllText(extLibFullFile, string.Join(";", new[] { extLibContent, pageLibContent, bootScript }));
Console.WriteLine("脚本文件合并完成");
Console.WriteLine();
}
static void ProcessScriptFiles()
{
Console.WriteLine("正在处理脚本文件...");
foreach (var file in _sourceFiles.Where(s => s.Key.EndsWith(".js", StringComparison.OrdinalIgnoreCase)))
{
RewriteModuleId(file.Key);
//压缩
CompressScript(file.Key);
}
Console.WriteLine("脚本文件处理完成");
Console.WriteLine();
}
static void CompressScript(string filepath)
{
Console.Write("正在压缩 " + filepath + "...");
filepath = Path.GetFullPath(Path.Combine(_destinationDirectory, filepath));
Process.Start(new ProcessStartInfo(_ajaxminiTool, "-comments:none -esc:true \"" + filepath + "\" -out \"" + filepath + "\"")
{
WindowStyle = ProcessWindowStyle.Hidden
}).WaitForExit();
Console.WriteLine("压缩完成");
}
static void RewriteModuleId(string filepath)
{
Console.Write("正在处理文件 {0}", filepath);
filepath = Path.GetFullPath(Path.Combine(_destinationDirectory, filepath));
var folder = Path.GetDirectoryName(filepath);
var content = File.ReadAllText(filepath);
//是否是模块?
var depList = new List<string>();
if (Regex.IsMatch(content, @"^[\r\n\s]*(define\()\s*(function\s*\()", RegexOptions.IgnoreCase))
{
var hash = GetModuleId(filepath);
Console.WriteLine("正在处理...");
Console.WriteLine("\t模块ID{0}", hash);
//替换内容并获得所有的模块ID
content = Regex.Replace(content, @"([\r\n=\s]require\s*\(\s*['""])([^'""]+)(['""]\))", _ =>
{
var path = Path.GetFullPath(Path.Combine(folder, _.Groups[2].Value));
var id = GetModuleId(path);
depList.Add(id);
Console.WriteLine("\t依赖模块ID{0}", id);
return _.Groups[1].Value + id + _.Groups[3].Value;
}, RegexOptions.IgnoreCase);
content = Regex.Replace(content, @"^[\r\n\s]*(define\()\s*(function\s*\()", _ => _.Groups[1].Value + "\"" + hash + "\",[" + string.Join(",", depList.Select(s => "\"" + s + "\"")) + "]," + _.Groups[2].Value, RegexOptions.IgnoreCase);
}
else
{
Console.WriteLine("非模块,已跳过");
}
content = Regex.Replace(content, @"(seajs\.use\s*\(\s*['""])([^'""]+)(['""]\))", _ =>
{
var path = Path.GetFullPath(Path.Combine(folder, _.Groups[2].Value));
var id = GetModuleId(path);
depList.Add(id);
Console.WriteLine("\t依赖模块ID{0}", id);
return _.Groups[1].Value + id + _.Groups[3].Value;
}, RegexOptions.IgnoreCase);
File.WriteAllText(filepath, content);
Console.WriteLine("已处理完成");
}
static string GetModuleId(string path)
{
if (!path.EndsWith(".js", StringComparison.OrdinalIgnoreCase))
path += ".js";
if (_moduleMap.ContainsKey(path))
return _moduleMap[path];
var hash = string.Join("", MD5CryptoServiceProvider.Create().ComputeHash(Encoding.UTF8.GetBytes(path.ToLower())).Select(s => s.ToString("X2")).ToArray());
_moduleMap.Add(path, hash);
return hash;
}
static void ProcessCss(string cssfile)
{
Console.Write("正在处理 " + cssfile + "...");
var content = ImportCssFile(cssfile);
var fullPath = Path.Combine(_destinationDirectory, cssfile);
//corrent reference
content = Regex.Replace(content, @"url\(['""]?(?!data:)([^?'""]+?)(\?[^'""\)]*?)?['""]?\)", _ =>
{
var extag = _.Groups[2].Success ? _.Groups[2].Value : "";
return "url(\"" + GetRelativePath(Path.GetDirectoryName(cssfile), GetTargetSubPath(_.Groups[1].Value)).Replace('\\', '/').ToLower() + extag + "\")";
}, RegexOptions.IgnoreCase);
File.WriteAllText(Path.Combine(_destinationDirectory, cssfile), content);
Console.WriteLine("合并完成");
Console.Write("正在压缩 " + cssfile + "...");
Process.Start(new ProcessStartInfo(_ajaxminiTool, "-comments:none \"" + fullPath + "\" -out \"" + fullPath + "\"")
{
WindowStyle = ProcessWindowStyle.Hidden
}).WaitForExit();
Console.WriteLine("压缩完成");
}
static string GetRelativePath(string basePath, string secondPath)
{
if (string.IsNullOrEmpty(secondPath) || string.IsNullOrEmpty(basePath))
return secondPath;
var ps1 = basePath.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
var ps2 = secondPath.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
var upperBound = Math.Min(ps1.Length, ps2.Length);
var startIndex = Enumerable.Range(0, upperBound).FirstOrDefault(s => string.Compare(ps1[s], ps2[s], true) != 0);
if (startIndex == 0)
return "/" + secondPath.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
if (ps1.Length == startIndex && ps2.Length <= startIndex)
return "./";
return string.Join(Path.AltDirectorySeparatorChar.ToString(), Enumerable.Repeat("..", ps1.Length - startIndex).Concat(ps2.Skip(startIndex)).ToArray());
}
static string GetProjectSubPath(string path)
{
var removeLength = _sourceDirectory.EndsWith("\\") ? _sourceDirectory.Length : _sourceDirectory.Length + 1;
return path.Remove(0, removeLength);
}
static string GetTargetSubPath(string path)
{
var removeLength = _destinationDirectory.EndsWith("\\") ? _destinationDirectory.Length : _destinationDirectory.Length + 1;
return path.Remove(0, removeLength);
}
/// <summary>
/// 修正CSS文件引用路径
/// </summary>
/// <param name="filePath">要修正的css文件路径</param>
/// <returns></returns>
static string ImportCssFile(string filePath)
{
var fullPath = Path.Combine(_destinationDirectory, filePath);
var content = File.ReadAllText(fullPath);
var directory = Path.GetDirectoryName(fullPath);
File.Delete(fullPath);
//import
content = Regex.Replace(content, @"@import\s+url\(['""]?(?!data:)([^?'""]+?)(\?[^'""\)]*?)?['""]?\);?", _ => ImportCssFile(Path.GetFullPath(Path.Combine(directory, _.Groups[1].Value.Replace('/', '\\')))), RegexOptions.IgnoreCase);
//reference
content = Regex.Replace(content, @"url\(['""]?(?!data:)([^?'""]+?)(\?[^'""\)]*?)?['""]?\)", _ =>
{
var extag = _.Groups[2].Success ? _.Groups[2].Value : "";
var path = _.Groups[1].Value.Replace('/', '\\');
if (path[0] == '\\')
path = Path.Combine(_destinationDirectory, path.Remove(0, 1));
else
path = Path.Combine(directory, path);
return string.Format("url(\"{0}{1}\")", Path.GetFullPath(path), extag);
}, RegexOptions.IgnoreCase);
return content;
}
static void CreateFileList()
{
var include = new[] { @".*\.*?\.(jpg|gif|png|html|js|svg|eot|ttf|woff|otf|css)$" };
var fileter = new[] { @"^(scripts|bin)\.*" };
var allfiles = Directory.GetFiles(_sourceDirectory, "*.*", SearchOption.AllDirectories).ToDictionary(GetProjectSubPath, StringComparer.OrdinalIgnoreCase);
//过滤
_sourceFiles = allfiles.Where(s => include.Any(y => Regex.IsMatch(s.Key, y, RegexOptions.IgnoreCase)) && !fileter.Any(y => Regex.IsMatch(s.Key, y, RegexOptions.IgnoreCase)))
.ToDictionary(s => s.Key, s => s.Value, StringComparer.OrdinalIgnoreCase);
}
static void CopySourceFiles()
{
foreach (var file in _sourceFiles)
{
Console.WriteLine("\t正在复制{0}", file.Key);
var target = Path.Combine(_destinationDirectory, file.Key).ToLower();
Directory.CreateDirectory(Path.GetDirectoryName(target));
File.Copy(file.Value, target);
}
Console.WriteLine("复制完成");
Console.WriteLine();
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("DeployTools")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Fish")]
[assembly: AssemblyProduct("DeployTools")]
[assembly: AssemblyCopyright("Copyright © Fish 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("62150c48-31d6-406f-aa19-7770188bd334")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net40" />
</packages>

2529
Web12306/Scripts/typings/chrome.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -165,7 +165,6 @@
<Content Include="Global.asax" />
<Content Include="images\autorefresh.png" />
<Content Include="images\cat.png" />
<Content Include="images\code.png" />
<Content Include="images\css-sprite.mkm" />
<Content Include="images\loading.gif" />
<Content Include="images\css-sprite.png" />
@ -176,7 +175,6 @@
<Content Include="images\search-box-bg.png" />
<Content Include="images\ticket-submit-info-arrow-w.png" />
<Content Include="images\ticket-submit-info-arrow.png" />
<Content Include="images\ticket-submit-qr.png" />
<Content Include="index.html" />
<Content Include="js\account\keepalive.js" />
<Content Include="js\account\sessionMgr.js" />
@ -186,7 +184,6 @@
<Content Include="css\fa\fonts\fontawesome-webfont.woff" />
<Content Include="css\fa\fonts\FontAwesome.otf" />
<Content Include="chatservers.json" />
<None Include="js\docs\chrome-api-vsdoc.js" />
<Content Include="js\data.js" />
<Content Include="js\modules\doT.js" />
<Content Include="js\otn\orderprocess.js" />
@ -255,6 +252,7 @@
<Content Include="packages.config" />
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="Scripts\typings\chrome.d.ts" />
<TypeScriptCompile Include="Scripts\typings\jquery\jquery.d.ts" />
<TypeScriptCompile Include="Scripts\typings\underscore.d.ts" />
</ItemGroup>

View File

@ -139,7 +139,7 @@
}
.options-param .options-train-selectorwarp table {
width: 500px;
width: 550px;
}
.options-param .options-train-selectorwarp table th {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

View File

@ -14,8 +14,6 @@
if (sessionStorage["_passenger"])
passengers = JSON.parse(sessionStorage["_passenger"]);
//var LoginUser = require("./LoginUser.js");
var SessionMgr = function () {
var that = this;
var _passengerInLoad = null;

View File

@ -118,7 +118,10 @@
chrome.runtime.sendMessage(window.targetExtensionId, { action: "getStorage" }, function (m) {
window.storage = m.detail;
seajs.use("ui/" + pagename);
//TODO: 因为压缩需要mark所有的页面名所以不可以用变量计算。
if (pagename === "index")
seajs.use("ui/index");
});
});
start.fail(function () {

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
// 2011, Laura Doktorova, https://github.com/olado/doT
// Licensed under the MIT license.
(function () {
(function (window) {
"use strict";
var doT = {
@ -25,15 +25,14 @@
},
template: undefined, //fn, compile template
compile: undefined //fn, for express
}, global;
};
if (typeof module !== 'undefined' && module.exports) {
module.exports = doT;
} else if (typeof define === 'function' && define.amd) {
define(function () { return doT; });
} else {
global = (function () { return this || (0, eval)('this'); }());
global.doT = doT;
window.doT = doT;
}
function encodeHTMLSource() {
@ -170,4 +169,4 @@
}
});
}
}());
})(window);

View File

@ -1,59 +1,59 @@
/**
* Sea.js 2.2.0 | seajs.org/LICENSE.md
*/
(function(global, undefined) {
(function (global, undefined) {
// Avoid conflicting when `sea.js` is loaded multiple times
if (global.seajs) {
// Avoid conflicting when `sea.js` is loaded multiple times
if (global.seajs) {
return
}
}
var seajs = global.seajs = {
var seajs = global.seajs = {
// The current version of Sea.js being used
version: "2.2.0"
}
}
var data = seajs.data = {}
var data = seajs.data = {}
/**
/**
* util-lang.js - The minimal language enhancement
*/
function isType(type) {
return function(obj) {
function isType(type) {
return function (obj) {
return {}.toString.call(obj) == "[object " + type + "]"
}
}
}
var isObject = isType("Object")
var isString = isType("String")
var isArray = Array.isArray || isType("Array")
var isFunction = isType("Function")
var isObject = isType("Object")
var isString = isType("String")
var isArray = Array.isArray || isType("Array")
var isFunction = isType("Function")
var _cid = 0
function cid() {
var _cid = 0
function cid() {
return _cid++
}
}
/**
/**
* util-events.js - The minimal events support
*/
var events = data.events = {}
var events = data.events = {}
// Bind event
seajs.on = function(name, callback) {
// Bind event
seajs.on = function (name, callback) {
var list = events[name] || (events[name] = [])
list.push(callback)
return seajs
}
}
// Remove event. If `callback` is undefined, remove all callbacks for the
// event. If `event` and `callback` are both undefined, remove all callbacks
// for all events
seajs.off = function(name, callback) {
// Remove event. If `callback` is undefined, remove all callbacks for the
// event. If `event` and `callback` are both undefined, remove all callbacks
// for all events
seajs.off = function (name, callback) {
// Remove *all* events
if (!(name || callback)) {
events = data.events = {}
@ -75,11 +75,11 @@ seajs.off = function(name, callback) {
}
return seajs
}
}
// Emit event, firing all bound callbacks. Callbacks receive the same
// arguments as `emit` does, apart from the event name
var emit = seajs.emit = function(name, data) {
// Emit event, firing all bound callbacks. Callbacks receive the same
// arguments as `emit` does, apart from the event name
var emit = seajs.emit = function (name, data) {
var list = events[name], fn
if (list) {
@ -93,118 +93,118 @@ var emit = seajs.emit = function(name, data) {
}
return seajs
}
}
/**
/**
* util-path.js - The utilities for operating path such as id, uri
*/
var DIRNAME_RE = /[^?#]*\//
var DIRNAME_RE = /[^?#]*\//;
var DOT_RE = /\/\.\//g
var DOUBLE_DOT_RE = /\/[^/]+\/\.\.\//
var DOUBLE_SLASH_RE = /([^:/])\/\//g
var DOT_RE = /\/\.\//g;
var DOUBLE_DOT_RE = /\/[^/]+\/\.\.\//;
var DOUBLE_SLASH_RE = /([^:/])\/\//g;
// Extract the directory portion of a path
// dirname("a/b/c.js?t=123#xx/zz") ==> "a/b/"
// ref: http://jsperf.com/regex-vs-split/2
function dirname(path) {
return path.match(DIRNAME_RE)[0]
}
// Extract the directory portion of a path
// dirname("a/b/c.js?t=123#xx/zz") ==> "a/b/"
// ref: http://jsperf.com/regex-vs-split/2
function dirname(path) {
return path.match(DIRNAME_RE)[0];
}
// Canonicalize a path
// realpath("http://test.com/a//./b/../c") ==> "http://test.com/a/c"
function realpath(path) {
// Canonicalize a path
// realpath("http://test.com/a//./b/../c") ==> "http://test.com/a/c"
function realpath(path) {
// /a/b/./c/./d ==> /a/b/c/d
path = path.replace(DOT_RE, "/")
path = path.replace(DOT_RE, "/");
// a/b/c/../../d ==> a/b/../d ==> a/d
while (path.match(DOUBLE_DOT_RE)) {
path = path.replace(DOUBLE_DOT_RE, "/")
path = path.replace(DOUBLE_DOT_RE, "/");
}
// a//b/c ==> a/b/c
path = path.replace(DOUBLE_SLASH_RE, "$1/")
path = path.replace(DOUBLE_SLASH_RE, "$1/");
return path
}
return path;
}
// Normalize an id
// normalize("path/to/a") ==> "path/to/a.js"
// NOTICE: substring is faster than negative slice and RegExp
function normalize(path) {
var last = path.length - 1
var lastC = path.charAt(last)
// Normalize an id
// normalize("path/to/a") ==> "path/to/a.js"
// NOTICE: substring is faster than negative slice and RegExp
function normalize(path) {
var last = path.length - 1;
var lastC = path.charAt(last);
// If the uri ends with `#`, just return it without '#'
if (lastC === "#") {
return path.substring(0, last)
return path.substring(0, last);
}
return (path.substring(last - 2) === ".js" ||
path.indexOf("?") > 0 ||
path.substring(last - 3) === ".css" ||
lastC === "/") ? path : path + ".js"
}
lastC === "/") ? path : path + ".js";
}
var PATHS_RE = /^([^/:]+)(\/.+)$/
var VARS_RE = /{([^{]+)}/g
var PATHS_RE = /^([^/:]+)(\/.+)$/;
var VARS_RE = /{([^{]+)}/g;
function parseAlias(id) {
var alias = data.alias
return alias && isString(alias[id]) ? alias[id] : id
}
function parseAlias(id) {
var alias = data.alias;
return alias && isString(alias[id]) ? alias[id] : id;
}
function parsePaths(id) {
var paths = data.paths
var m
function parsePaths(id) {
var paths = data.paths;
var m;
if (paths && (m = id.match(PATHS_RE)) && isString(paths[m[1]])) {
id = paths[m[1]] + m[2]
id = paths[m[1]] + m[2];
}
return id
}
return id;
}
function parseVars(id) {
var vars = data.vars
function parseVars(id) {
var vars = data.vars;
if (vars && id.indexOf("{") > -1) {
id = id.replace(VARS_RE, function(m, key) {
return isString(vars[key]) ? vars[key] : m
})
id = id.replace(VARS_RE, function (m, key) {
return isString(vars[key]) ? vars[key] : m;
});
}
return id
}
return id;
}
function parseMap(uri) {
var map = data.map
var ret = uri
function parseMap(uri) {
var map = data.map;
var ret = uri;
if (map) {
for (var i = 0, len = map.length; i < len; i++) {
var rule = map[i]
var rule = map[i];
ret = isFunction(rule) ?
(rule(uri) || uri) :
uri.replace(rule[0], rule[1])
uri.replace(rule[0], rule[1]);
// Only apply the first matched rule
if (ret !== uri) break
if (ret !== uri) break;
}
}
return ret
}
return ret;
}
var ABSOLUTE_RE = /^\/\/.|:\//
var ROOT_DIR_RE = /^.*?\/\/.*?\//
var ABSOLUTE_RE = /^\/\/.|:\//;
var ROOT_DIR_RE = /^.*?\/\/.*?\//;
function addBase(id, refUri) {
function addBase(id, refUri) {
var ret
var first = id.charAt(0)
@ -232,9 +232,9 @@ function addBase(id, refUri) {
}
return ret
}
}
function id2Uri(id, refUri) {
function id2Uri(id, refUri) {
if (!id) return ""
id = parseAlias(id)
@ -246,54 +246,54 @@ function id2Uri(id, refUri) {
uri = parseMap(uri)
return uri
}
}
var doc = document
var cwd = dirname(doc.URL)
var scripts = doc.scripts
var doc = document
var cwd = dirname(doc.URL)
var scripts = doc.scripts
// Recommend to add `seajsnode` id for the `sea.js` script element
var loaderScript = doc.getElementById("seajsnode") ||
// Recommend to add `seajsnode` id for the `sea.js` script element
var loaderScript = doc.getElementById("seajsnode") ||
scripts[scripts.length - 1]
// When `sea.js` is inline, set loaderDir to current working directory
var loaderDir = dirname(getScriptAbsoluteSrc(loaderScript) || cwd)
// When `sea.js` is inline, set loaderDir to current working directory
var loaderDir = dirname(getScriptAbsoluteSrc(loaderScript) || cwd)
function getScriptAbsoluteSrc(node) {
function getScriptAbsoluteSrc(node) {
return node.hasAttribute ? // non-IE6/7
node.src :
// see http://msdn.microsoft.com/en-us/library/ms536429(VS.85).aspx
node.getAttribute("src", 4)
}
}
// For Developers
seajs.resolve = id2Uri
// For Developers
seajs.resolve = id2Uri
/**
/**
* util-request.js - The utilities for requesting script and style files
* ref: tests/research/load-js-css/test.html
*/
var head = doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement
var baseElement = head.getElementsByTagName("base")[0]
var head = doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement
var baseElement = head.getElementsByTagName("base")[0]
var IS_CSS_RE = /\.css(?:\?|$)/i
var currentlyAddingScript
var interactiveScript
var IS_CSS_RE = /\.css(?:\?|$)/i
var currentlyAddingScript
var interactiveScript
// `onload` event is not supported in WebKit < 535.23 and Firefox < 9.0
// ref:
// - https://bugs.webkit.org/show_activity.cgi?id=38995
// - https://bugzilla.mozilla.org/show_bug.cgi?id=185236
// - https://developer.mozilla.org/en/HTML/Element/link#Stylesheet_load_events
var isOldWebKit = +navigator.userAgent
// `onload` event is not supported in WebKit < 535.23 and Firefox < 9.0
// ref:
// - https://bugs.webkit.org/show_activity.cgi?id=38995
// - https://bugzilla.mozilla.org/show_bug.cgi?id=185236
// - https://developer.mozilla.org/en/HTML/Element/link#Stylesheet_load_events
var isOldWebKit = +navigator.userAgent
.replace(/.*AppleWebKit\/(\d+)\..*/, "$1") < 536
function request(url, callback, charset) {
function request(url, callback, charset) {
var isCSS = IS_CSS_RE.test(url)
var node = doc.createElement(isCSS ? "link" : "script")
@ -326,14 +326,14 @@ function request(url, callback, charset) {
head.appendChild(node)
currentlyAddingScript = null
}
}
function addOnload(node, callback, isCSS, url) {
function addOnload(node, callback, isCSS, url) {
var supportOnload = "onload" in node
// for Old WebKit and Old Firefox
if (isCSS && (isOldWebKit || !supportOnload)) {
setTimeout(function() {
setTimeout(function () {
pollCss(node, callback)
}, 1) // Begin after node insertion
return
@ -341,13 +341,13 @@ function addOnload(node, callback, isCSS, url) {
if (supportOnload) {
node.onload = onload
node.onerror = function() {
node.onerror = function () {
emit("error", { uri: url, node: node })
onload()
}
}
else {
node.onreadystatechange = function() {
node.onreadystatechange = function () {
if (/loaded|complete/.test(node.readyState)) {
onload()
}
@ -368,9 +368,9 @@ function addOnload(node, callback, isCSS, url) {
callback()
}
}
}
function pollCss(node, callback) {
function pollCss(node, callback) {
var sheet = node.sheet
var isLoaded
@ -396,7 +396,7 @@ function pollCss(node, callback) {
}
}
setTimeout(function() {
setTimeout(function () {
if (isLoaded) {
// Place callback here to give time for style rendering
callback()
@ -405,9 +405,9 @@ function pollCss(node, callback) {
pollCss(node, callback)
}
}, 20)
}
}
function getCurrentScript() {
function getCurrentScript() {
if (currentlyAddingScript) {
return currentlyAddingScript
}
@ -430,47 +430,47 @@ function getCurrentScript() {
return interactiveScript
}
}
}
}
// For Developers
seajs.request = request
// For Developers
seajs.request = request
/**
/**
* util-deps.js - The parser for dependencies
* ref: tests/research/parse-dependencies/test.html
*/
var REQUIRE_RE = /"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g
var SLASH_RE = /\\\\/g
var REQUIRE_RE = /"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g;
var SLASH_RE = /\\\\/g;
function parseDependencies(code) {
var ret = []
function parseDependencies(code) {
var ret = [];
code.replace(SLASH_RE, "")
.replace(REQUIRE_RE, function(m, m1, m2) {
if (m2) {
ret.push(m2)
ret.push(m2);
}
})
});
return ret
}
return ret;
}
/**
/**
* module.js - The core of module loader
*/
var cachedMods = seajs.cache = {}
var anonymousMeta
var cachedMods = seajs.cache = {}
var anonymousMeta
var fetchingList = {}
var fetchedList = {}
var callbackList = {}
var fetchingList = {}
var fetchedList = {}
var callbackList = {}
var STATUS = Module.STATUS = {
var STATUS = Module.STATUS = {
// 1 - The `module.uri` is being fetched
FETCHING: 1,
// 2 - The meta data has been saved to cachedMods
@ -483,10 +483,10 @@ var STATUS = Module.STATUS = {
EXECUTING: 5,
// 6 - The `module.exports` is available
EXECUTED: 6
}
}
function Module(uri, deps) {
function Module(uri, deps) {
this.uri = uri
this.dependencies = deps || []
this.exports = null
@ -497,10 +497,10 @@ function Module(uri, deps) {
// The number of unloaded dependencies
this._remain = 0
}
}
// Resolve module.dependencies
Module.prototype.resolve = function() {
// Resolve module.dependencies
Module.prototype.resolve = function () {
var mod = this
var ids = mod.dependencies
var uris = []
@ -509,10 +509,10 @@ Module.prototype.resolve = function() {
uris[i] = Module.resolve(ids[i], mod.uri)
}
return uris
}
}
// Load module.dependencies and fire onload when all done
Module.prototype.load = function() {
// Load module.dependencies and fire onload when all done
Module.prototype.load = function () {
var mod = this
// If the module is being loaded, just wait it onload call
@ -567,10 +567,10 @@ Module.prototype.load = function() {
requestCache[requestUri]()
}
}
}
}
// Call this method when module is loaded
Module.prototype.onload = function() {
// Call this method when module is loaded
Module.prototype.onload = function () {
var mod = this
mod.status = STATUS.LOADED
@ -595,10 +595,10 @@ Module.prototype.onload = function() {
// Reduce memory taken
delete mod._waitings
delete mod._remain
}
}
// Fetch a module
Module.prototype.fetch = function(requestCache) {
// Fetch a module
Module.prototype.fetch = function (requestCache) {
var mod = this
var uri = mod.uri
@ -656,10 +656,10 @@ Module.prototype.fetch = function(requestCache) {
delete callbackList[requestUri]
while ((m = mods.shift())) m.load()
}
}
}
// Execute a module
Module.prototype.exec = function () {
// Execute a module
Module.prototype.exec = function () {
var mod = this
// When module is executed, DO NOT execute it again. When module
@ -678,11 +678,11 @@ Module.prototype.exec = function () {
return Module.get(require.resolve(id)).exec()
}
require.resolve = function(id) {
require.resolve = function (id) {
return Module.resolve(id, uri)
}
require.async = function(ids, callback) {
require.async = function (ids, callback) {
Module.use(ids, callback, uri + "_async_" + cid())
return require
}
@ -708,19 +708,19 @@ Module.prototype.exec = function () {
emit("exec", mod)
return exports
}
}
// Resolve id to uri
Module.resolve = function(id, refUri) {
// Resolve id to uri
Module.resolve = function (id, refUri) {
// Emit `resolve` event for plugins such as text plugin
var emitData = { id: id, refUri: refUri }
emit("resolve", emitData)
return emitData.uri || seajs.resolve(emitData.id, refUri)
}
}
// Define a module
Module.define = function (id, deps, factory) {
// Define a module
Module.define = function (id, deps, factory) {
var argsLen = arguments.length
// define(factory)
@ -772,10 +772,10 @@ Module.define = function (id, deps, factory) {
meta.uri ? Module.save(meta.uri, meta) :
// Save information for "saving" work in the script onload event
anonymousMeta = meta
}
}
// Save meta data to cachedMods
Module.save = function(uri, meta) {
// Save meta data to cachedMods
Module.save = function (uri, meta) {
var mod = Module.get(uri)
// Do NOT override already saved modules
@ -785,18 +785,18 @@ Module.save = function(uri, meta) {
mod.factory = meta.factory
mod.status = STATUS.SAVED
}
}
}
// Get an existed module or create a new one
Module.get = function(uri, deps) {
// Get an existed module or create a new one
Module.get = function (uri, deps) {
return cachedMods[uri] || (cachedMods[uri] = new Module(uri, deps))
}
}
// Use function is equal to load a anonymous module
Module.use = function (ids, callback, uri) {
// Use function is equal to load a anonymous module
Module.use = function (ids, callback, uri) {
var mod = Module.get(uri, isArray(ids) ? ids : [ids])
mod.callback = function() {
mod.callback = function () {
var exports = []
var uris = mod.resolve()
@ -812,15 +812,15 @@ Module.use = function (ids, callback, uri) {
}
mod.load()
}
}
// Load preload modules before all other modules
Module.preload = function(callback) {
// Load preload modules before all other modules
Module.preload = function (callback) {
var preloadMods = data.preload
var len = preloadMods.length
if (len) {
Module.use(preloadMods, function() {
Module.use(preloadMods, function () {
// Remove the loaded preload modules
preloadMods.splice(0, len)
@ -831,84 +831,84 @@ Module.preload = function(callback) {
else {
callback()
}
}
}
// Public API
// Public API
seajs.use = function(ids, callback) {
Module.preload(function() {
seajs.use = function (ids, callback) {
Module.preload(function () {
Module.use(ids, callback, data.cwd + "_use_" + cid())
})
return seajs
}
}
Module.define.cmd = {}
global.define = Module.define
Module.define.cmd = {}
global.define = Module.define
// For Developers
// For Developers
seajs.Module = Module
data.fetchedList = fetchedList
data.cid = cid
seajs.Module = Module
data.fetchedList = fetchedList
data.cid = cid
seajs.require = function(id) {
seajs.require = function (id) {
var mod = Module.get(Module.resolve(id))
if (mod.status < STATUS.EXECUTING) {
mod.onload()
mod.exec()
}
return mod.exports
}
}
/**
/**
* config.js - The configuration for the loader
*/
var BASE_RE = /^(.+?\/)(\?\?)?(seajs\/)+/
var BASE_RE = /^(.+?\/)(\?\?)?(seajs\/)+/;
// The root path to use for id2uri parsing
// If loaderUri is `http://test.com/libs/seajs/[??][seajs/1.2.3/]sea.js`, the
// baseUri should be `http://test.com/libs/`
data.base = (loaderDir.match(BASE_RE) || ["", loaderDir])[1]
// The root path to use for id2uri parsing
// If loaderUri is `http://test.com/libs/seajs/[??][seajs/1.2.3/]sea.js`, the
// baseUri should be `http://test.com/libs/`
data.base = (loaderDir.match(BASE_RE) || ["", loaderDir])[1]
// The loader directory
data.dir = loaderDir
// The loader directory
data.dir = loaderDir
// The current working directory
data.cwd = cwd
// The current working directory
data.cwd = cwd
// The charset for requesting files
data.charset = "utf-8"
// The charset for requesting files
data.charset = "utf-8"
// Modules that are needed to load before all other modules
data.preload = (function() {
// Modules that are needed to load before all other modules
data.preload = (function () {
var plugins = []
// Convert `seajs-xxx` to `seajs-xxx=1`
// NOTE: use `seajs-xxx=1` flag in uri or cookie to preload `seajs-xxx`
var str = location.search.replace(/(seajs-\w+)(&|$)/g, "$1=1$2")
var str = location.search.replace(/(seajs-\w+)(&|$)/g, "$1=1$2");
// Add cookie string
str += " " + doc.cookie
// Exclude seajs-xxx=0
str.replace(/(seajs-\w+)=1/g, function(m, name) {
str.replace(/(seajs-\w+)=1/g, function (m, name) {
plugins.push(name)
})
return plugins
})()
})()
// data.alias - An object containing shorthands of module id
// data.paths - An object containing path shorthands in module id
// data.vars - The {xxx} variables in module id
// data.map - An array containing rules to map module uri
// data.debug - Debug mode. The default value is false
// data.alias - An object containing shorthands of module id
// data.paths - An object containing path shorthands in module id
// data.vars - The {xxx} variables in module id
// data.map - An array containing rules to map module uri
// data.debug - Debug mode. The default value is false
seajs.config = function(configData) {
seajs.config = function (configData) {
for (var key in configData) {
var curr = configData[key]
@ -941,6 +941,6 @@ seajs.config = function(configData) {
emit("config", configData)
return seajs
}
}
})(this);

View File

@ -217,7 +217,7 @@
(function () {
document.addEventListener("networkOrCertificationError", function () {
//TODO UI
alert("无法访问12306可能是网络错误或证书错误请直接访问12306试试如果正常的话请回来刷新本页");
mp.alert("无法访问12306可能是网络错误或证书错误请直接访问12306试试如果正常的话请回来刷新本页");
});
})();

View File

@ -32,7 +32,7 @@
this.closeLoginDialog = function () {
widget.hideFloatDialog(dlg);
};
that.logout = function() {
that.logout = function () {
var tip = new mp.MessagePopup("loading", "正在退出中...");
tip.show();
@ -41,7 +41,7 @@
tip.setState("ok", "您已经成功注销了登录...");
tip.delayClose();
}, function () {
mp.alert("提示", "似乎看起来出了点网络错误...请刷新页面.....", function() {
mp.alert("提示", "似乎看起来出了点网络错误...请刷新页面.....", function () {
self.location.reload();
});
});
@ -75,7 +75,7 @@
var loginTip = new mp.MessagePopup("loading", "正在登录中...");
loginTip.show();
var checkVc = function() {
var checkVc = function () {
vcc.checkLoginVc(randcode).done(loadLoginAsyncSuggest).fail(function (msg) {
loginFailed(msg);
});
@ -84,20 +84,20 @@
var loadLoginAsyncSuggest = function () {
that.fireEvent("loadSuggest");
loginTip.setState("loading", "正在获得登录随机码...");
ajax.sendPost("login/loginUserAsyn?random="+new Date().getTime(), "leftTicket/init", {
loginTip.setState("loading", "正在登录中...");
ajax.sendPost("login/loginUserAsyn?random=" + new Date().getTime(), "leftTicket/init", {
"loginUserDTO.user_name": un,
"userDTO.password": pwd,
"randCode": randcode
}, "json", function () {
if (!this.model.data || !this.model.data.status) {
loginFailed(this.model.data.loginFail);
loginFailed((this.model.data && this.model.data.loginFail) || (this.model.messages || ["未知错误"]).join(","));
} else {
realName = this.model.data.username;
submitLoginInfo();
}
}, function () {
loginFailed("无法加载随机码");
loginFailed("网络错误,请重试");
});
};
var submitLoginInfo = function () {
@ -151,7 +151,7 @@
dlg.on("closeDialog", function () {
that.off("loginSuccess");
that.fireEvent("closeLogin");
}).on("openDialog", function() {
}).on("openDialog", function () {
that.fireEvent("showLogin");
});
@ -167,13 +167,13 @@
$("div.user-nav-user").html("未登录");
}
});
sessionMgr.on("userInfoUpdated", function() {
sessionMgr.on("userInfoUpdated", function () {
$("div.user-nav-user").html(sessionMgr.current.dispname);
});
sessionMgr.on("userNotChecked", function () {
mp.alert("提示", "用户尚未通过审核!");
});
sessionMgr.on("requireLogin", function(e, c) {
sessionMgr.on("requireLogin", function (e, c) {
if (c)
that.once("loginSuccess", c);
that.showLoginDialog();
@ -191,9 +191,9 @@
that.loginAsync(true);
});
$("#acc_logout").click(function () {
mp.confirm("退出?", "确定要退出登录吗?", function() {
mp.confirm("退出?", "确定要退出登录吗?", function () {
that.logout();
}, function() {
}, function () {
});

View File

@ -46,7 +46,9 @@
unreadNotice = null;
renderUnreadNotice();
};
var closeNotice = function() {
var closeNotice = function () {
if (!savedNotice || !savedNotice.items) return;
$("section.search-tips-container").fadeOut();
savedNotice.lastReadId = savedNotice.items[0].id;
resetUnreadItems();

View File

@ -58,7 +58,7 @@
}
if (options.closeOnAction || this.cancel) {
btn.click(function (e) {
if (e.isDefaultPrevented)
if (e.cancel)
return;
hideModalDialog();
});

View File

@ -23,13 +23,13 @@
var config = exports.data[type];
var imageEle = target.find("span");
imageEle.css({ "background-image": "url(../../images/loading.gif", "background-size": "auto" });
imageEle.css({ "background-image": "url(/images/loading.gif)", "background-size": "auto" });
ajax.loadImage(config.url, config.refer, function (e) {
imageEle.css({ "background-image": "url(" + this.url + ")", "background-size": "100% 100%" });
(target.is(".verify-code") ? target.closest("div, p, td") : target).find(":text").val("").each(function () { this.focus(); });
}, function () {
imageEle.css({ "background-image": "url(../../images/loading.gif", "background-size": "auto" });
imageEle.css({ "background-image": "url(/images/loading.gif)", "background-size": "auto" });
document.dispatchEvent(new CustomEvent("verifyCodeLoadFailed"));
});
};