summaryrefslogtreecommitdiffstats
path: root/schemas/OMNA Schema-based Namespace Registry_fichiers/Screen.js
blob: e9bf95c5697a3d4402bcf8f52b39631f6d4cd1b1 (plain)
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
if (typeof window.RadControlsNamespace == "undefined")
{
	window.RadControlsNamespace = {};
}

if (
	typeof(window.RadControlsNamespace.Screen) == "undefined" ||
	typeof(window.RadControlsNamespace.Screen.Version) == null ||
	window.RadControlsNamespace.Screen.Version < 1.1
	)
{	

	window.RadControlsNamespace.Screen = 
	{
	
		Version : 1.1,	
	
	    GetViewPortSize : function() 
	    {
			var width = 0;
			var height = 0;
			
			var canvas = document.body;

			if (RadControlsNamespace.Browser.StandardsMode && !RadControlsNamespace.Browser.IsSafari)
			{
				canvas = document.documentElement;
			}			
			
			if (RadControlsNamespace.Browser.IsMozilla && document.compatMode != "CSS1Compat")
			{
			    canvas = document.body;
			}
			
			if (window.innerWidth) 
			{
				width = window.innerWidth;
				height = window.innerHeight;
			} 
			else
			{
				width = canvas.clientWidth;
				height = canvas.clientHeight;
			}
			
			width += canvas.scrollLeft;
			height += canvas.scrollTop;
			
			return { width : width - 6, height : height - 6 };
	    },
		
		GetElementPosition : function (el)
		{
			var parent = null;
			var pos = {x: 0, y: 0};
			var box;
	
			if (el.getBoundingClientRect) 
			{ 
				// IE
				box = el.getBoundingClientRect();
				var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
				var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
	
				pos.x = box.left + scrollLeft - 2;
				pos.y = box.top + scrollTop - 2;
			    
				return pos;
			}
			else if (document.getBoxObjectFor) 
			{ 
				// gecko
				try
				{
				    box = document.getBoxObjectFor(el);
				    pos.x = box.x - 2;
				    pos.y = box.y - 2;
				}catch(e){}
			}
			else 
			{ 
				// safari/opera
				pos.x = el.offsetLeft;
				pos.y = el.offsetTop;
				parent = el.offsetParent;
				if (parent != el)
				{
					while (parent) 
					{
						pos.x += parent.offsetLeft;
						pos.y += parent.offsetTop;
						parent = parent.offsetParent;
					}
				}
			}
	
	
			if (window.opera)
			{
				parent = el.offsetParent;
				
				while (parent && parent.tagName.toLowerCase() != 'body' && parent.tagName.toLowerCase() != 'html') 
				{
					pos.x -= parent.scrollLeft;
					pos.y -= parent.scrollTop;
					parent = parent.offsetParent;
				}
			}
			else
			{
				parent = el.parentNode; 
				while (parent && parent.tagName.toLowerCase() != 'body' && parent.tagName.toLowerCase() != 'html') 
				{
					pos.x -= parent.scrollLeft;
					pos.y -= parent.scrollTop;
	
					parent = parent.parentNode;
				}
			}
	
			return pos;
		},
		
		ElementOverflowsTop : function (element)
		{
			return this.GetElementPosition(element).y < 0;
		}, 
	
		ElementOverflowsLeft : function (element)
		{
			return this.GetElementPosition(element).x < 0;
		},
		
		ElementOverflowsBottom : function (screenSize, element)
		{
			var bottomEdge = this.GetElementPosition(element).y + RadControlsNamespace.Box.GetOuterHeight(element);
			return bottomEdge > screenSize.height;	
		},	
		
		ElementOverflowsRight : function (screenSize, element)
		{
			var rightEdge = this.GetElementPosition(element).x + RadControlsNamespace.Box.GetOuterWidth(element);
			return rightEdge > screenSize.width;
		}		
	}
}

//BEGIN_ATLAS_NOTIFY
if (typeof(Sys) != "undefined")
{
	if (Sys.Application != null && Sys.Application.notifyScriptLoaded != null)
	{
		Sys.Application.notifyScriptLoaded();
	}
}
//END_ATLAS_NOTIFY
OpenPOWER on IntegriCloud