-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
114 lines (95 loc) · 3.64 KB
/
index.html
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="ArgsJS.js"></script>
<script type="text/javascript">
var Rect = function (x, y, w, h) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
Rect.prototype.toString = function () {
return x + "," + y + " - " + w + ", " + h;
}
};
function CreateRect(a, b, c, d) {
if (typeof a == "object") {
return new Rect(a.x, a.y, a.w, a.h);
}
else if (typeof a == "string") {
if (typeof b == "string" && typeof c == "string" && typeof d == "string") {
CreateRect(parseInt(a), parseInt(b), parseInt(c), parseInt(d));
} else {
CreateRect.apply(this, a.split(","));
}
}
else if (typeof a == "number") {
if (typeof b == "undefined") {
return new Rect(0, 0, wh, wh);
}
else if (typeof b == "number") {
if (typeof c == "undefined") {
return new Rect(0, 0, a, b);
}
else if (typeof c == "number" && typeof d == "number") {
return new Rect(a, b, c, d);
}
}
}
return null;
}
function CreateRectWithArgsJS(a, b, c, d) {
eval(ArgsJS.Map({
bounds: { x: ArgsJS.Number, y: ArgsJS.Number, w: ArgsJS.Number, h: ArgsJS.Number },
strBounds: { x: ArgsJS.String, y: ArgsJS.String, w: ArgsJS.String, h: ArgsJS.String },
size: { w: ArgsJS.Number, h: ArgsJS.Number },
uniform: { wh: ArgsJS.Number },
object: { rect: ArgsJS.Object },
parse: { strRect: ArgsJS.String }
}));
switch (arguments.case) {
case "bounds":
return new Rect(x, y, w, h);
case "strBounds":
return new Rect(parseInt(x), parseInt(y), parseInt(w), parseInt(h));
case "size":
return new Rect(0, 0, w, h);
case "uniform":
return new Rect(0, 0, wh, wh);
case "object":
return new Rect(rect.x, rect.y, rect.w, rect.h);
case "parse":
return CreateRectWithArgsJS.apply(this, strRect.split(","));
}
return null;
}
function CreateRectWithRedirect(a, b, c, d) {
return ArgsJS.Redirect(this, {
bounds: { x: ArgsJS.Number, y: ArgsJS.Number, w: ArgsJS.Number, h: ArgsJS.Number },
size: { w: ArgsJS.Number, h: ArgsJS.Number },
});
}
function bounds(x, y, w, h) {
return new Rect(x, y, w, h);
}
function size(w, h) {
return new Rect(0, 0, w, h);
}
function CreateRectWithBuild(a, b, c, d) {
var buildResult = ArgsJS.Build({
bounds: { x: ArgsJS.Number, y: ArgsJS.Number, w: ArgsJS.Number, h: ArgsJS.Number },
size: { w: ArgsJS.Number, h: ArgsJS.Number },
});
var json = JSON.stringify(buildResult);
console.log(json);
}
var result;
result = CreateRectWithArgsJS(10, 10, 100, 100);
result = CreateRectWithRedirect(10, 10, 100, 100);
result = CreateRectWithBuild(10, 10, 100, 100);
</script>
</head>
<body>
</body>
</html>