Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1372 Rev 1422
1
/*
1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
3
	All Rights Reserved.
4
 
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
9
*/
-
 
10
 
-
 
11
 
10
 
12
 
11
dojo.provide("dojo.lfx.html");
13
dojo.provide("dojo.lfx.html");
12
dojo.require("dojo.gfx.color");
14
dojo.require("dojo.gfx.color");
13
dojo.require("dojo.lfx.Animation");
15
dojo.require("dojo.lfx.Animation");
14
dojo.require("dojo.lang.array");
16
dojo.require("dojo.lang.array");
15
dojo.require("dojo.html.display");
17
dojo.require("dojo.html.display");
16
dojo.require("dojo.html.color");
18
dojo.require("dojo.html.color");
17
dojo.require("dojo.html.layout");
19
dojo.require("dojo.html.layout");
18
dojo.lfx.html._byId = function (nodes) {
20
dojo.lfx.html._byId = function (nodes) {
19
	if (!nodes) {
21
	if (!nodes) {
20
		return [];
22
		return [];
21
	}
23
	}
22
	if (dojo.lang.isArrayLike(nodes)) {
24
	if (dojo.lang.isArrayLike(nodes)) {
23
		if (!nodes.alreadyChecked) {
25
		if (!nodes.alreadyChecked) {
24
			var n = [];
26
			var n = [];
25
			dojo.lang.forEach(nodes, function (node) {
27
			dojo.lang.forEach(nodes, function (node) {
26
				n.push(dojo.byId(node));
28
				n.push(dojo.byId(node));
27
			});
29
			});
28
			n.alreadyChecked = true;
30
			n.alreadyChecked = true;
29
			return n;
31
			return n;
30
		} else {
32
		} else {
31
			return nodes;
33
			return nodes;
32
		}
34
		}
33
	} else {
35
	} else {
34
		var n = [];
36
		var n = [];
35
		n.push(dojo.byId(nodes));
37
		n.push(dojo.byId(nodes));
36
		n.alreadyChecked = true;
38
		n.alreadyChecked = true;
37
		return n;
39
		return n;
38
	}
40
	}
39
};
41
};
40
dojo.lfx.html.propertyAnimation = function (nodes, propertyMap, duration, easing, handlers) {
42
dojo.lfx.html.propertyAnimation = function (nodes, propertyMap, duration, easing, handlers) {
41
	nodes = dojo.lfx.html._byId(nodes);
43
	nodes = dojo.lfx.html._byId(nodes);
42
	var targs = {"propertyMap":propertyMap, "nodes":nodes, "duration":duration, "easing":easing || dojo.lfx.easeDefault};
44
	var targs = {"propertyMap":propertyMap, "nodes":nodes, "duration":duration, "easing":easing || dojo.lfx.easeDefault};
43
	var setEmUp = function (args) {
45
	var setEmUp = function (args) {
44
		if (args.nodes.length == 1) {
46
		if (args.nodes.length == 1) {
45
			var pm = args.propertyMap;
47
			var pm = args.propertyMap;
46
			if (!dojo.lang.isArray(args.propertyMap)) {
48
			if (!dojo.lang.isArray(args.propertyMap)) {
47
				var parr = [];
49
				var parr = [];
48
				for (var pname in pm) {
50
				for (var pname in pm) {
49
					pm[pname].property = pname;
51
					pm[pname].property = pname;
50
					parr.push(pm[pname]);
52
					parr.push(pm[pname]);
51
				}
53
				}
52
				pm = args.propertyMap = parr;
54
				pm = args.propertyMap = parr;
53
			}
55
			}
54
			dojo.lang.forEach(pm, function (prop) {
56
			dojo.lang.forEach(pm, function (prop) {
55
				if (dj_undef("start", prop)) {
57
				if (dj_undef("start", prop)) {
56
					if (prop.property != "opacity") {
58
					if (prop.property != "opacity") {
57
						prop.start = parseInt(dojo.html.getComputedStyle(args.nodes[0], prop.property));
59
						prop.start = parseInt(dojo.html.getComputedStyle(args.nodes[0], prop.property));
58
					} else {
60
					} else {
59
						prop.start = dojo.html.getOpacity(args.nodes[0]);
61
						prop.start = dojo.html.getOpacity(args.nodes[0]);
60
					}
62
					}
61
				}
63
				}
62
			});
64
			});
63
		}
65
		}
64
	};
66
	};
65
	var coordsAsInts = function (coords) {
67
	var coordsAsInts = function (coords) {
66
		var cints = [];
68
		var cints = [];
67
		dojo.lang.forEach(coords, function (c) {
69
		dojo.lang.forEach(coords, function (c) {
68
			cints.push(Math.round(c));
70
			cints.push(Math.round(c));
69
		});
71
		});
70
		return cints;
72
		return cints;
71
	};
73
	};
72
	var setStyle = function (n, style) {
74
	var setStyle = function (n, style) {
73
		n = dojo.byId(n);
75
		n = dojo.byId(n);
74
		if (!n || !n.style) {
76
		if (!n || !n.style) {
75
			return;
77
			return;
76
		}
78
		}
77
		for (var s in style) {
79
		for (var s in style) {
78
			try {
80
			try {
79
				if (s == "opacity") {
81
				if (s == "opacity") {
80
					dojo.html.setOpacity(n, style[s]);
82
					dojo.html.setOpacity(n, style[s]);
81
				} else {
83
				} else {
82
					n.style[s] = style[s];
84
					n.style[s] = style[s];
83
				}
85
				}
84
			}
86
			}
85
			catch (e) {
87
			catch (e) {
86
				dojo.debug(e);
88
				dojo.debug(e);
87
			}
89
			}
88
		}
90
		}
89
	};
91
	};
90
	var propLine = function (properties) {
92
	var propLine = function (properties) {
91
		this._properties = properties;
93
		this._properties = properties;
92
		this.diffs = new Array(properties.length);
94
		this.diffs = new Array(properties.length);
93
		dojo.lang.forEach(properties, function (prop, i) {
95
		dojo.lang.forEach(properties, function (prop, i) {
94
			if (dojo.lang.isFunction(prop.start)) {
96
			if (dojo.lang.isFunction(prop.start)) {
95
				prop.start = prop.start(prop, i);
97
				prop.start = prop.start(prop, i);
96
			}
98
			}
97
			if (dojo.lang.isFunction(prop.end)) {
99
			if (dojo.lang.isFunction(prop.end)) {
98
				prop.end = prop.end(prop, i);
100
				prop.end = prop.end(prop, i);
99
			}
101
			}
100
			if (dojo.lang.isArray(prop.start)) {
102
			if (dojo.lang.isArray(prop.start)) {
101
				this.diffs[i] = null;
103
				this.diffs[i] = null;
102
			} else {
104
			} else {
103
				if (prop.start instanceof dojo.gfx.color.Color) {
105
				if (prop.start instanceof dojo.gfx.color.Color) {
104
					prop.startRgb = prop.start.toRgb();
106
					prop.startRgb = prop.start.toRgb();
105
					prop.endRgb = prop.end.toRgb();
107
					prop.endRgb = prop.end.toRgb();
106
				} else {
108
				} else {
107
					this.diffs[i] = prop.end - prop.start;
109
					this.diffs[i] = prop.end - prop.start;
108
				}
110
				}
109
			}
111
			}
110
		}, this);
112
		}, this);
111
		this.getValue = function (n) {
113
		this.getValue = function (n) {
112
			var ret = {};
114
			var ret = {};
113
			dojo.lang.forEach(this._properties, function (prop, i) {
115
			dojo.lang.forEach(this._properties, function (prop, i) {
114
				var value = null;
116
				var value = null;
115
				if (dojo.lang.isArray(prop.start)) {
117
				if (dojo.lang.isArray(prop.start)) {
116
				} else {
118
				} else {
117
					if (prop.start instanceof dojo.gfx.color.Color) {
119
					if (prop.start instanceof dojo.gfx.color.Color) {
118
						value = (prop.units || "rgb") + "(";
120
						value = (prop.units || "rgb") + "(";
119
						for (var j = 0; j < prop.startRgb.length; j++) {
121
						for (var j = 0; j < prop.startRgb.length; j++) {
120
							value += Math.round(((prop.endRgb[j] - prop.startRgb[j]) * n) + prop.startRgb[j]) + (j < prop.startRgb.length - 1 ? "," : "");
122
							value += Math.round(((prop.endRgb[j] - prop.startRgb[j]) * n) + prop.startRgb[j]) + (j < prop.startRgb.length - 1 ? "," : "");
121
						}
123
						}
122
						value += ")";
124
						value += ")";
123
					} else {
125
					} else {
124
						value = ((this.diffs[i]) * n) + prop.start + (prop.property != "opacity" ? prop.units || "px" : "");
126
						value = ((this.diffs[i]) * n) + prop.start + (prop.property != "opacity" ? prop.units || "px" : "");
125
					}
127
					}
126
				}
128
				}
127
				ret[dojo.html.toCamelCase(prop.property)] = value;
129
				ret[dojo.html.toCamelCase(prop.property)] = value;
128
			}, this);
130
			}, this);
129
			return ret;
131
			return ret;
130
		};
132
		};
131
	};
133
	};
132
	var anim = new dojo.lfx.Animation({beforeBegin:function () {
134
	var anim = new dojo.lfx.Animation({beforeBegin:function () {
133
		setEmUp(targs);
135
		setEmUp(targs);
134
		anim.curve = new propLine(targs.propertyMap);
136
		anim.curve = new propLine(targs.propertyMap);
135
	}, onAnimate:function (propValues) {
137
	}, onAnimate:function (propValues) {
136
		dojo.lang.forEach(targs.nodes, function (node) {
138
		dojo.lang.forEach(targs.nodes, function (node) {
137
			setStyle(node, propValues);
139
			setStyle(node, propValues);
138
		});
140
		});
139
	}}, targs.duration, null, targs.easing);
141
	}}, targs.duration, null, targs.easing);
140
	if (handlers) {
142
	if (handlers) {
141
		for (var x in handlers) {
143
		for (var x in handlers) {
142
			if (dojo.lang.isFunction(handlers[x])) {
144
			if (dojo.lang.isFunction(handlers[x])) {
143
				anim.connect(x, anim, handlers[x]);
145
				anim.connect(x, anim, handlers[x]);
144
			}
146
			}
145
		}
147
		}
146
	}
148
	}
147
	return anim;
149
	return anim;
148
};
150
};
149
dojo.lfx.html._makeFadeable = function (nodes) {
151
dojo.lfx.html._makeFadeable = function (nodes) {
150
	var makeFade = function (node) {
152
	var makeFade = function (node) {
151
		if (dojo.render.html.ie) {
153
		if (dojo.render.html.ie) {
152
			if ((node.style.zoom.length == 0) && (dojo.html.getStyle(node, "zoom") == "normal")) {
154
			if ((node.style.zoom.length == 0) && (dojo.html.getStyle(node, "zoom") == "normal")) {
153
				node.style.zoom = "1";
155
				node.style.zoom = "1";
154
			}
156
			}
155
			if ((node.style.width.length == 0) && (dojo.html.getStyle(node, "width") == "auto")) {
157
			if ((node.style.width.length == 0) && (dojo.html.getStyle(node, "width") == "auto")) {
156
				node.style.width = "auto";
158
				node.style.width = "auto";
157
			}
159
			}
158
		}
160
		}
159
	};
161
	};
160
	if (dojo.lang.isArrayLike(nodes)) {
162
	if (dojo.lang.isArrayLike(nodes)) {
161
		dojo.lang.forEach(nodes, makeFade);
163
		dojo.lang.forEach(nodes, makeFade);
162
	} else {
164
	} else {
163
		makeFade(nodes);
165
		makeFade(nodes);
164
	}
166
	}
165
};
167
};
166
dojo.lfx.html.fade = function (nodes, values, duration, easing, callback) {
168
dojo.lfx.html.fade = function (nodes, values, duration, easing, callback) {
167
	nodes = dojo.lfx.html._byId(nodes);
169
	nodes = dojo.lfx.html._byId(nodes);
168
	var props = {property:"opacity"};
170
	var props = {property:"opacity"};
169
	if (!dj_undef("start", values)) {
171
	if (!dj_undef("start", values)) {
170
		props.start = values.start;
172
		props.start = values.start;
171
	} else {
173
	} else {
172
		props.start = function () {
174
		props.start = function () {
173
			return dojo.html.getOpacity(nodes[0]);
175
			return dojo.html.getOpacity(nodes[0]);
174
		};
176
		};
175
	}
177
	}
176
	if (!dj_undef("end", values)) {
178
	if (!dj_undef("end", values)) {
177
		props.end = values.end;
179
		props.end = values.end;
178
	} else {
180
	} else {
179
		dojo.raise("dojo.lfx.html.fade needs an end value");
181
		dojo.raise("dojo.lfx.html.fade needs an end value");
180
	}
182
	}
181
	var anim = dojo.lfx.propertyAnimation(nodes, [props], duration, easing);
183
	var anim = dojo.lfx.propertyAnimation(nodes, [props], duration, easing);
182
	anim.connect("beforeBegin", function () {
184
	anim.connect("beforeBegin", function () {
183
		dojo.lfx.html._makeFadeable(nodes);
185
		dojo.lfx.html._makeFadeable(nodes);
184
	});
186
	});
185
	if (callback) {
187
	if (callback) {
186
		anim.connect("onEnd", function () {
188
		anim.connect("onEnd", function () {
187
			callback(nodes, anim);
189
			callback(nodes, anim);
188
		});
190
		});
189
	}
191
	}
190
	return anim;
192
	return anim;
191
};
193
};
192
dojo.lfx.html.fadeIn = function (nodes, duration, easing, callback) {
194
dojo.lfx.html.fadeIn = function (nodes, duration, easing, callback) {
193
	return dojo.lfx.html.fade(nodes, {end:1}, duration, easing, callback);
195
	return dojo.lfx.html.fade(nodes, {end:1}, duration, easing, callback);
194
};
196
};
195
dojo.lfx.html.fadeOut = function (nodes, duration, easing, callback) {
197
dojo.lfx.html.fadeOut = function (nodes, duration, easing, callback) {
196
	return dojo.lfx.html.fade(nodes, {end:0}, duration, easing, callback);
198
	return dojo.lfx.html.fade(nodes, {end:0}, duration, easing, callback);
197
};
199
};
198
dojo.lfx.html.fadeShow = function (nodes, duration, easing, callback) {
200
dojo.lfx.html.fadeShow = function (nodes, duration, easing, callback) {
199
	nodes = dojo.lfx.html._byId(nodes);
201
	nodes = dojo.lfx.html._byId(nodes);
200
	dojo.lang.forEach(nodes, function (node) {
202
	dojo.lang.forEach(nodes, function (node) {
201
		dojo.html.setOpacity(node, 0);
203
		dojo.html.setOpacity(node, 0);
202
	});
204
	});
203
	var anim = dojo.lfx.html.fadeIn(nodes, duration, easing, callback);
205
	var anim = dojo.lfx.html.fadeIn(nodes, duration, easing, callback);
204
	anim.connect("beforeBegin", function () {
206
	anim.connect("beforeBegin", function () {
205
		if (dojo.lang.isArrayLike(nodes)) {
207
		if (dojo.lang.isArrayLike(nodes)) {
206
			dojo.lang.forEach(nodes, dojo.html.show);
208
			dojo.lang.forEach(nodes, dojo.html.show);
207
		} else {
209
		} else {
208
			dojo.html.show(nodes);
210
			dojo.html.show(nodes);
209
		}
211
		}
210
	});
212
	});
211
	return anim;
213
	return anim;
212
};
214
};
213
dojo.lfx.html.fadeHide = function (nodes, duration, easing, callback) {
215
dojo.lfx.html.fadeHide = function (nodes, duration, easing, callback) {
214
	var anim = dojo.lfx.html.fadeOut(nodes, duration, easing, function () {
216
	var anim = dojo.lfx.html.fadeOut(nodes, duration, easing, function () {
215
		if (dojo.lang.isArrayLike(nodes)) {
217
		if (dojo.lang.isArrayLike(nodes)) {
216
			dojo.lang.forEach(nodes, dojo.html.hide);
218
			dojo.lang.forEach(nodes, dojo.html.hide);
217
		} else {
219
		} else {
218
			dojo.html.hide(nodes);
220
			dojo.html.hide(nodes);
219
		}
221
		}
220
		if (callback) {
222
		if (callback) {
221
			callback(nodes, anim);
223
			callback(nodes, anim);
222
		}
224
		}
223
	});
225
	});
224
	return anim;
226
	return anim;
225
};
227
};
226
dojo.lfx.html.wipeIn = function (nodes, duration, easing, callback) {
228
dojo.lfx.html.wipeIn = function (nodes, duration, easing, callback) {
227
	nodes = dojo.lfx.html._byId(nodes);
229
	nodes = dojo.lfx.html._byId(nodes);
228
	var anims = [];
230
	var anims = [];
229
	dojo.lang.forEach(nodes, function (node) {
231
	dojo.lang.forEach(nodes, function (node) {
230
		var oprop = {};
232
		var oprop = {};
231
		var origTop, origLeft, origPosition;
233
		var origTop, origLeft, origPosition;
232
		with (node.style) {
234
		with (node.style) {
233
			origTop = top;
235
			origTop = top;
234
			origLeft = left;
236
			origLeft = left;
235
			origPosition = position;
237
			origPosition = position;
236
			top = "-9999px";
238
			top = "-9999px";
237
			left = "-9999px";
239
			left = "-9999px";
238
			position = "absolute";
240
			position = "absolute";
239
			display = "";
241
			display = "";
240
		}
242
		}
241
		var nodeHeight = dojo.html.getBorderBox(node).height;
243
		var nodeHeight = dojo.html.getBorderBox(node).height;
242
		with (node.style) {
244
		with (node.style) {
243
			top = origTop;
245
			top = origTop;
244
			left = origLeft;
246
			left = origLeft;
245
			position = origPosition;
247
			position = origPosition;
246
			display = "none";
248
			display = "none";
247
		}
249
		}
248
		var anim = dojo.lfx.propertyAnimation(node, {"height":{start:1, end:function () {
250
		var anim = dojo.lfx.propertyAnimation(node, {"height":{start:1, end:function () {
249
			return nodeHeight;
251
			return nodeHeight;
250
		}}}, duration, easing);
252
		}}}, duration, easing);
251
		anim.connect("beforeBegin", function () {
253
		anim.connect("beforeBegin", function () {
252
			oprop.overflow = node.style.overflow;
254
			oprop.overflow = node.style.overflow;
253
			oprop.height = node.style.height;
255
			oprop.height = node.style.height;
254
			with (node.style) {
256
			with (node.style) {
255
				overflow = "hidden";
257
				overflow = "hidden";
256
				height = "1px";
258
				height = "1px";
257
			}
259
			}
258
			dojo.html.show(node);
260
			dojo.html.show(node);
259
		});
261
		});
260
		anim.connect("onEnd", function () {
262
		anim.connect("onEnd", function () {
261
			with (node.style) {
263
			with (node.style) {
262
				overflow = oprop.overflow;
264
				overflow = oprop.overflow;
263
				height = oprop.height;
265
				height = oprop.height;
264
			}
266
			}
265
			if (callback) {
267
			if (callback) {
266
				callback(node, anim);
268
				callback(node, anim);
267
			}
269
			}
268
		});
270
		});
269
		anims.push(anim);
271
		anims.push(anim);
270
	});
272
	});
271
	return dojo.lfx.combine(anims);
273
	return dojo.lfx.combine(anims);
272
};
274
};
273
dojo.lfx.html.wipeOut = function (nodes, duration, easing, callback) {
275
dojo.lfx.html.wipeOut = function (nodes, duration, easing, callback) {
274
	nodes = dojo.lfx.html._byId(nodes);
276
	nodes = dojo.lfx.html._byId(nodes);
275
	var anims = [];
277
	var anims = [];
276
	dojo.lang.forEach(nodes, function (node) {
278
	dojo.lang.forEach(nodes, function (node) {
277
		var oprop = {};
279
		var oprop = {};
278
		var anim = dojo.lfx.propertyAnimation(node, {"height":{start:function () {
280
		var anim = dojo.lfx.propertyAnimation(node, {"height":{start:function () {
279
			return dojo.html.getContentBox(node).height;
281
			return dojo.html.getContentBox(node).height;
280
		}, end:1}}, duration, easing, {"beforeBegin":function () {
282
		}, end:1}}, duration, easing, {"beforeBegin":function () {
281
			oprop.overflow = node.style.overflow;
283
			oprop.overflow = node.style.overflow;
282
			oprop.height = node.style.height;
284
			oprop.height = node.style.height;
283
			with (node.style) {
285
			with (node.style) {
284
				overflow = "hidden";
286
				overflow = "hidden";
285
			}
287
			}
286
			dojo.html.show(node);
288
			dojo.html.show(node);
287
		}, "onEnd":function () {
289
		}, "onEnd":function () {
288
			dojo.html.hide(node);
290
			dojo.html.hide(node);
289
			with (node.style) {
291
			with (node.style) {
290
				overflow = oprop.overflow;
292
				overflow = oprop.overflow;
291
				height = oprop.height;
293
				height = oprop.height;
292
			}
294
			}
293
			if (callback) {
295
			if (callback) {
294
				callback(node, anim);
296
				callback(node, anim);
295
			}
297
			}
296
		}});
298
		}});
297
		anims.push(anim);
299
		anims.push(anim);
298
	});
300
	});
299
	return dojo.lfx.combine(anims);
301
	return dojo.lfx.combine(anims);
300
};
302
};
301
dojo.lfx.html.slideTo = function (nodes, coords, duration, easing, callback) {
303
dojo.lfx.html.slideTo = function (nodes, coords, duration, easing, callback) {
302
	nodes = dojo.lfx.html._byId(nodes);
304
	nodes = dojo.lfx.html._byId(nodes);
303
	var anims = [];
305
	var anims = [];
304
	var compute = dojo.html.getComputedStyle;
306
	var compute = dojo.html.getComputedStyle;
305
	if (dojo.lang.isArray(coords)) {
307
	if (dojo.lang.isArray(coords)) {
306
		dojo.deprecated("dojo.lfx.html.slideTo(node, array)", "use dojo.lfx.html.slideTo(node, {top: value, left: value});", "0.5");
308
		dojo.deprecated("dojo.lfx.html.slideTo(node, array)", "use dojo.lfx.html.slideTo(node, {top: value, left: value});", "0.5");
307
		coords = {top:coords[0], left:coords[1]};
309
		coords = {top:coords[0], left:coords[1]};
308
	}
310
	}
309
	dojo.lang.forEach(nodes, function (node) {
311
	dojo.lang.forEach(nodes, function (node) {
310
		var top = null;
312
		var top = null;
311
		var left = null;
313
		var left = null;
312
		var init = (function () {
314
		var init = (function () {
313
			var innerNode = node;
315
			var innerNode = node;
314
			return function () {
316
			return function () {
315
				var pos = compute(innerNode, "position");
317
				var pos = compute(innerNode, "position");
316
				top = (pos == "absolute" ? node.offsetTop : parseInt(compute(node, "top")) || 0);
318
				top = (pos == "absolute" ? node.offsetTop : parseInt(compute(node, "top")) || 0);
317
				left = (pos == "absolute" ? node.offsetLeft : parseInt(compute(node, "left")) || 0);
319
				left = (pos == "absolute" ? node.offsetLeft : parseInt(compute(node, "left")) || 0);
318
				if (!dojo.lang.inArray(["absolute", "relative"], pos)) {
320
				if (!dojo.lang.inArray(["absolute", "relative"], pos)) {
319
					var ret = dojo.html.abs(innerNode, true);
321
					var ret = dojo.html.abs(innerNode, true);
320
					dojo.html.setStyleAttributes(innerNode, "position:absolute;top:" + ret.y + "px;left:" + ret.x + "px;");
322
					dojo.html.setStyleAttributes(innerNode, "position:absolute;top:" + ret.y + "px;left:" + ret.x + "px;");
321
					top = ret.y;
323
					top = ret.y;
322
					left = ret.x;
324
					left = ret.x;
323
				}
325
				}
324
			};
326
			};
325
		})();
327
		})();
326
		init();
328
		init();
327
		var anim = dojo.lfx.propertyAnimation(node, {"top":{start:top, end:(coords.top || 0)}, "left":{start:left, end:(coords.left || 0)}}, duration, easing, {"beforeBegin":init});
329
		var anim = dojo.lfx.propertyAnimation(node, {"top":{start:top, end:(coords.top || 0)}, "left":{start:left, end:(coords.left || 0)}}, duration, easing, {"beforeBegin":init});
328
		if (callback) {
330
		if (callback) {
329
			anim.connect("onEnd", function () {
331
			anim.connect("onEnd", function () {
330
				callback(nodes, anim);
332
				callback(nodes, anim);
331
			});
333
			});
332
		}
334
		}
333
		anims.push(anim);
335
		anims.push(anim);
334
	});
336
	});
335
	return dojo.lfx.combine(anims);
337
	return dojo.lfx.combine(anims);
336
};
338
};
337
dojo.lfx.html.slideBy = function (nodes, coords, duration, easing, callback) {
339
dojo.lfx.html.slideBy = function (nodes, coords, duration, easing, callback) {
338
	nodes = dojo.lfx.html._byId(nodes);
340
	nodes = dojo.lfx.html._byId(nodes);
339
	var anims = [];
341
	var anims = [];
340
	var compute = dojo.html.getComputedStyle;
342
	var compute = dojo.html.getComputedStyle;
341
	if (dojo.lang.isArray(coords)) {
343
	if (dojo.lang.isArray(coords)) {
342
		dojo.deprecated("dojo.lfx.html.slideBy(node, array)", "use dojo.lfx.html.slideBy(node, {top: value, left: value});", "0.5");
344
		dojo.deprecated("dojo.lfx.html.slideBy(node, array)", "use dojo.lfx.html.slideBy(node, {top: value, left: value});", "0.5");
343
		coords = {top:coords[0], left:coords[1]};
345
		coords = {top:coords[0], left:coords[1]};
344
	}
346
	}
345
	dojo.lang.forEach(nodes, function (node) {
347
	dojo.lang.forEach(nodes, function (node) {
346
		var top = null;
348
		var top = null;
347
		var left = null;
349
		var left = null;
348
		var init = (function () {
350
		var init = (function () {
349
			var innerNode = node;
351
			var innerNode = node;
350
			return function () {
352
			return function () {
351
				var pos = compute(innerNode, "position");
353
				var pos = compute(innerNode, "position");
352
				top = (pos == "absolute" ? node.offsetTop : parseInt(compute(node, "top")) || 0);
354
				top = (pos == "absolute" ? node.offsetTop : parseInt(compute(node, "top")) || 0);
353
				left = (pos == "absolute" ? node.offsetLeft : parseInt(compute(node, "left")) || 0);
355
				left = (pos == "absolute" ? node.offsetLeft : parseInt(compute(node, "left")) || 0);
354
				if (!dojo.lang.inArray(["absolute", "relative"], pos)) {
356
				if (!dojo.lang.inArray(["absolute", "relative"], pos)) {
355
					var ret = dojo.html.abs(innerNode, true);
357
					var ret = dojo.html.abs(innerNode, true);
356
					dojo.html.setStyleAttributes(innerNode, "position:absolute;top:" + ret.y + "px;left:" + ret.x + "px;");
358
					dojo.html.setStyleAttributes(innerNode, "position:absolute;top:" + ret.y + "px;left:" + ret.x + "px;");
357
					top = ret.y;
359
					top = ret.y;
358
					left = ret.x;
360
					left = ret.x;
359
				}
361
				}
360
			};
362
			};
361
		})();
363
		})();
362
		init();
364
		init();
363
		var anim = dojo.lfx.propertyAnimation(node, {"top":{start:top, end:top + (coords.top || 0)}, "left":{start:left, end:left + (coords.left || 0)}}, duration, easing).connect("beforeBegin", init);
365
		var anim = dojo.lfx.propertyAnimation(node, {"top":{start:top, end:top + (coords.top || 0)}, "left":{start:left, end:left + (coords.left || 0)}}, duration, easing).connect("beforeBegin", init);
364
		if (callback) {
366
		if (callback) {
365
			anim.connect("onEnd", function () {
367
			anim.connect("onEnd", function () {
366
				callback(nodes, anim);
368
				callback(nodes, anim);
367
			});
369
			});
368
		}
370
		}
369
		anims.push(anim);
371
		anims.push(anim);
370
	});
372
	});
371
	return dojo.lfx.combine(anims);
373
	return dojo.lfx.combine(anims);
372
};
374
};
373
dojo.lfx.html.explode = function (start, endNode, duration, easing, callback) {
375
dojo.lfx.html.explode = function (start, endNode, duration, easing, callback) {
374
	var h = dojo.html;
376
	var h = dojo.html;
375
	start = dojo.byId(start);
377
	start = dojo.byId(start);
376
	endNode = dojo.byId(endNode);
378
	endNode = dojo.byId(endNode);
377
	var startCoords = h.toCoordinateObject(start, true);
379
	var startCoords = h.toCoordinateObject(start, true);
378
	var outline = document.createElement("div");
380
	var outline = document.createElement("div");
379
	h.copyStyle(outline, endNode);
381
	h.copyStyle(outline, endNode);
380
	if (endNode.explodeClassName) {
382
	if (endNode.explodeClassName) {
381
		outline.className = endNode.explodeClassName;
383
		outline.className = endNode.explodeClassName;
382
	}
384
	}
383
	with (outline.style) {
385
	with (outline.style) {
384
		position = "absolute";
386
		position = "absolute";
385
		display = "none";
387
		display = "none";
386
		var backgroundStyle = h.getStyle(start, "background-color");
388
		var backgroundStyle = h.getStyle(start, "background-color");
387
		backgroundColor = backgroundStyle ? backgroundStyle.toLowerCase() : "transparent";
389
		backgroundColor = backgroundStyle ? backgroundStyle.toLowerCase() : "transparent";
388
		backgroundColor = (backgroundColor == "transparent") ? "rgb(221, 221, 221)" : backgroundColor;
390
		backgroundColor = (backgroundColor == "transparent") ? "rgb(221, 221, 221)" : backgroundColor;
389
	}
391
	}
390
	dojo.body().appendChild(outline);
392
	dojo.body().appendChild(outline);
391
	with (endNode.style) {
393
	with (endNode.style) {
392
		visibility = "hidden";
394
		visibility = "hidden";
393
		display = "block";
395
		display = "block";
394
	}
396
	}
395
	var endCoords = h.toCoordinateObject(endNode, true);
397
	var endCoords = h.toCoordinateObject(endNode, true);
396
	with (endNode.style) {
398
	with (endNode.style) {
397
		display = "none";
399
		display = "none";
398
		visibility = "visible";
400
		visibility = "visible";
399
	}
401
	}
400
	var props = {opacity:{start:0.5, end:1}};
402
	var props = {opacity:{start:0.5, end:1}};
401
	dojo.lang.forEach(["height", "width", "top", "left"], function (type) {
403
	dojo.lang.forEach(["height", "width", "top", "left"], function (type) {
402
		props[type] = {start:startCoords[type], end:endCoords[type]};
404
		props[type] = {start:startCoords[type], end:endCoords[type]};
403
	});
405
	});
404
	var anim = new dojo.lfx.propertyAnimation(outline, props, duration, easing, {"beforeBegin":function () {
406
	var anim = new dojo.lfx.propertyAnimation(outline, props, duration, easing, {"beforeBegin":function () {
405
		h.setDisplay(outline, "block");
407
		h.setDisplay(outline, "block");
406
	}, "onEnd":function () {
408
	}, "onEnd":function () {
407
		h.setDisplay(endNode, "block");
409
		h.setDisplay(endNode, "block");
408
		outline.parentNode.removeChild(outline);
410
		outline.parentNode.removeChild(outline);
409
	}});
411
	}});
410
	if (callback) {
412
	if (callback) {
411
		anim.connect("onEnd", function () {
413
		anim.connect("onEnd", function () {
412
			callback(endNode, anim);
414
			callback(endNode, anim);
413
		});
415
		});
414
	}
416
	}
415
	return anim;
417
	return anim;
416
};
418
};
417
dojo.lfx.html.implode = function (startNode, end, duration, easing, callback) {
419
dojo.lfx.html.implode = function (startNode, end, duration, easing, callback) {
418
	var h = dojo.html;
420
	var h = dojo.html;
419
	startNode = dojo.byId(startNode);
421
	startNode = dojo.byId(startNode);
420
	end = dojo.byId(end);
422
	end = dojo.byId(end);
421
	var startCoords = dojo.html.toCoordinateObject(startNode, true);
423
	var startCoords = dojo.html.toCoordinateObject(startNode, true);
422
	var endCoords = dojo.html.toCoordinateObject(end, true);
424
	var endCoords = dojo.html.toCoordinateObject(end, true);
423
	var outline = document.createElement("div");
425
	var outline = document.createElement("div");
424
	dojo.html.copyStyle(outline, startNode);
426
	dojo.html.copyStyle(outline, startNode);
425
	if (startNode.explodeClassName) {
427
	if (startNode.explodeClassName) {
426
		outline.className = startNode.explodeClassName;
428
		outline.className = startNode.explodeClassName;
427
	}
429
	}
428
	dojo.html.setOpacity(outline, 0.3);
430
	dojo.html.setOpacity(outline, 0.3);
429
	with (outline.style) {
431
	with (outline.style) {
430
		position = "absolute";
432
		position = "absolute";
431
		display = "none";
433
		display = "none";
432
		backgroundColor = h.getStyle(startNode, "background-color").toLowerCase();
434
		backgroundColor = h.getStyle(startNode, "background-color").toLowerCase();
433
	}
435
	}
434
	dojo.body().appendChild(outline);
436
	dojo.body().appendChild(outline);
435
	var props = {opacity:{start:1, end:0.5}};
437
	var props = {opacity:{start:1, end:0.5}};
436
	dojo.lang.forEach(["height", "width", "top", "left"], function (type) {
438
	dojo.lang.forEach(["height", "width", "top", "left"], function (type) {
437
		props[type] = {start:startCoords[type], end:endCoords[type]};
439
		props[type] = {start:startCoords[type], end:endCoords[type]};
438
	});
440
	});
439
	var anim = new dojo.lfx.propertyAnimation(outline, props, duration, easing, {"beforeBegin":function () {
441
	var anim = new dojo.lfx.propertyAnimation(outline, props, duration, easing, {"beforeBegin":function () {
440
		dojo.html.hide(startNode);
442
		dojo.html.hide(startNode);
441
		dojo.html.show(outline);
443
		dojo.html.show(outline);
442
	}, "onEnd":function () {
444
	}, "onEnd":function () {
443
		outline.parentNode.removeChild(outline);
445
		outline.parentNode.removeChild(outline);
444
	}});
446
	}});
445
	if (callback) {
447
	if (callback) {
446
		anim.connect("onEnd", function () {
448
		anim.connect("onEnd", function () {
447
			callback(startNode, anim);
449
			callback(startNode, anim);
448
		});
450
		});
449
	}
451
	}
450
	return anim;
452
	return anim;
451
};
453
};
452
dojo.lfx.html.highlight = function (nodes, startColor, duration, easing, callback) {
454
dojo.lfx.html.highlight = function (nodes, startColor, duration, easing, callback) {
453
	nodes = dojo.lfx.html._byId(nodes);
455
	nodes = dojo.lfx.html._byId(nodes);
454
	var anims = [];
456
	var anims = [];
455
	dojo.lang.forEach(nodes, function (node) {
457
	dojo.lang.forEach(nodes, function (node) {
456
		var color = dojo.html.getBackgroundColor(node);
458
		var color = dojo.html.getBackgroundColor(node);
457
		var bg = dojo.html.getStyle(node, "background-color").toLowerCase();
459
		var bg = dojo.html.getStyle(node, "background-color").toLowerCase();
458
		var bgImage = dojo.html.getStyle(node, "background-image");
460
		var bgImage = dojo.html.getStyle(node, "background-image");
459
		var wasTransparent = (bg == "transparent" || bg == "rgba(0, 0, 0, 0)");
461
		var wasTransparent = (bg == "transparent" || bg == "rgba(0, 0, 0, 0)");
460
		while (color.length > 3) {
462
		while (color.length > 3) {
461
			color.pop();
463
			color.pop();
462
		}
464
		}
463
		var rgb = new dojo.gfx.color.Color(startColor);
465
		var rgb = new dojo.gfx.color.Color(startColor);
464
		var endRgb = new dojo.gfx.color.Color(color);
466
		var endRgb = new dojo.gfx.color.Color(color);
465
		var anim = dojo.lfx.propertyAnimation(node, {"background-color":{start:rgb, end:endRgb}}, duration, easing, {"beforeBegin":function () {
467
		var anim = dojo.lfx.propertyAnimation(node, {"background-color":{start:rgb, end:endRgb}}, duration, easing, {"beforeBegin":function () {
466
			if (bgImage) {
468
			if (bgImage) {
467
				node.style.backgroundImage = "none";
469
				node.style.backgroundImage = "none";
468
			}
470
			}
469
			node.style.backgroundColor = "rgb(" + rgb.toRgb().join(",") + ")";
471
			node.style.backgroundColor = "rgb(" + rgb.toRgb().join(",") + ")";
470
		}, "onEnd":function () {
472
		}, "onEnd":function () {
471
			if (bgImage) {
473
			if (bgImage) {
472
				node.style.backgroundImage = bgImage;
474
				node.style.backgroundImage = bgImage;
473
			}
475
			}
474
			if (wasTransparent) {
476
			if (wasTransparent) {
475
				node.style.backgroundColor = "transparent";
477
				node.style.backgroundColor = "transparent";
476
			}
478
			}
477
			if (callback) {
479
			if (callback) {
478
				callback(node, anim);
480
				callback(node, anim);
479
			}
481
			}
480
		}});
482
		}});
481
		anims.push(anim);
483
		anims.push(anim);
482
	});
484
	});
483
	return dojo.lfx.combine(anims);
485
	return dojo.lfx.combine(anims);
484
};
486
};
485
dojo.lfx.html.unhighlight = function (nodes, endColor, duration, easing, callback) {
487
dojo.lfx.html.unhighlight = function (nodes, endColor, duration, easing, callback) {
486
	nodes = dojo.lfx.html._byId(nodes);
488
	nodes = dojo.lfx.html._byId(nodes);
487
	var anims = [];
489
	var anims = [];
488
	dojo.lang.forEach(nodes, function (node) {
490
	dojo.lang.forEach(nodes, function (node) {
489
		var color = new dojo.gfx.color.Color(dojo.html.getBackgroundColor(node));
491
		var color = new dojo.gfx.color.Color(dojo.html.getBackgroundColor(node));
490
		var rgb = new dojo.gfx.color.Color(endColor);
492
		var rgb = new dojo.gfx.color.Color(endColor);
491
		var bgImage = dojo.html.getStyle(node, "background-image");
493
		var bgImage = dojo.html.getStyle(node, "background-image");
492
		var anim = dojo.lfx.propertyAnimation(node, {"background-color":{start:color, end:rgb}}, duration, easing, {"beforeBegin":function () {
494
		var anim = dojo.lfx.propertyAnimation(node, {"background-color":{start:color, end:rgb}}, duration, easing, {"beforeBegin":function () {
493
			if (bgImage) {
495
			if (bgImage) {
494
				node.style.backgroundImage = "none";
496
				node.style.backgroundImage = "none";
495
			}
497
			}
496
			node.style.backgroundColor = "rgb(" + color.toRgb().join(",") + ")";
498
			node.style.backgroundColor = "rgb(" + color.toRgb().join(",") + ")";
497
		}, "onEnd":function () {
499
		}, "onEnd":function () {
498
			if (callback) {
500
			if (callback) {
499
				callback(node, anim);
501
				callback(node, anim);
500
			}
502
			}
501
		}});
503
		}});
502
		anims.push(anim);
504
		anims.push(anim);
503
	});
505
	});
504
	return dojo.lfx.combine(anims);
506
	return dojo.lfx.combine(anims);
505
};
507
};
506
dojo.lang.mixin(dojo.lfx, dojo.lfx.html);
508
dojo.lang.mixin(dojo.lfx, dojo.lfx.html);
507
 
509