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.require("dojo.html.style");
13
dojo.require("dojo.html.style");
12
dojo.provide("dojo.html.color");
14
dojo.provide("dojo.html.color");
13
dojo.require("dojo.gfx.color");
15
dojo.require("dojo.gfx.color");
14
dojo.require("dojo.lang.common");
16
dojo.require("dojo.lang.common");
15
dojo.html.getBackgroundColor = function (node) {
17
dojo.html.getBackgroundColor = function (node) {
16
	node = dojo.byId(node);
18
	node = dojo.byId(node);
17
	var color;
19
	var color;
18
	do {
20
	do {
19
		color = dojo.html.getStyle(node, "background-color");
21
		color = dojo.html.getStyle(node, "background-color");
20
		if (color.toLowerCase() == "rgba(0, 0, 0, 0)") {
22
		if (color.toLowerCase() == "rgba(0, 0, 0, 0)") {
21
			color = "transparent";
23
			color = "transparent";
22
		}
24
		}
23
		if (node == document.getElementsByTagName("body")[0]) {
25
		if (node == document.getElementsByTagName("body")[0]) {
24
			node = null;
26
			node = null;
25
			break;
27
			break;
26
		}
28
		}
27
		node = node.parentNode;
29
		node = node.parentNode;
28
	} while (node && dojo.lang.inArray(["transparent", ""], color));
30
	} while (node && dojo.lang.inArray(["transparent", ""], color));
29
	if (color == "transparent") {
31
	if (color == "transparent") {
30
		color = [255, 255, 255, 0];
32
		color = [255, 255, 255, 0];
31
	} else {
33
	} else {
32
		color = dojo.gfx.color.extractRGB(color);
34
		color = dojo.gfx.color.extractRGB(color);
33
	}
35
	}
34
	return color;
36
	return color;
35
};
37
};
36
 
38