Subversion Repositories Applications.papyrus

Rev

Rev 1318 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1318 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.html.iframe");
13
dojo.provide("dojo.html.iframe");
12
dojo.require("dojo.html.util");
14
dojo.require("dojo.html.util");
13
dojo.html.iframeContentWindow = function (iframe_el) {
15
dojo.html.iframeContentWindow = function (iframe_el) {
14
	var win = dojo.html.getDocumentWindow(dojo.html.iframeContentDocument(iframe_el)) || dojo.html.iframeContentDocument(iframe_el).__parent__ || (iframe_el.name && document.frames[iframe_el.name]) || null;
16
	var win = dojo.html.getDocumentWindow(dojo.html.iframeContentDocument(iframe_el)) || dojo.html.iframeContentDocument(iframe_el).__parent__ || (iframe_el.name && document.frames[iframe_el.name]) || null;
15
	return win;
17
	return win;
16
};
18
};
17
dojo.html.iframeContentDocument = function (iframe_el) {
19
dojo.html.iframeContentDocument = function (iframe_el) {
18
	var doc = iframe_el.contentDocument || ((iframe_el.contentWindow) && (iframe_el.contentWindow.document)) || ((iframe_el.name) && (document.frames[iframe_el.name]) && (document.frames[iframe_el.name].document)) || null;
20
	var doc = iframe_el.contentDocument || ((iframe_el.contentWindow) && (iframe_el.contentWindow.document)) || ((iframe_el.name) && (document.frames[iframe_el.name]) && (document.frames[iframe_el.name].document)) || null;
19
	return doc;
21
	return doc;
20
};
22
};
21
dojo.html.BackgroundIframe = function (node) {
23
dojo.html.BackgroundIframe = function (node) {
22
	if (dojo.render.html.ie55 || dojo.render.html.ie60) {
24
	if (dojo.render.html.ie55 || dojo.render.html.ie60) {
23
		var html = "<iframe src='javascript:false'" + " style='position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;" + "z-index: -1; filter:Alpha(Opacity=\"0\");' " + ">";
25
		var html = "<iframe src='javascript:false'" + " style='position: absolute; left: 0px; top: 0px; width: 100%; height: 100%;" + "z-index: -1; filter:Alpha(Opacity=\"0\");' " + ">";
24
		this.iframe = dojo.doc().createElement(html);
26
		this.iframe = dojo.doc().createElement(html);
25
		this.iframe.tabIndex = -1;
27
		this.iframe.tabIndex = -1;
26
		if (node) {
28
		if (node) {
27
			node.appendChild(this.iframe);
29
			node.appendChild(this.iframe);
28
			this.domNode = node;
30
			this.domNode = node;
29
		} else {
31
		} else {
30
			dojo.body().appendChild(this.iframe);
32
			dojo.body().appendChild(this.iframe);
31
			this.iframe.style.display = "none";
33
			this.iframe.style.display = "none";
32
		}
34
		}
33
	}
35
	}
34
};
36
};
35
dojo.lang.extend(dojo.html.BackgroundIframe, {iframe:null, onResized:function () {
37
dojo.lang.extend(dojo.html.BackgroundIframe, {iframe:null, onResized:function () {
36
	if (this.iframe && this.domNode && this.domNode.parentNode) {
38
	if (this.iframe && this.domNode && this.domNode.parentNode) {
37
		var outer = dojo.html.getMarginBox(this.domNode);
39
		var outer = dojo.html.getMarginBox(this.domNode);
38
		if (outer.width == 0 || outer.height == 0) {
40
		if (outer.width == 0 || outer.height == 0) {
39
			dojo.lang.setTimeout(this, this.onResized, 100);
41
			dojo.lang.setTimeout(this, this.onResized, 100);
40
			return;
42
			return;
41
		}
43
		}
42
		this.iframe.style.width = outer.width + "px";
44
		this.iframe.style.width = outer.width + "px";
43
		this.iframe.style.height = outer.height + "px";
45
		this.iframe.style.height = outer.height + "px";
44
	}
46
	}
45
}, size:function (node) {
47
}, size:function (node) {
46
	if (!this.iframe) {
48
	if (!this.iframe) {
47
		return;
49
		return;
48
	}
50
	}
49
	var coords = dojo.html.toCoordinateObject(node, true, dojo.html.boxSizing.BORDER_BOX);
51
	var coords = dojo.html.toCoordinateObject(node, true, dojo.html.boxSizing.BORDER_BOX);
50
	with (this.iframe.style) {
52
	with (this.iframe.style) {
51
		width = coords.width + "px";
53
		width = coords.width + "px";
52
		height = coords.height + "px";
54
		height = coords.height + "px";
53
		left = coords.left + "px";
55
		left = coords.left + "px";
54
		top = coords.top + "px";
56
		top = coords.top + "px";
55
	}
57
	}
56
}, setZIndex:function (node) {
58
}, setZIndex:function (node) {
57
	if (!this.iframe) {
59
	if (!this.iframe) {
58
		return;
60
		return;
59
	}
61
	}
60
	if (dojo.dom.isNode(node)) {
62
	if (dojo.dom.isNode(node)) {
61
		this.iframe.style.zIndex = dojo.html.getStyle(node, "z-index") - 1;
63
		this.iframe.style.zIndex = dojo.html.getStyle(node, "z-index") - 1;
62
	} else {
64
	} else {
63
		if (!isNaN(node)) {
65
		if (!isNaN(node)) {
64
			this.iframe.style.zIndex = node;
66
			this.iframe.style.zIndex = node;
65
		}
67
		}
66
	}
68
	}
67
}, show:function () {
69
}, show:function () {
68
	if (this.iframe) {
70
	if (this.iframe) {
69
		this.iframe.style.display = "block";
71
		this.iframe.style.display = "block";
70
	}
72
	}
71
}, hide:function () {
73
}, hide:function () {
72
	if (this.iframe) {
74
	if (this.iframe) {
73
		this.iframe.style.display = "none";
75
		this.iframe.style.display = "none";
74
	}
76
	}
75
}, remove:function () {
77
}, remove:function () {
76
	if (this.iframe) {
78
	if (this.iframe) {
77
		dojo.html.removeNode(this.iframe, true);
79
		dojo.html.removeNode(this.iframe, true);
78
		delete this.iframe;
80
		delete this.iframe;
79
		this.iframe = null;
81
		this.iframe = null;
80
	}
82
	}
81
}});
83
}});
82
 
84