]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/BackgroundIframe.js.uncompressed.js
1 define("dijit/BackgroundIframe", [
2 "require", // require.toUrl
3 "./main", // to export dijit.BackgroundIframe
5 "dojo/dom-construct", // domConstruct.create
6 "dojo/dom-style", // domStyle.set
7 "dojo/_base/lang", // lang.extend lang.hitch
9 "dojo/sniff", // has("ie"), has("mozilla"), has("quirks")
10 "dojo/_base/window" // win.doc.createElement
11 ], function(require
, dijit
, config
, domConstruct
, domStyle
, lang
, on
, has
, win
){
14 // dijit/BackgroundIFrame
16 // TODO: remove _frames, it isn't being used much, since popups never release their
17 // iframes (see [22236])
18 var _frames
= new function(){
24 this.pop = function(){
28 iframe
.style
.display
="";
31 var burl
= config
["dojoBlankHtmlUrl"] || require
.toUrl("dojo/resources/blank.html") || "javascript:\"\"";
32 var html
="<iframe src='" + burl
+ "' role='presentation'"
33 + " style='position: absolute; left: 0px; top: 0px;"
34 + "z-index: -1; filter:Alpha(Opacity=\"0\");'>";
35 iframe
= win
.doc
.createElement(html
);
37 iframe
= domConstruct
.create("iframe");
38 iframe
.src
= 'javascript:""';
39 iframe
.className
= "dijitBackgroundIframe";
40 iframe
.setAttribute("role", "presentation");
41 domStyle
.set(iframe
, "opacity", 0.1);
43 iframe
.tabIndex
= -1; // Magic to prevent iframe from getting focus on tab keypress - as style didn't work.
48 this.push = function(iframe
){
49 iframe
.style
.display
="none";
55 dijit
.BackgroundIframe = function(/*DomNode*/ node
){
57 // For IE/FF z-index schenanigans. id attribute is required.
60 // new dijit.BackgroundIframe(node).
62 // Makes a background iframe as a child of node, that fills
63 // area (and position) of node
65 if(!node
.id
){ throw new Error("no id"); }
66 if(has("ie") || has("mozilla")){
67 var iframe
= (this.iframe
= _frames
.pop());
68 node
.appendChild(iframe
);
69 if(has("ie")<7 || has("quirks")){
71 this._conn
= on(node
, 'resize', lang
.hitch(this, function(){
75 domStyle
.set(iframe
, {
83 lang
.extend(dijit
.BackgroundIframe
, {
84 resize: function(node
){
86 // Resize the iframe so it's the same size as node.
87 // Needed on IE6 and IE/quirks because height:100% doesn't work right.
89 domStyle
.set(this.iframe
, {
90 width
: node
.offsetWidth
+ 'px',
91 height
: node
.offsetHeight
+ 'px'
103 _frames
.push(this.iframe
);
109 return dijit
.BackgroundIframe
;