-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb.js
More file actions
176 lines (157 loc) · 4.87 KB
/
b.js
File metadata and controls
176 lines (157 loc) · 4.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
FuturesSelectRequest = new function () {
// private fields
// private static methods
// public fields
this.scriptid = "FuturesSelectRequest";
this.type;
this.list;
this.url = "http://quote.futures.hexun.com/GetFuturesCode.aspx";
this.code = "";//市场|期货品种代码
// public methods
this.CreateLink = function () {
var request = this.url + "?";
if (this.code != "") {
request += "FuturesCode=" + this.code;
}
return request;
}
this.Request = function () {
this.type = Common.$("futuresName");
this.list = Common.$("futuresCode");
if ((this.type.value != null) && (this.type.value != "")) {
this.code = this.type.value;
Common.AppendDataArray(this.scriptid, this.CreateLink());
setTimeout("FuturesSelectRequest.ShowList()", 600);
}
}
this.ShowList = function () {
if ((typeof(arrayname) == "undefined") && (typeof(arraycode) == "undefined")) {
return;
}
else {
if ((arrayname.length > 0) && (arrayname.length == arraycode.length)) {
this.list.length = arrayname.length + 1;
this.list.options[0] = new Option("选择合约");
for (var i = 1; i <= arrayname.length; i++) {
this.list.options[i] = new Option(arrayname[i - 1], arraycode[i - 1].replace(/\|\d{1}/, ''));
}
}
else {
this.list.length = 1;
this.list.options[0] = new Option("没有合约");
}
}
}
}
/* ----- */
FuturesListRequest = new function () {
// private fields
// private static methods
// public fields
this.scriptid = "FuturesListRequest";
this.url = "http://quote.futures.hexun.com/hqzx/restquote.aspx";
this.type = "";
this.market = "";
this.count = 100;//每页数量
this.page = 1;//当前页
this.totalpage = 1;//总页数
// public methods
this.CreateLink = function () {
var request = this.url + "?";
if (this.type != "") {
request += "type=" + this.type + "&";
}
if (this.market != "") {
request += "market=" + this.market + "&";
}
request += "time=" + Common.Time();
return request;
}
this.Request = function () {
Common.AppendDataArray(this.scriptid, this.CreateLink());
}
this.FirstPage = function () {
this.page = 1;
Common.AppendDataArray(this.scriptid, this.CreateLink());
}
this.EndPage = function () {
this.page = this.totalpage;
Common.AppendDataArray(this.scriptid, this.CreateLink());
}
this.NextPage = function () {
if (this.page < this.totalpage) {
this.page += 1;
Common.AppendDataArray(this.scriptid, this.CreateLink());
//获取下一页数据
}
}
this.PrevPage = function () {
if (this.page > 1) {
this.page -= 1;
Common.AppendDataArray(this.scriptid, this.CreateLink());
//获取上一页数据
}
}
this.GoToPage = function (input) {
if (Common.IsNumber(input)) {
if (input > 0 && input <= this.totalpage && input != this.page) {
this.page = Number(input);
Common.AppendDataArray(this.scriptid, this.CreateLink());
}
}
}
// constructor
{
}
}
/* ----- */
FuturesHistoryRequest = new function () {
// private fields
// private static methods
// public fields
this.scriptid = "FuturesHistoryRequest";
this.url = "http://quote.futures.hexun.com/hqzx/restquotehistory.aspx";
this.code = "";
this.begintime = "";
this.endtime = "";
// public methods
this.CreateLink = function () {
this.code = Common.$("futuresCode").value;
this.begintime = Common.$("beginTime").value.replace(/-/g, '');
this.endtime = Common.$("endTime").value.replace(/-/g, '');
var request = this.url + "?";
if (this.code != "") {
request += "code=" + this.code + "&";
}
if (this.begintime != "" && this.endtime != "") {
request += "begintime=" + this.begintime + "&endtime=" + this.endtime + "&";
}
request += "time=" + Common.Time();
return request;
}
this.Request = function () {
Common.AppendDataArray(this.scriptid, this.CreateLink());
}
// constructor
{
}
}
/* ----- */
FuturesPgfcciRequest = new function () {
// private fields
// private static methods
// public fields
this.scriptid = "FuturesPgfcciRequest";
this.url = "http://quote.futures.hexun.com/Pgfcci/quote1.aspx";
// public methods
this.CreateLink = function () {
var request = this.url;
return request;
}
this.Request = function () {
Common.AppendDataArray(this.scriptid, this.CreateLink());
}
// constructor
{
}
}