-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTime.ascx
153 lines (94 loc) · 2.84 KB
/
Time.ascx
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
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Time.ascx.cs" Inherits="nilnul.task._web.Time" %>
<% #if(false) %>
<script src="http://localhost:12345/_apps/script/jquery.js">
</script>
<script src="http://localhost:12345/_apps/script/jQuery/js/jquery-ui-1.10.0.custom.min.js">
</script>
<script src="http://localhost:12345/_apps/script/nilnul.js">
</script>
<script src="http://localhost:12345/_apps/script/nilnul.string.js">
</script>
<script src="http://localhost:12345/_apps/script/nilnul.cookie.js">
</script>
<script src="http://localhost:12345/_apps/script/nilnul.ctrl.js">
</script>
<script src="http://localhost:12345/_apps/script/nilnul.event.js">
</script>
<% #endif %>
<g id="g" runat="server">
</g>
<script>
(function (element) {
var canvas = g = element;
var SVG = {};
// These are SVG-related namespace URLs
SVG.ns = "http://www.w3.org/2000/svg";
SVG.xlinkns = "http://www.w3.org/1999/xlink";
SVG.width = document.getElementById("svg").clientWidth;
SVG.height = document.getElementById("svg").clientHeight;
var height=element.clientHeight;
var width=element.clientWidth;
var DRAW = { "strokeWidth": 1 };
var start, end, time4lines;
var scale = height / (start - end);
var scaleSet = function () {
scale=height / (start - end);
};
var drawLine = function (x1, y1, x2, y2, color) {
var shape = document.createElementNS(SVG.ns, "line");
shape.setAttributeNS(null, "x1", x1);
shape.setAttributeNS(null, "y1", y1);
shape.setAttributeNS(null, "x2", x2);
shape.setAttributeNS(null, "y2", y2);
shape.setAttributeNS(null, "stroke", color);
shape.setAttributeNS(null, "stroke-width", DRAW.strokeWidth);
canvas.appendChild(shape);
};
var drawTimeline_withHeight = function (height) {
drawLine(0, height, width, height, 'grey');
};
var drawTimeline = function (time) {
drawTimeline_withHeight(
heightOfTime(time)
);
};
var drawTimeInLines = function () {
for (var i in time4lines) {
drawTimeline(i);
}
};
var heightOfTime = function (time) {
return (time - start) * scale;
};
var pub = function () {
element.start = function (x) {
if ((typeof x) === 'undefined') {
return start;
}
start = x;
};
element.end = function (x) {
if ((typeof x) === 'undefined') {
return end;
}
end = x;
};
element.time4lines = function (x) {
if ((typeof x) === 'undefined') {
return time4lines;
}
time4lines = x;
};
element.ini = function (data) {
scaleSet();
drawTimeInLines();
};
};
var ini = function () {
pub();
};
ini();
})(
document.getElementById("<%=g.ClientID%>")
);
</script>