Skip to content

Commit 8209a86

Browse files
committed
coding
1 parent 808b2d1 commit 8209a86

11 files changed

+100
-212
lines changed

YanZhiwei.JavaScript.Utilities/JsDemo.aspx

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,6 @@
4242
var value = jsUtils.url.get(url, 'Name');
4343
alert(value);
4444
}
45-
function isTest() {
46-
var aa = new Array();
47-
alert(is.Array(aa));
48-
}
49-
function UriTest() {
50-
51-
var current = document.location.toString().substr(0, document.location.toString().lastIndexOf("/") + 1);
52-
var uri = {
53-
picture: "picture.htm",
54-
preview: "preview.htm",
55-
playback: "playback.htm"
56-
};
57-
58-
if (jsUtils.isPc()) {
59-
uri.picture = "video.htm?model=picture";
60-
uri.preview = "video.htm?model=preview";
61-
uri.playback = "video.htm?model=playback";
62-
}
63-
var previewUrl = new Uri(current + uri.preview);
64-
previewUrl.Querys.id = "yanzhiwei";
65-
alert(previewUrl.toString());
66-
}
6745
function jsonSerializeTest() {
6846
var person = new Object();
6947
person.name = "yanzhiwei";
@@ -72,35 +50,6 @@
7250
alert(_json);
7351
7452
}
75-
function dictionaryToArrayTest() {
76-
var _dic = new Dictionary();
77-
_dic["2"] = "bb";
78-
_dic["4"] = "dd";
79-
_dic["1"] = "aa";
80-
_dic["3"] = "cc";
81-
var _array = _dic.toArray();
82-
for (var i = 0; i < _array.length; i++) {
83-
console.log(_array[i])
84-
}
85-
}
86-
function dictionaryforInTest() {
87-
var _dic = new Dictionary();
88-
_dic["2"] = "bb";
89-
_dic["4"] = "dd";
90-
_dic["1"] = "aa";
91-
_dic["3"] = "cc";
92-
_dic.forIn(function (key, value) {
93-
console.log("key:" + key + " Value:" + value)
94-
});
95-
}
96-
function dictionaryOrderTest() {
97-
var _dic = new Dictionary();
98-
_dic[2] = "bb";
99-
_dic[4] = "dd";
100-
_dic[1] = "aa";
101-
_dic[3] = "cc";
102-
var _array = _dic.order("4", false);
103-
}
10453
function addHoursTest() {
10554
alert(jsUtils.datetime.addHours(new Date(), 2));
10655
}
@@ -111,13 +60,9 @@
11160
<div>
11261
<input id="Button1" type="button" value="getFriendlyString" onclick="getFriendlyStringDemo()" /><br />
11362
<input id="Button2" type="button" value="getUrl" onclick="getUrlParamterDemo()" /><br />
114-
<input id="Button3" type="button" value="delegate" onclick="delegate()" /><br />
115-
<input id="Button4" type="button" value="urlget" onclick="urlget()" /><br />
63+
<input id="Button3" type="button" value="delegate" onclick="delegate()" /><br />>
11664
<input id="Button5" type="button" value="is" onclick="isTest()" /><br />
117-
<input id="Button6" type="button" value="Uri" onclick="UriTest()" /><br />
11865
<input id="Button7" type="button" value="JsonSerialize" onclick="jsonSerializeTest()" /><br />
119-
<input id="Button8" type="button" value="DictionaryToArray" onclick="dictionaryToArrayTest()" /><br />
120-
<input id="Button9" type="button" value="DictionaryforInTest" onclick="dictionaryforInTest()" /><br />
12166
<input id="Button10" type="button" value="addHoursTest" onclick="addHoursTest()" />
12267
</div>
12368
</form>

YanZhiwei.JavaScript.Utilities/JsDemo2.aspx

Lines changed: 0 additions & 16 deletions
This file was deleted.

