]> git.wh0rd.org - tt-rss.git/blob - lib/dijit/BackgroundIframe.js.uncompressed.js
modify dojo rebuild script to remove uncompressed files
[tt-rss.git] / lib / dijit / BackgroundIframe.js.uncompressed.js
1 define("dijit/BackgroundIframe", [
2 "require", // require.toUrl
3 "./main", // to export dijit.BackgroundIframe
4 "dojo/_base/config",
5 "dojo/dom-construct", // domConstruct.create
6 "dojo/dom-style", // domStyle.set
7 "dojo/_base/lang", // lang.extend lang.hitch
8 "dojo/on",
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){
12
13 // module:
14 // dijit/BackgroundIFrame
15
16 // TODO: remove _frames, it isn't being used much, since popups never release their
17 // iframes (see [22236])
18 var _frames = new function(){
19 // summary:
20 // cache of iframes
21
22 var queue = [];
23
24 this.pop = function(){
25 var iframe;
26 if(queue.length){
27 iframe = queue.pop();
28 iframe.style.display="";
29 }else{
30 if(has("ie") < 9){
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);
36 }else{
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);
42 }
43 iframe.tabIndex = -1; // Magic to prevent iframe from getting focus on tab keypress - as style didn't work.
44 }
45 return iframe;
46 };
47
48 this.push = function(iframe){
49 iframe.style.display="none";
50 queue.push(iframe);
51 }
52 }();
53
54
55 dijit.BackgroundIframe = function(/*DomNode*/ node){
56 // summary:
57 // For IE/FF z-index schenanigans. id attribute is required.
58 //
59 // description:
60 // new dijit.BackgroundIframe(node).
61 //
62 // Makes a background iframe as a child of node, that fills
63 // area (and position) of node
64
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")){
70 this.resize(node);
71 this._conn = on(node, 'resize', lang.hitch(this, function(){
72 this.resize(node);
73 }));
74 }else{
75 domStyle.set(iframe, {
76 width: '100%',
77 height: '100%'
78 });
79 }
80 }
81 };
82
83 lang.extend(dijit.BackgroundIframe, {
84 resize: function(node){
85 // summary:
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.
88 if(this.iframe){
89 domStyle.set(this.iframe, {
90 width: node.offsetWidth + 'px',
91 height: node.offsetHeight + 'px'
92 });
93 }
94 },
95 destroy: function(){
96 // summary:
97 // destroy the iframe
98 if(this._conn){
99 this._conn.remove();
100 this._conn = null;
101 }
102 if(this.iframe){
103 _frames.push(this.iframe);
104 delete this.iframe;
105 }
106 }
107 });
108
109 return dijit.BackgroundIframe;
110 });