同步提交
This commit is contained in:
parent
c17ee774a9
commit
33207cb5dd
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -66,3 +66,4 @@ obj/
|
||||
*.pdsyncu
|
||||
*.dotCover
|
||||
_项目发布_
|
||||
tools/
|
6
.nuget/NuGet.Config
Normal file
6
.nuget/NuGet.Config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<solution>
|
||||
<add key="disableSourceControlIntegration" value="true" />
|
||||
</solution>
|
||||
</configuration>
|
BIN
.nuget/NuGet.exe
Normal file
BIN
.nuget/NuGet.exe
Normal file
Binary file not shown.
144
.nuget/NuGet.targets
Normal file
144
.nuget/NuGet.targets
Normal file
@ -0,0 +1,144 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
|
||||
|
||||
<!-- Enable the restore command to run before builds -->
|
||||
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
|
||||
|
||||
<!-- Property that enables building a package from a project -->
|
||||
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
|
||||
|
||||
<!-- Determines if package restore consent is required to restore packages -->
|
||||
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
|
||||
|
||||
<!-- Download NuGet.exe if it does not already exist -->
|
||||
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(PackageSources)' == '' ">
|
||||
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
|
||||
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
|
||||
<!--
|
||||
<PackageSource Include="https://www.nuget.org/api/v2/" />
|
||||
<PackageSource Include="https://my-nuget-source/nuget/" />
|
||||
-->
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
|
||||
<!-- Windows specific commands -->
|
||||
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
|
||||
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
|
||||
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
|
||||
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
|
||||
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- NuGet command -->
|
||||
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
|
||||
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
|
||||
|
||||
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
|
||||
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
|
||||
|
||||
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
|
||||
|
||||
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
|
||||
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
|
||||
|
||||
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
|
||||
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
|
||||
|
||||
<!-- Commands -->
|
||||
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
|
||||
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
|
||||
|
||||
<!-- We need to ensure packages are restored prior to assembly resolve -->
|
||||
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
|
||||
RestorePackages;
|
||||
$(BuildDependsOn);
|
||||
</BuildDependsOn>
|
||||
|
||||
<!-- Make the build depend on restore packages -->
|
||||
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
|
||||
$(BuildDependsOn);
|
||||
BuildPackage;
|
||||
</BuildDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="CheckPrerequisites">
|
||||
<!-- Raise an error if we're unable to locate nuget.exe -->
|
||||
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
|
||||
<!--
|
||||
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
|
||||
This effectively acts as a lock that makes sure that the download operation will only happen once and all
|
||||
parallel builds will have to wait for it to complete.
|
||||
-->
|
||||
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="_DownloadNuGet">
|
||||
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
|
||||
</Target>
|
||||
|
||||
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
|
||||
<Exec Command="$(RestoreCommand)"
|
||||
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
||||
|
||||
<Exec Command="$(RestoreCommand)"
|
||||
LogStandardErrorAsError="true"
|
||||
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
|
||||
<Exec Command="$(BuildCommand)"
|
||||
Condition=" '$(OS)' != 'Windows_NT' " />
|
||||
|
||||
<Exec Command="$(BuildCommand)"
|
||||
LogStandardErrorAsError="true"
|
||||
Condition=" '$(OS)' == 'Windows_NT' " />
|
||||
</Target>
|
||||
|
||||
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
|
||||
<ParameterGroup>
|
||||
<OutputFilename ParameterType="System.String" Required="true" />
|
||||
</ParameterGroup>
|
||||
<Task>
|
||||
<Reference Include="System.Core" />
|
||||
<Using Namespace="System" />
|
||||
<Using Namespace="System.IO" />
|
||||
<Using Namespace="System.Net" />
|
||||
<Using Namespace="Microsoft.Build.Framework" />
|
||||
<Using Namespace="Microsoft.Build.Utilities" />
|
||||
<Code Type="Fragment" Language="cs">
|
||||
<![CDATA[
|
||||
try {
|
||||
OutputFilename = Path.GetFullPath(OutputFilename);
|
||||
|
||||
Log.LogMessage("Downloading latest version of NuGet.exe...");
|
||||
WebClient webClient = new WebClient();
|
||||
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Log.LogErrorFromException(ex);
|
||||
return false;
|
||||
}
|
||||
]]>
|
||||
</Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
</Project>
|
13
12306.sln
13
12306.sln
@ -5,6 +5,15 @@ VisualStudioVersion = 12.0.30324.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Web12306", "Web12306\Web12306.csproj", "{56406C67-2B6F-4152-9EC0-E6D80E86B96D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StationDataFileGenerator", "StationDataFileGenerator\StationDataFileGenerator.csproj", "{0C7635A7-78F5-459D-BBDE-CEEC51E546B9}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{4C2B47DF-F10F-4EE2-9150-96FBC50A8F58}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.nuget\NuGet.Config = .nuget\NuGet.Config
|
||||
.nuget\NuGet.exe = .nuget\NuGet.exe
|
||||
.nuget\NuGet.targets = .nuget\NuGet.targets
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -15,6 +24,10 @@ Global
|
||||
{56406C67-2B6F-4152-9EC0-E6D80E86B96D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{56406C67-2B6F-4152-9EC0-E6D80E86B96D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{56406C67-2B6F-4152-9EC0-E6D80E86B96D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0C7635A7-78F5-459D-BBDE-CEEC51E546B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0C7635A7-78F5-459D-BBDE-CEEC51E546B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0C7635A7-78F5-459D-BBDE-CEEC51E546B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0C7635A7-78F5-459D-BBDE-CEEC51E546B9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
48
StationDataFileGenerator/Program.cs
Normal file
48
StationDataFileGenerator/Program.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace StationDataFileGenerator
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
|
||||
var targetDataFile = Path.Combine(_root, @"..\Web12306\js\station\station_data.js");
|
||||
var inputDataFile = Path.Combine(_root, @"station_name.js");
|
||||
var inputPopFile = Path.Combine(_root, @"favorite_name.js");
|
||||
|
||||
//常规数据
|
||||
var commonDataText = File.ReadAllText(inputDataFile);
|
||||
var popDataText = File.ReadAllText(inputPopFile);
|
||||
|
||||
//@bjb|北京北|VAP|beijingbei|bjb|0
|
||||
//@bji|北京|BJP|0
|
||||
var commonData = new Regex(@"@([a-z]+)\|([^\|]+)\|([^\|]+)\|([^\|@]+)\|([^\|@]+)\|([^\|@'""]+)", RegexOptions.IgnoreCase).Matches(commonDataText)
|
||||
.Cast<Match>().Select(s => new { p = s.Groups[4].Value.ToLower(), n = s.Groups[2].Value.ToLower(), c = s.Groups[3].Value, s = int.Parse(s.Groups[6].Value), h = s.Groups[5].Value.ToLower() })
|
||||
.GroupBy(s => char.ToUpper(s.h[0])).ToDictionary(s => s.Key, s => s.OrderBy(x => x.s).ToDictionary(x => x.c))
|
||||
;
|
||||
var popData = new Regex(@"@([a-z]+)\|([^\|]+)\|([^\|]+)\|([^\|@]+)", RegexOptions.IgnoreCase).Matches(popDataText)
|
||||
.Cast<Match>().Select(s => s.Groups[3].Value).ToArray();
|
||||
;
|
||||
|
||||
File.WriteAllText(targetDataFile, "define(function(require, exports, module){\r\n exports.data=" + Newtonsoft.Json.JsonConvert.SerializeObject(commonData) + ";\r\n exports.popcity=" + JsonConvert.SerializeObject(popData) + ";\r\n});");
|
||||
|
||||
Console.Write("OK.");
|
||||
Console.ReadKey();
|
||||
}
|
||||
static string _root = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
}
|
||||
}
|
36
StationDataFileGenerator/Properties/AssemblyInfo.cs
Normal file
36
StationDataFileGenerator/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("StationDataFileGenerator")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("StationDataFileGenerator")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("39829ee5-f828-4d9a-8796-af7f845102ba")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
71
StationDataFileGenerator/Properties/Resources.Designer.cs
generated
Normal file
71
StationDataFileGenerator/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本: 4.0.30319.34014
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace StationDataFileGenerator.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的、缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StationDataFileGenerator.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为所有资源查找重写当前线程的 CurrentUICulture 属性,
|
||||
/// 方法是使用此强类型资源类。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
StationDataFileGenerator/Properties/Resources.resx
Normal file
117
StationDataFileGenerator/Properties/Resources.resx
Normal file
@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
30
StationDataFileGenerator/Properties/Settings.Designer.cs
generated
Normal file
30
StationDataFileGenerator/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace StationDataFileGenerator.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
StationDataFileGenerator/Properties/Settings.settings
Normal file
7
StationDataFileGenerator/Properties/Settings.settings
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
93
StationDataFileGenerator/StationDataFileGenerator.csproj
Normal file
93
StationDataFileGenerator/StationDataFileGenerator.csproj
Normal file
@ -0,0 +1,93 @@
|
||||
<?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>{0C7635A7-78F5-459D-BBDE-CEEC51E546B9}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>StationDataFileGenerator</RootNamespace>
|
||||
<AssemblyName>StationDataFileGenerator</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>..\tools\</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>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</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.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<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.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</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>
|
4
StationDataFileGenerator/packages.config
Normal file
4
StationDataFileGenerator/packages.config
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="6.0.3" targetFramework="net40" />
|
||||
</packages>
|
17
Web12306/.project
Normal file
17
Web12306/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Web12306</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.aptana.ide.core.unifiedBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.aptana.projects.webnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -20,6 +20,8 @@
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -179,11 +181,13 @@
|
||||
<Content Include="js\platform\webRequest.js" />
|
||||
<Content Include="js\profile\Profile.js" />
|
||||
<Content Include="js\profile\ProfileList.js" />
|
||||
<Content Include="js\station\station_data.js" />
|
||||
<Content Include="js\ui\index.js" />
|
||||
<Content Include="js\modules\jquery\jquery.js" />
|
||||
<Content Include="js\modules\seajs\sea.js" />
|
||||
<Content Include="js\modules\underscore\underscore.js" />
|
||||
<Content Include="js\ui\widget.js" />
|
||||
<Content Include="js\ui\widget_cityselector.js" />
|
||||
<Content Include="js\ui\widget_datedropdown.js" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Web.Debug.config">
|
||||
@ -197,7 +201,6 @@
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="js\order\" />
|
||||
<Folder Include="js\query\" />
|
||||
<Folder Include="js\station\" />
|
||||
<Folder Include="js\vc\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -231,6 +234,13 @@
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<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">
|
||||
|
@ -6,6 +6,12 @@
|
||||
background-color: #f5f6f5;
|
||||
z-index: 100;
|
||||
position: absolute;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#citySelector.open,
|
||||
#citySelector:hover {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#citySelector .allCityList {
|
||||
|
@ -6,5 +6,26 @@
|
||||
border: 1px solid #d1d1d1;
|
||||
background-color: #ffffff;
|
||||
z-index: 100;
|
||||
position: absolute;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#dateSelector:hover {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#dateSelector.open {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#dateSelector.open:hover {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#dateSelector .month-second, #dateSelector .month-first {
|
||||
float: left;
|
||||
}
|
||||
|
||||
#dateSelector .month-second {
|
||||
border-left: 1px solid #d1d1d1;
|
||||
}
|
@ -193,7 +193,8 @@
|
||||
border-left: 1px solid #e1e1e1;
|
||||
}
|
||||
|
||||
.date-selector table td:hover {
|
||||
.date-selector table td:hover,
|
||||
.date-selector table td.date-selected {
|
||||
background-color: #ff9b00;
|
||||
color: #ffffff;
|
||||
cursor: pointer;
|
||||
@ -204,3 +205,19 @@
|
||||
color: #ffffff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.date-selector .date-current {
|
||||
color: #f78800;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.date-selector .date-notavailable {
|
||||
background-color: #ffffff;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.date-selector .date-notavailable:hover {
|
||||
cursor: not-allowed;
|
||||
background: none;
|
||||
color: #ccc;
|
||||
}
|
||||
|
@ -69,14 +69,14 @@
|
||||
<ul class="search-form">
|
||||
<li>
|
||||
<label class="label-desc">出发城市</label>
|
||||
<div class="input-wrap"><input class="search-form-city" type="text" name="from_city" placeholder="请填写出发城市" /></div>
|
||||
<div class="input-wrap"><input class="search-form-city ui-cityselector" type="text" name="from_city" placeholder="请填写出发城市" /></div>
|
||||
</li>
|
||||
<li class="transfer-city">
|
||||
<div class="transfer-city-btn"></div>
|
||||
</li>
|
||||
<li>
|
||||
<label class="label-desc">到达城市</label>
|
||||
<div class="input-wrap"><input class="search-form-city" type="text" name="to_city" placeholder="请填写到达城市" /></div>
|
||||
<div class="input-wrap"><input class="search-form-city ui-cityselector" type="text" name="to_city" placeholder="请填写到达城市" /></div>
|
||||
</li>
|
||||
<li class="select-date">
|
||||
<label class="label-desc">乘车日期</label>
|
||||
@ -383,119 +383,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div id="citySelector">
|
||||
<div class="allCityList">
|
||||
<ul class="city-recently-used">
|
||||
<li class="selected">常用</li>
|
||||
<li>A-E</li>
|
||||
<li>F-J</li>
|
||||
<li>K-O</li>
|
||||
<li>P-T</li>
|
||||
<li>U-Z</li>
|
||||
</ul>
|
||||
<div class="common">
|
||||
<p>常用城市</p>
|
||||
<dl class="commonCityList">
|
||||
<dd>北京</dd>
|
||||
<dd>武汉</dd>
|
||||
<dd>合肥</dd>
|
||||
<dd>广州</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<ul class="cityList">
|
||||
<li>合肥</li>
|
||||
<li>北京</li>
|
||||
<li>上海</li>
|
||||
<li>杭州</li>
|
||||
<li>广州</li>
|
||||
<li>深圳</li>
|
||||
<li>武汉</li>
|
||||
<li>合肥</li>
|
||||
<li>北京</li>
|
||||
<li>上海</li>
|
||||
<li>杭州</li>
|
||||
<li>广州</li>
|
||||
<li>深圳</li>
|
||||
<li>武汉</li>
|
||||
<li>深圳</li>
|
||||
<li>武汉</li>
|
||||
</ul>
|
||||
<div class="cityPager">
|
||||
<button class="city-prev" disabled="disabled">上一页</button>
|
||||
<button class="city-next">下一页</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dateSelector" style="position:absolute;left:500px;">
|
||||
<div class="month-first">
|
||||
<section class="date-selector">
|
||||
<nav>
|
||||
<span class="month-prev"></span>
|
||||
<span class="month-next"></span>
|
||||
<header>
|
||||
2014年4月3日
|
||||
</header>
|
||||
</nav>
|
||||
<table>
|
||||
<tr>
|
||||
<th>日</th>
|
||||
<th>一</th>
|
||||
<th>二</th>
|
||||
<th>三</th>
|
||||
<th>四</th>
|
||||
<th>五</th>
|
||||
<th>六</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>2</td>
|
||||
<td>3</td>
|
||||
<td>4</td>
|
||||
<td>5</td>
|
||||
<td>6</td>
|
||||
<td>7</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8</td>
|
||||
<td>9</td>
|
||||
<td>10</td>
|
||||
<td>11</td>
|
||||
<td>12</td>
|
||||
<td>13</td>
|
||||
<td>14</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>15</td>
|
||||
<td>16</td>
|
||||
<td>17</td>
|
||||
<td>18</td>
|
||||
<td>19</td>
|
||||
<td>20</td>
|
||||
<td>21</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8</td>
|
||||
<td>9</td>
|
||||
<td>10</td>
|
||||
<td>11</td>
|
||||
<td>12</td>
|
||||
<td>13</td>
|
||||
<td>14</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>15</td>
|
||||
<td>16</td>
|
||||
<td>17</td>
|
||||
<td>18</td>
|
||||
<td>19</td>
|
||||
<td>20</td>
|
||||
<td>21</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
<div class="month-second"></div>
|
||||
</div>
|
||||
|
||||
<article id="save-travel-method" class="float-dialog">
|
||||
<header>
|
||||
新建出行计划
|
||||
@ -582,7 +470,7 @@
|
||||
¥227.00 元
|
||||
</div>
|
||||
<div class="ticket-note">
|
||||
请尽快提交订单并支付,<br/>
|
||||
请尽快提交订单并支付,<br />
|
||||
车票不等人。。。
|
||||
</div>
|
||||
<div class="train-type">
|
||||
|
4
Web12306/js/station/station_data.js
Normal file
4
Web12306/js/station/station_data.js
Normal file
File diff suppressed because one or more lines are too long
@ -22,7 +22,8 @@
|
||||
})();
|
||||
|
||||
//初始化日期
|
||||
require("./widget_datedropdown.js").init();
|
||||
require("./widget_datedropdown.js").init("input.ui-date");
|
||||
require("./widget_cityselector.js").init("input.ui-cityselector");
|
||||
|
||||
setTimeout(function () {
|
||||
}, 1000);
|
||||
|
37
Web12306/js/ui/widget_cityselector.js
Normal file
37
Web12306/js/ui/widget_cityselector.js
Normal file
@ -0,0 +1,37 @@
|
||||
define(function(require, exports) {
|
||||
var $html = '<div id="citySelector"><div class="allCityList"><ul class="city-recently-used"><li class="selected">常用</li><li>A-E</li><li>F-J</li><li>K-O</li><li>P-T</li><li>U-Z</li></ul><div class="common"><p>常用城市</p><dl class="commonCityList"></dl></div><ul class="cityList"></ul><div class="cityPager"><button class="city-prev" disabled="disabled">上一页</button><button class="city-next">下一页</button></div></div></div>';
|
||||
var selector;
|
||||
var divCity;
|
||||
|
||||
var CitySelector = function(options) {
|
||||
var that = this;
|
||||
|
||||
that.showPopup = function(ele) {
|
||||
|
||||
var offset = ele.offset();
|
||||
divCity.css({ left: offset.left + "px", top: (offset.top + ele.height()) + "px" });
|
||||
divCity.addClass("open");
|
||||
};
|
||||
that.hidePopup = function() {
|
||||
divCity.removeClass("open");
|
||||
};
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
exports.init = function(eleSelector, args) {
|
||||
$("body").append($html);
|
||||
divCity = $("#citySelector");
|
||||
|
||||
args = $.extend({}, args);
|
||||
|
||||
selector = new CitySelector(args);
|
||||
|
||||
|
||||
$(document).on("focus", eleSelector, function () {
|
||||
selector.showPopup($(this));
|
||||
}).on("blur", eleSelector, function () {
|
||||
selector.hidePopup($(this));
|
||||
});
|
||||
};
|
||||
});
|
@ -1,23 +1,146 @@
|
||||
define(function (require, exports, module) {
|
||||
var eo = require("../platform/EventObject.js");
|
||||
|
||||
var getCurDate = function () {
|
||||
var now = new Date();
|
||||
//now = new Date(Math.floor(now.getTime() / 86400000) * 86400000);
|
||||
now = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||
|
||||
var DateDropDown = function() {
|
||||
return now;
|
||||
};
|
||||
var getDateString = function (date) {
|
||||
return date.getFullYear() + "-" + (date.getMonth() < 9 ? "0" : "") + (date.getMonth() + 1) + "-" + (date.getDate() < 9 ? "0" : "") + date.getDate();
|
||||
};
|
||||
|
||||
var renderCalendar = function (container, monthStart, minDate, maxDate) {
|
||||
var weekdayOfFirstDay = monthStart.getDay();
|
||||
var calendarBegin = new Date(monthStart.getTime() + 86400000 * weekdayOfFirstDay * -1);
|
||||
var cells = container.find("td");
|
||||
var thismonth = monthStart.getMonth();
|
||||
var currentDate = getCurDate();
|
||||
|
||||
var dateTmp = calendarBegin;
|
||||
for (var i = 0; i < 35; i++) {
|
||||
var cell = cells.eq(i);
|
||||
cell.html(dateTmp.getDate());
|
||||
|
||||
if (dateTmp.getMonth() !== thismonth || dateTmp < minDate || dateTmp > maxDate) {
|
||||
cell.addClass("date-notavailable");
|
||||
}
|
||||
if (dateTmp.getTime() === currentDate.getTime()) {
|
||||
cell.addClass("date-current");
|
||||
}
|
||||
cell.attr("data-date", getDateString(dateTmp));
|
||||
dateTmp = new Date(dateTmp.getTime() + 86400000);
|
||||
}
|
||||
|
||||
//显示时间
|
||||
container.find("header").html(monthStart.getFullYear() + "年" + (monthStart.getMonth() + 1) + "月");
|
||||
};
|
||||
|
||||
var DateDropDown = function (options) {
|
||||
var that = this;
|
||||
|
||||
that.showPopup = function (ele) {
|
||||
var curDate = ele.val();
|
||||
var now = getCurDate();
|
||||
var selected = ele.data("selectedDate") || [];
|
||||
var dateDom = $("#dateSelector");
|
||||
|
||||
//如果日历已经创建了,则不变。
|
||||
if (curDate)
|
||||
selected.push(curDate);
|
||||
|
||||
var dayStart = new Date(now.getFullYear(), now.getMonth(), 1);
|
||||
var maxShowDay = new Date(now.getTime() + 86400 * 1000 * options.maxSellDays);
|
||||
|
||||
if (dateDom.prop("data-month") !== getDateString(dayStart)) {
|
||||
renderCalendar(dateDom.find(">.month-first"), dayStart, now, maxShowDay);
|
||||
renderCalendar(dateDom.find(">.month-second"), new Date(dayStart.getFullYear(), dayStart.getMonth() + 1, 1), now, maxShowDay);
|
||||
dateDom.prop("data-month", getDateString(dayStart));
|
||||
}
|
||||
//判断当前的购买日期是否超过月底了,决定是否显示第二个日历
|
||||
if (maxShowDay.getMonth() > now.getMonth()) {
|
||||
dateDom.find(">.month-second").show();
|
||||
} else {
|
||||
dateDom.find(">.month-second").hide();
|
||||
}
|
||||
|
||||
//确定有标记
|
||||
dateDom.find("td").removeClass("date-selected").filter(selected.map(function (e) { return "[data-date='" + e + "']"; }).join(",")).addClass("date-selected");
|
||||
dateDom.data("date-target", ele);
|
||||
|
||||
//显示
|
||||
var offset = ele.offset();
|
||||
dateDom.css({ left: offset.left + "px", top: (offset.top + ele.height()) + "px" });
|
||||
dateDom.addClass("open");
|
||||
};
|
||||
that.hidePopup = function () {
|
||||
var dateDom = $("#dateSelector");
|
||||
dateDom.removeClass("open");
|
||||
};
|
||||
|
||||
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
DateDropDown.prototype = Object.create(eo);
|
||||
DateDropDown.constructor = DateDropDown;
|
||||
|
||||
exports.init = function(objs) {
|
||||
objs.each(function() {
|
||||
var tb = $(this);
|
||||
var dropdownInstance;
|
||||
|
||||
var date = tb.data("ui-date-dropdown") || new DateDropDown();
|
||||
tb.data("ui-date-dropdown", date);
|
||||
exports.init = function (selector, params) {
|
||||
var date_classes = ["month-first", "month-second"];
|
||||
var dom = ['<div id="dateSelector">'];
|
||||
|
||||
return tb;
|
||||
_.each(date_classes, function (e) {
|
||||
var cls = e + '';
|
||||
|
||||
dom.push('<div class="' + cls + '"><section class="date-selector"><nav><span class="month-prev"></span><span class="month-next"></span><header></header></nav><table><tr><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th>六</th></tr>');
|
||||
for (var i = 0; i < 5; i++) {
|
||||
dom.push("<tr>");
|
||||
for (var j = 0; j < 7; j++) {
|
||||
dom.push("<td></td>");
|
||||
}
|
||||
dom.push("</tr>");
|
||||
}
|
||||
dom.push("</table></section></div>");
|
||||
});
|
||||
$("body").append(dom.join(""));
|
||||
|
||||
$("#dateSelector td").click(function () {
|
||||
var container = $("#dateSelector");
|
||||
var cell = $(this);
|
||||
|
||||
if (cell.hasClass("date-notavailable") || !container.data("date-target")) return;
|
||||
|
||||
var target = container.data("date-target").val(cell.attr("data-date"));
|
||||
target.trigger("datechanged.widget.ui.datepopup");
|
||||
dropdownInstance.hidePopup();
|
||||
container.removeData("date-target");
|
||||
|
||||
//移走,确定关闭它
|
||||
target[0].blur();
|
||||
container.css({
|
||||
left: "-1000px",
|
||||
top: "-1000px"
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
params = $.extend({
|
||||
maxSellDays: 20,
|
||||
selectDate: [],
|
||||
minDate: getCurDate()
|
||||
}, params);
|
||||
dropdownInstance = new DateDropDown(params);
|
||||
|
||||
$(document).on("focus", selector, function () {
|
||||
dropdownInstance.showPopup($(this));
|
||||
}).on("blur", selector, function () {
|
||||
dropdownInstance.hidePopup($(this));
|
||||
});
|
||||
};
|
||||
});
|
Loading…
Reference in New Issue
Block a user