YanZhiwei.JavaScript.Utilities/YanZhiwei.JavaScript.Utilities.csproj

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@
204204
<Content Include="bootstrap3\typeahead\typeahead.bundle.js" />
205205
<Content Include="bootstrap3\typeahead\typeahead.bundle.min.js" />
206206
<Content Include="bootstrap3\typeahead\typeahead.css" />
207+
<Content Include="dictionary.js" />
208+
<Content Include="dictionaryDemo.aspx" />
207209
<Content Include="DLL\DotNet.Newtonsoft.Json.Utilities.dll" />
208210
<Content Include="DLL\DotNet.Newtonsoft.Json.Utilities.XML" />
209211
<Content Include="DLL\DotNet2.Interfaces.dll" />
@@ -454,7 +456,6 @@
454456
<Content Include="jquery\zTree-3.5\zTree_demo.aspx" />
455457
<Content Include="jqUtilsDemo.aspx" />
456458
<Content Include="JsDemo.aspx" />
457-
<Content Include="JsDemo2.aspx" />
458459
<Content Include="css3\ie-css3.htc" />
459460
<Content Include="googleMap\V3\gUtils.html" />
460461
<Content Include="googleMap\V3\gUtils.js" />
@@ -635,7 +636,7 @@
635636
<Content Include="store.js\storeTest.aspx" />
636637
<Content Include="store.js\storeWithExpiration.js" />
637638
<Content Include="userData.js" />
638-
<Content Include="userDataTest.aspx" />
639+
<Content Include="userDataDemo.aspx" />
639640
<Content Include="Web.config" />
640641
<Content Include="Content\Images\cab_0_0_0.png">
641642
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@@ -713,6 +714,13 @@
713714
<Compile Include="bootstrap3\bootstrap_typeaheadDemo.aspx.designer.cs">
714715
<DependentUpon>bootstrap_typeaheadDemo.aspx</DependentUpon>
715716
</Compile>
717+
<Compile Include="dictionaryDemo.aspx.cs">
718+
<DependentUpon>dictionaryDemo.aspx</DependentUpon>
719+
<SubType>ASPXCodeBehind</SubType>
720+
</Compile>
721+
<Compile Include="dictionaryDemo.aspx.designer.cs">
722+
<DependentUpon>dictionaryDemo.aspx</DependentUpon>
723+
</Compile>
716724
<Compile Include="Global.asax.cs">
717725
<DependentUpon>Global.asax</DependentUpon>
718726
</Compile>
@@ -772,13 +780,6 @@
772780
<Compile Include="JsDemo.aspx.designer.cs">
773781
<DependentUpon>JsDemo.aspx</DependentUpon>
774782
</Compile>
775-
<Compile Include="JsDemo2.aspx.cs">
776-
<DependentUpon>JsDemo2.aspx</DependentUpon>
777-
<SubType>ASPXCodeBehind</SubType>
778-
</Compile>
779-
<Compile Include="JsDemo2.aspx.designer.cs">
780-
<DependentUpon>JsDemo2.aspx</DependentUpon>
781-
</Compile>
782783
<Compile Include="Model\Person.cs" />
783784
<Compile Include="Properties\AssemblyInfo.cs" />
784785
<Compile Include="store.js\storeTest.aspx.cs">
@@ -788,12 +789,12 @@
788789
<Compile Include="store.js\storeTest.aspx.designer.cs">
789790
<DependentUpon>storeTest.aspx</DependentUpon>
790791
</Compile>
791-
<Compile Include="userDataTest.aspx.cs">
792-
<DependentUpon>userDataTest.aspx</DependentUpon>
792+
<Compile Include="userDataDemo.aspx.cs">
793+
<DependentUpon>userDataDemo.aspx</DependentUpon>
793794
<SubType>ASPXCodeBehind</SubType>
794795
</Compile>
795-
<Compile Include="userDataTest.aspx.designer.cs">
796-
<DependentUpon>userDataTest.aspx</DependentUpon>
796+
<Compile Include="userDataDemo.aspx.designer.cs">
797+
<DependentUpon>userDataDemo.aspx</DependentUpon>
797798
</Compile>
798799
</ItemGroup>
799800
<ItemGroup>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
function dictionary() {
2+
/// <summary>
3+
/// 字典对象
4+
/// </summary>
5+
}
6+
dictionary.prototype.toArray = function () {
7+
/// <summary>
8+
/// 字典扩展方法
9+
/// </summary>
10+
/// <returns type=""></returns>
11+
var array = new Array();
12+
var temp = this;
13+
temp.forIn(function (e) { array.push(temp[e]) })
14+
return array;
15+
}
16+
17+
dictionary.prototype.forIn = function (code) {
18+
/// <summary>
19+
/// 字典扩展方法
20+
/// </summary>
21+
/// <param name="code" type="type"></param>
22+
for (var key in this) {
23+
if (this[key].constructor.toString().indexOf("Function") > 0)
24+
continue;
25+
code(key, this[key]);
26+
}
27+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="dictionaryDemo.aspx.cs" Inherits="YanZhiwei.JavaScript.Utilities.dictionaryDemo" %>
2+
3+
<!DOCTYPE html>
4+
5+
<html xmlns="http://www.w3.org/1999/xhtml">
6+
<head runat="server">
7+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8+
<title></title>
9+
<script src="dictionary.js"></script>
10+
<script>
11+
12+
function dictionaryToArrayTest() {
13+
var _dic = new dictionary();
14+
_dic["2"] = "bb";
15+
_dic["4"] = "dd";
16+
_dic["1"] = "aa";
17+
_dic["3"] = "cc";
18+
var _array = _dic.toArray();
19+
for (var i = 0; i < _array.length; i++) {
20+
console.log(_array[i])
21+
}
22+
}
23+
function dictionaryforInTest() {
24+
var _dic = new dictionary();
25+
_dic["2"] = "bb";
26+
_dic["4"] = "dd";
27+
_dic["1"] = "aa";
28+
_dic["3"] = "cc";
29+
_dic.forIn(function (key, value) {
30+
console.log("key:" + key + " Value:" + value)
31+
});
32+
}
33+
</script>
34+
</head>
35+
<body>
36+
<form id="form1" runat="server">
37+
<div>
38+
<input id="Button8" type="button" value="DictionaryToArray" onclick="dictionaryToArrayTest()" /><br />
39+
<input id="Button9" type="button" value="DictionaryforInTest" onclick="dictionaryforInTest()" /><br />
40+
</div>
41+
</form>
42+
</body>
43+
</html>

YanZhiwei.JavaScript.Utilities/JsDemo2.aspx.cs renamed to YanZhiwei.JavaScript.Utilities/dictionaryDemo.aspx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace YanZhiwei.JavaScript.Utilities
99
{
10-
public partial class JsDemo2 : System.Web.UI.Page
10+
public partial class dictionaryDemo : System.Web.UI.Page
1111
{
1212
protected void Page_Load(object sender, EventArgs e)
1313
{

YanZhiwei.JavaScript.Utilities/JsDemo2.aspx.designer.cs renamed to YanZhiwei.JavaScript.Utilities/dictionaryDemo.aspx.designer.cs

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

YanZhiwei.JavaScript.Utilities/jsUtils.js

Lines changed: 0 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,118 +1418,4 @@ for (var i = 0, c; c = is.types[i++];) {
14181418
}
14191419
}
14201420
)(c);
1421-
}
1422-
function Uri(uri) {
1423-
/// <signature>
1424-
/// <summary>网络连接字符串</summary>
1425-
/// <field name='Origin' type='String'>原始 URI 字符串。</field>
1426-
/// <field name='AbsoluteUri' type='String'>绝对 URI。</field>
1427-
/// <field name='Scheme' type='String'>方案名称</field>
1428-
/// <field name='UserInfo' type='String'>用户名、密码或其他与指定 URI 关联的特定于用户的信息。</field>
1429-
/// <field name='Authority' type='String'>域名系统 (DNS) 主机名或 IP 地址和端口号</field>
1430-
/// <field name='Port' type='Int'>端口号</field>
1431-
/// <field name='Host' type='String'>主机</field>
1432-
/// <field name='PathAndQuery' type='String'>用问号 (?) 分隔的 AbsolutePath 和 Query</field>
1433-
/// <field name='AbsolutePath' type='String'>URI 的绝对路径</field>
1434-
/// <field name='Query' type='String'>URI 中包括的任何查询信息</field>
1435-
/// <field name='Querys' type='Object'>URI 中包括的任何查询信息集合</field>
1436-
/// <field name='Segments' type='String'>构成指定 URI 的路径段的数组</field>
1437-
/// </signature>
1438-
1439-
uri = uri.toString();
1440-
if (uri.lastIndexOf("#") == uri.length - 1)
1441-
uri = uri.substr(0, uri.length - 1);
1442-
var temp;
1443-
var schemeIndex = uri.indexOf(":") + 3;
1444-
var userInfoIndex = uri.indexOf("@");
1445-
var authorityIndex = uri.indexOf("/", schemeIndex);
1446-
if (authorityIndex < 0)
1447-
authorityIndex = uri.length;
1448-
var queryIndex = uri.indexOf("?");
1449-
1450-
this.Origin = uri;
1451-
if (queryIndex > 0) {
1452-
this.Origin = uri.substr(0, queryIndex);
1453-
}
1454-
this.AbsoluteUri = uri;
1455-
this.Scheme = uri.substr(0, schemeIndex - 3);
1456-
this.UserInfo = null;
1457-
this.Authority = null;
1458-
if (userInfoIndex > 0) {
1459-
this.UserInfo = uri.substr(schemeIndex, userInfoIndex - schemeIndex);
1460-
this.Authority = uri.substr(userInfoIndex + 1, authorityIndex - userInfoIndex - 1);
1461-
} else {
1462-
this.Authority = uri.substr(schemeIndex, authorityIndex - schemeIndex);
1463-
}
1464-
this.Port = 80;
1465-
this.Host = this.Authority;
1466-
if (this.Authority.indexOf(":") > 0) {
1467-
temp = this.Authority.split(":");
1468-
this.Host = temp[0];
1469-
this.Port = temp[1];
1470-
}
1471-
1472-
this.PathAndQuery = uri.substr(authorityIndex);
1473-
1474-
this.AbsolutePath = this.PathAndQuery;
1475-
1476-
this.Query = "";
1477-
this.Querys = {};
1478-
if (queryIndex > 0) {
1479-
temp = this.PathAndQuery.split("?");
1480-
this.AbsolutePath = temp[0];
1481-
this.Query = temp[1];
1482-
}
1483-
if (this.Query) {
1484-
var items = this.Query.split("&");
1485-
for (var i = 0; i < items.length; i++) {
1486-
var index = items[i].indexOf("=");
1487-
this.Querys[items[i].substr(0, index)] = items[i].substr(index + 1);
1488-
}
1489-
}
1490-
1491-
this.Segments = null;
1492-
if (this.AbsolutePath != "") {
1493-
this.Segments = this.AbsolutePath.split("/");
1494-
}
1495-
}
1496-
Uri.prototype.toString = function () {
1497-
var param = "";
1498-
if (this.Querys) {
1499-
var i = 0;
1500-
for (var q in this.Querys) {
1501-
if (i == 0)
1502-
param = "?";
1503-
if (i++ > 0)
1504-
param += "&";
1505-
param += (q + "=" + this.Querys[q]);
1506-
}
1507-
}
1508-
1509-
var result = this.Scheme + "://";
1510-
if (this.UserInfo)
1511-
result += this.UserInfo + "@";
1512-
result += this.Host;
1513-
if (this.Origin.indexOf(":", 6) > 0)
1514-
result += ":" + this.Port;
1515-
1516-
result += this.AbsolutePath + param;
1517-
return result;
1518-
//return this.Origin + param;
1519-
}
1520-
function Dictionary() {
1521-
}
1522-
Dictionary.prototype.toArray = function () {
1523-
var array = new Array();
1524-
var temp = this;
1525-
temp.forIn(function (e) { array.push(temp[e]) })
1526-
return array;
1527-
}
1528-
1529-
Dictionary.prototype.forIn = function (code) {
1530-
for (var key in this) {
1531-
if (this[key].constructor.toString().indexOf("Function") > 0)
1532-
continue;
1533-
code(key, this[key]);
1534-
}
15351421
}

YanZhiwei.JavaScript.Utilities/userDataTest.aspx renamed to YanZhiwei.JavaScript.Utilities/userDataDemo.aspx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="userDataTest.aspx.cs" Inherits="YanZhiwei.JavaScript.Utilities.userDataTest" %>
1+
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="userDataDemo.aspx.cs" Inherits="YanZhiwei.JavaScript.Utilities.userDataTest" %>
22

33
<!DOCTYPE html>
44

0 commit comments

Comments
 (0)