完成打包工具项目;部分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 = {
@ -24,16 +24,15 @@
selfcontained: false
},
template: undefined, //fn, compile template
compile: undefined //fn, for express
}, global;
compile: undefined //fn, for express
};
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);

File diff suppressed because it is too large Load Diff

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"));
});
};