Debian Codegraph @

dojox/widget/Standby.js

raw symbols SCIP
1 define(["dojo/_base/kernel",
2 "dojo/_base/declare",
3 "dojo/_base/array",
4 "dojo/_base/event",
5 "dojo/_base/sniff",
6 "dojo/dom",
7 "dojo/dom-attr",
8 "dojo/dom-construct",
9 "dojo/dom-geometry",
10 "dojo/dom-style",
11 "dojo/window",
12 "dojo/_base/window",
13 "dojo/_base/fx",
14 "dojo/fx",
15 "dijit/_Widget",
16 "dijit/_TemplatedMixin",
17 "dijit/registry"],
18
19 function(kernel,
20 declare,
21 array,
22 event,
23 has,
24 dom,
25 attr,
26 construct,
27 geometry,
28 domStyle,
29 window,
30 baseWindow,
31 baseFx,
32 fx,
33 _Widget,
34 _TemplatedMixin,
35 registry) {
36
37 kernel.experimental("dojox.widget.Standby");
38
39 return declare("dojox.widget.Standby", [_Widget, _TemplatedMixin],{
40 // summary:
41 // A widget designed to act as a Standby/Busy/Disable/Blocking widget to indicate a
42 // particular DOM node is processing and cannot be clicked on at this time.
43 // This widget uses absolute positioning to apply the overlay and image.
44
45 // image: String
46 // A URL to an image to center within the blocking overlay.
47 // The default is a basic spinner.
48 image: require.toUrl("dojox/widget/Standby/images/loading.gif").toString(),
49
50 // imageText: String
51 // Text to set on the ALT tag of the image.
52 // The default is 'Please wait...'
53 imageText: "Please Wait...", // TODO: i18n
54
55 // text: String
56 // Text/HTML to display in the center of the overlay
57 // This is used if image center is disabled.
58 // Defaults to 'Please Wait...'
59 text: "Please wait...",
60
61 // centerIndicator: String
62 // Property to define if the image and its alt text should be used, or
63 // a simple Text/HTML node should be used. Allowable values are 'image'
64 // and 'text'.
65 // Default is 'image'.
66 centerIndicator: "image",
67
68 // target: DOMNode||DOMID(String)||WidgetID(String)
69 // The target to overlay when active. Can be a widget id, a
70 // dom id, or a direct node reference.
71 target: "",
72
73 // color: String
74 // The color to set the overlay. Should be in #XXXXXX form.
75 // Default color for the translucent overlay is light gray.
76 color: "#C0C0C0",
77
78 // duration: Integer
79 // Integer defining how long the show and hide effects should take in milliseconds.
80 // Defaults to 500
81 duration: 500,
82
83 // zIndex: String
84 // Control that lets you specify if the zIndex for the overlay
85 // should be auto-computed based off parent zIndex, or should be set
86 // to a particular value. This is useful when you want to overlay
87 // things in digit.Dialogs, you can specify a base zIndex to append from.
88 zIndex: "auto",
89
90 // opacity: float
91 // The opacity to make the overlay when it is displayed/faded in.
92 // The default is 0.75. This does not affect the image opacity, only the
93 // overlay.
94 opacity: 0.75,
95
96 // templateString: [protected] String
97 // The template string defining out the basics of the widget. No need for an external
98 // file.
99 templateString:
100 "<div>" +
101 "<div style=\"display: none; opacity: 0; z-index: 9999; " +
102 "position: absolute; cursor:wait;\" dojoAttachPoint=\"_underlayNode\"></div>" +
103 "<img src=\"${image}\" style=\"opacity: 0; display: none; z-index: -10000; " +
104 "position: absolute; top: 0px; left: 0px; cursor:wait;\" "+
105 "dojoAttachPoint=\"_imageNode\">" +
106 "<div style=\"opacity: 0; display: none; z-index: -10000; position: absolute; " +
107 "top: 0px;\" dojoAttachPoint=\"_textNode\"></div>" +
108 "</div>",
109
110 // _underlayNode: [private] DOMNode
111 // The node that is the translucent underlay for the
112 // image that blocks access to the target.
113 _underlayNode: null,
114
115 // _imageNode: [private] DOMNode
116 // The image node where we attach and define the image to display.
117 _imageNode: null,
118
119 // _textNode: [private] DOMNode
120 // The div to attach text/HTML in the overlay center item.
121 _textNode: null,
122
123 // _centerNode: [private] DOMNode
124 // Which node to use as the center node, the image or the text node.
125 _centerNode: null,
126
127 // _displayed: [private] Boolean
128 // Flag to indicate if the overlay is displayed or not.
129 _displayed: false,
130
131 // _resizeCheck: [private] Object
132 // Handle to interval function that checks the target for changes.
133 _resizeCheck: null,
134
135 // _started: [private] Boolean
136 // Trap flag to ensure startup only processes once.
137 _started: false,
138
139 // _parent: [private] DOMNode
140 // Wrapping div for the widget, also used for IE 7 in dealing with the
141 // zoom issue.
142 _parent: null,
143
144 startup: function(args){
145 // summary:
146 // Over-ride of the basic widget startup function.
147 // Configures the target node and sets the image to use.
148 if(!this._started){
149 if(typeof this.target === "string"){
150 var w = registry.byId(this.target);
151 this.target = w ? w.domNode : dom.byId(this.target);
152 }
153
154 if(this.text){
155 this._textNode.innerHTML = this.text;
156 }
157 if(this.centerIndicator === "image"){
158 this._centerNode = this._imageNode;
159 attr.set(this._imageNode, "src", this.image);
160 attr.set(this._imageNode, "alt", this.imageText);
161 }else{
162 this._centerNode = this._textNode;
163 }
164 domStyle.set(this._underlayNode, {
165 display: "none",
166 backgroundColor: this.color
167 });
168 domStyle.set(this._centerNode, "display", "none");
169 this.connect(this._underlayNode, "onclick", "_ignore");
170
171 //Last thing to do is move the widgets parent, if any, to the current document body.
172 //Avoids having to deal with parent relative/absolute mess. Otherwise positioning
173 //tends to go goofy.
174 if(this.domNode.parentNode && this.domNode.parentNode != baseWindow.body()){
175 baseWindow.body().appendChild(this.domNode);
176 }
177
178 //IE 7 has a horrible bug with zoom, so we have to create this node
179 //to cross-check later. Sigh.
180 if(has("ie") == 7){
181 this._ieFixNode = construct.create("div");
182 domStyle.set(this._ieFixNode, {
183 opacity: "0",
184 zIndex: "-1000",
185 position: "absolute",
186 top: "-1000px"
187 });
188 baseWindow.body().appendChild(this._ieFixNode);
189 }
190 this.inherited(arguments);
191 }
192 },
193
194 show: function(){
195 // summary:
196 // Function to display the blocking overlay and busy/status icon or text.
197 if(!this._displayed){
198 if(this._anim){
199 this._anim.stop();
200 delete this._anim;
201 }
202 this._displayed = true;
203 this._size();
204 this._disableOverflow();
205 this._fadeIn();
206 }
207 },
208
209 hide: function(){
210 // summary:
211 // Function to hide the blocking overlay and status icon or text.
212 if(this._displayed){
213 // Ideally would come up with something better than try/catch,
214 // but don't see another simple workaround for
215 // https://bugs.dojotoolkit.org/ticket/18196 and
216 // https://bugs.dojotoolkit.org/ticket/14984
217 try{
218 if(this._anim){
219 this._anim.stop();
220 delete this._anim;
221 }
222 this._size();
223 }catch(e){
224 console.error(e);
225 }finally{
226 this._fadeOut();
227 this._displayed = false;
228 if(this._resizeCheck !== null){
229 clearInterval(this._resizeCheck);
230 this._resizeCheck = null;
231 }
232 }
233 }
234 },
235
236 isVisible: function(){
237 // summary:
238 // Helper function so you can test if the widget is already visible or not.
239 // returns:
240 // boolean indicating if the widget is in 'show' state or not.
241 return this._displayed; // boolean
242 },
243
244 onShow: function(){
245 // summary:
246 // Event that fires when the display of the Standby completes.
247 },
248
249 onHide: function(){
250 // summary:
251 // Event that fires when the display of the Standby completes.
252 },
253
254 uninitialize: function(){
255 // summary:
256 // Over-ride to hide the widget, which clears intervals, before cleanup.
257 this._displayed = false;
258 if(this._resizeCheck){
259 clearInterval(this._resizeCheck);
260 }
261 domStyle.set(this._centerNode, "display", "none");
262 domStyle.set(this._underlayNode, "display", "none");
263 if(has("ie") == 7 && this._ieFixNode){
264 baseWindow.body().removeChild(this._ieFixNode);
265 delete this._ieFixNode;
266 }
267 if(this._anim){
268 this._anim.stop();
269 delete this._anim;
270 }
271 this.target = null;
272 this._imageNode = null;
273 this._textNode = null;
274 this._centerNode = null;
275 this.inherited(arguments);
276 },
277
278 _size: function(){
279 // summary:
280 // Internal function that handles resizing the overlay and
281 // centering of the image on window resizing.
282 // tags:
283 // private
284 if(this._displayed){
285 var dir = attr.get(baseWindow.body(), "dir");
286 if(dir){dir = dir.toLowerCase();}
287 var _ie7zoom;
288 var scrollers = this._scrollerWidths();
289
290 var target = this.target;
291
292 //Show the image and make sure the zIndex is set high.
293 var curStyle = domStyle.get(this._centerNode, "display");
294 domStyle.set(this._centerNode, "display", "block");
295 var box = geometry.position(target, true);
296 if(target === baseWindow.body() || target === baseWindow.doc){
297 // Target is the whole doc, so scale to viewport.
298 box = window.getBox();
299 box.x = box.l;
300 box.y = box.t;
301 }
302
303 var cntrIndicator = geometry.getMarginBox(this._centerNode);
304 domStyle.set(this._centerNode, "display", curStyle);
305
306 //IE has a horrible zoom bug. So, we have to try and account for
307 //it and fix up the scaling.
308 if(this._ieFixNode){
309 _ie7zoom = -this._ieFixNode.offsetTop / 1000;
310 box.x = Math.floor((box.x + 0.9) / _ie7zoom);
311 box.y = Math.floor((box.y + 0.9) / _ie7zoom);
312 box.w = Math.floor((box.w + 0.9) / _ie7zoom);
313 box.h = Math.floor((box.h + 0.9) / _ie7zoom);
314 }
315
316 //Figure out how to zIndex this thing over the target.
317 var zi = domStyle.get(target, "zIndex");
318 var ziUl = zi;
319 var ziIn = zi;
320
321 if(this.zIndex === "auto"){
322 if(zi != "auto"){
323 // honor user-defined z-index
324 ziUl = parseInt(ziUl, 10);
325 ziIn = parseInt(ziIn, 10);
326 }else{
327 //We need to search up the chain to see if there
328 //are any parent zIndexs to overlay.
329 var cNode = target;
330 if(cNode && cNode !== baseWindow.body() && cNode !== baseWindow.doc){
331 cNode = target.parentNode;
332 var oldZi = -100000;
333 while(cNode && cNode !== baseWindow.body()){
334 zi = domStyle.get(cNode, "zIndex");
335 if(!zi || zi === "auto"){
336 cNode = cNode.parentNode;
337 }else{
338 var newZi = parseInt(zi, 10);
339 if(oldZi < newZi){
340 oldZi = newZi;
341 ziUl = newZi + 1;
342 ziIn = newZi + 1;
343 }
344 // Keep looking until we run out, we want the highest zIndex.
345 cNode = cNode.parentNode;
346 }
347 }
348 }
349 }
350 }else{
351 // honor user-defined z-index
352 ziUl = parseInt(this.zIndex, 10);
353 ziIn = parseInt(this.zIndex, 10);
354 }
355
356 domStyle.set(this._centerNode, "zIndex", ziIn);
357 domStyle.set(this._underlayNode, "zIndex", ziUl);
358
359
360 var pn = target.parentNode;
361 if(pn && pn !== baseWindow.body() &&
362 target !== baseWindow.body() &&
363 target !== baseWindow.doc){
364
365 // If the parent is the body tag itself,
366 // we can avoid all this, the body takes
367 // care of overflow for me. Besides, browser
368 // weirdness with height and width on body causes
369 // problems with this sort of intersect testing
370 // anyway.
371 var obh = box.h;
372 var obw = box.w;
373 var pnBox = geometry.position(pn, true);
374
375 //More IE zoom corrections. Grr.
376 if(this._ieFixNode){
377 _ie7zoom = -this._ieFixNode.offsetTop / 1000;
378 pnBox.x = Math.floor((pnBox.x + 0.9) / _ie7zoom);
379 pnBox.y = Math.floor((pnBox.y + 0.9) / _ie7zoom);
380 pnBox.w = Math.floor((pnBox.w + 0.9) / _ie7zoom);
381 pnBox.h = Math.floor((pnBox.h + 0.9) / _ie7zoom);
382 }
383
384 //Shift the parent width/height a bit if scollers are present.
385 pnBox.w -= pn.scrollHeight > pn.clientHeight &&
386 pn.clientHeight > 0 ? scrollers.v: 0;
387 pnBox.h -= pn.scrollWidth > pn.clientWidth &&
388 pn.clientWidth > 0 ? scrollers.h: 0;
389
390 //RTL requires a bit of massaging in some cases
391 //(and differently depending on browser, ugh!)
392 //WebKit and others still need work.
393 if(dir === "rtl"){
394 if(has("opera")){
395 box.x += pn.scrollHeight > pn.clientHeight &&
396 pn.clientHeight > 0 ? scrollers.v: 0;
397 pnBox.x += pn.scrollHeight > pn.clientHeight &&
398 pn.clientHeight > 0 ? scrollers.v: 0;
399 }else if(has("ie")){
400 pnBox.x += pn.scrollHeight > pn.clientHeight &&
401 pn.clientHeight > 0 ? scrollers.v: 0;
402 }else if(has("webkit")){
403 //TODO: FIX THIS!
404 }
405 }
406
407 //Figure out if we need to adjust the overlay to fit a viewable
408 //area, then resize it, we saved the original height/width above.
409 //This is causing issues on IE. Argh!
410 if(pnBox.w < box.w){
411 //Scale down the width if necessary.
412 box.w = box.w - pnBox.w;
413 }
414 if(pnBox.h < box.h){
415 //Scale down the width if necessary.
416 box.h = box.h - pnBox.h;
417 }
418
419 //Look at the y positions and see if we intersect with the
420 //viewport borders. Will have to do computations off it.
421 var vpTop = pnBox.y;
422 var vpBottom = pnBox.y + pnBox.h;
423 var bTop = box.y;
424 var bBottom = box.y + obh;
425 var vpLeft = pnBox.x;
426 var vpRight = pnBox.x + pnBox.w;
427 var bLeft = box.x;
428 var bRight = box.x + obw;
429 var delta;
430 //Adjust the height now
431 if(bBottom > vpTop &&
432 bTop < vpTop){
433 box.y = pnBox.y;
434 //intersecting top, need to do some shifting.
435 delta = vpTop - bTop;
436 var visHeight = obh - delta;
437 //If the visible height < viewport height,
438 //We need to shift it.
439 if(visHeight < pnBox.h){
440 box.h = visHeight;
441 }else{
442 //Deal with horizontal scrollbars if necessary.
443 box.h -= 2*(pn.scrollWidth > pn.clientWidth &&
444 pn.clientWidth > 0? scrollers.h: 0);
445 }
446 }else if(bTop < vpBottom && bBottom > vpBottom){
447 //Intersecting bottom, just figure out how much
448 //overlay to show.
449 box.h = vpBottom - bTop;
450 }else if(bBottom <= vpTop || bTop >= vpBottom){
451 //Outside view, hide it.
452 box.h = 0;
453 }
454
455 //adjust width
456 if(bRight > vpLeft && bLeft < vpLeft){
457 box.x = pnBox.x;
458 //intersecting left, need to do some shifting.
459 delta = vpLeft - bLeft;
460 var visWidth = obw - delta;
461 //If the visible width < viewport width,
462 //We need to shift it.
463 if(visWidth < pnBox.w){
464 box.w = visWidth;
465 }else{
466 //Deal with horizontal scrollbars if necessary.
467 box.w -= 2*(pn.scrollHeight > pn.clientHeight &&
468 pn.clientHeight > 0? scrollers.w:0);
469 }
470 }else if(bLeft < vpRight && bRight > vpRight){
471 //Intersecting right, just figure out how much
472 //overlay to show.
473 box.w = vpRight - bLeft;
474 }else if(bRight <= vpLeft || bLeft >= vpRight){
475 //Outside view, hide it.
476 box.w = 0;
477 }
478 }
479
480 if(box.h > 0 && box.w > 0){
481 //Set position and size of the blocking div overlay.
482 domStyle.set(this._underlayNode, {
483 display: "block",
484 width: box.w + "px",
485 height: box.h + "px",
486 top: box.y + "px",
487 left: box.x + "px"
488 });
489
490 var styles = ["borderRadius", "borderTopLeftRadius",
491 "borderTopRightRadius","borderBottomLeftRadius",
492 "borderBottomRightRadius"];
493 this._cloneStyles(styles);
494 if(!has("ie")){
495 //Browser specific styles to try and clone if non-IE.
496 styles = ["MozBorderRadius", "MozBorderRadiusTopleft",
497 "MozBorderRadiusTopright","MozBorderRadiusBottomleft",
498 "MozBorderRadiusBottomright","WebkitBorderRadius",
499 "WebkitBorderTopLeftRadius", "WebkitBorderTopRightRadius",
500 "WebkitBorderBottomLeftRadius","WebkitBorderBottomRightRadius"
501 ];
502 this._cloneStyles(styles, this);
503 }
504 var cntrIndicatorTop = (box.h/2) - (cntrIndicator.h/2);
505 var cntrIndicatorLeft = (box.w/2) - (cntrIndicator.w/2);
506 //Only show the image if there is height and width room.
507 if(box.h >= cntrIndicator.h && box.w >= cntrIndicator.w){
508 domStyle.set(this._centerNode, {
509 top: (cntrIndicatorTop + box.y) + "px",
510 left: (cntrIndicatorLeft + box.x) + "px",
511 display: "block"
512 });
513 }else{
514 domStyle.set(this._centerNode, "display", "none");
515 }
516 }else{
517 //Target has no size, display nothing on it!
518 domStyle.set(this._underlayNode, "display", "none");
519 domStyle.set(this._centerNode, "display", "none");
520 }
521 if(this._resizeCheck === null){
522 //Set an interval timer that checks the target size and scales as needed.
523 //Checking every 10th of a second seems to generate a fairly smooth update.
524 var self = this;
525 this._resizeCheck = setInterval(function(){self._size();}, 100);
526 }
527 }
528 },
529
530 _cloneStyles: function(list){
531 // summary:
532 // Internal function to clone a set of styles from the target to
533 // the underlay.
534 // list: Array
535 // An array of style names to clone.
536 //
537 // tags:
538 // private
539 array.forEach(list, function(s){
540 domStyle.set(this._underlayNode, s, domStyle.get(this.target, s));
541 }, this);
542 },
543
544 _fadeIn: function(){
545 // summary:
546 // Internal function that does the opacity style fade in animation.
547 // tags:
548 // private
549 var self = this;
550 var underlayNodeAnim = baseFx.animateProperty({
551 duration: self.duration,
552 node: self._underlayNode,
553 properties: {opacity: {start: 0, end: self.opacity}}
554 });
555 var imageAnim = baseFx.animateProperty({
556 duration: self.duration,
557 node: self._centerNode,
558 properties: {opacity: {start: 0, end: 1}},
559 onEnd: function(){
560 self.onShow();
561 delete self._anim;
562 }
563 });
564 this._anim = fx.combine([underlayNodeAnim,imageAnim]);
565 this._anim.play();
566 },
567
568 _fadeOut: function(){
569 // summary:
570 // Internal function that does the opacity style fade out animation.
571 // tags:
572 // private
573 var self = this;
574 var underlayNodeAnim = baseFx.animateProperty({
575 duration: self.duration,
576 node: self._underlayNode,
577 properties: {opacity: {start: self.opacity, end: 0}},
578 onEnd: function(){
579 domStyle.set(this.node,{"display":"none", "zIndex": "-1000"});
580 }
581 });
582 var imageAnim = baseFx.animateProperty({
583 duration: self.duration,
584 node: self._centerNode,
585 properties: {opacity: {start: 1, end: 0}},
586 onEnd: function(){
587 domStyle.set(this.node,{"display":"none", "zIndex": "-1000"});
588 self.onHide();
589 self._enableOverflow();
590 delete self._anim;
591 }
592 });
593 this._anim = fx.combine([underlayNodeAnim,imageAnim]);
594 this._anim.play();
595 },
596
597 _ignore: function(e){
598 // summary:
599 // Function to ignore events that occur on the overlay.
600 // event: Event
601 // The event to halt
602 // tags:
603 // private
604 if(e){
605 event.stop(e);
606 }
607 },
608
609 _scrollerWidths: function(){
610 // summary:
611 // This function will calculate the size of the vertical and
612 // horizontaol scrollbars.
613 // returns:
614 // Object of form: {v: Number, h: Number} where v is vertical scrollbar width
615 // and h is horizontal scrollbar width.
616 // tags:
617 // private
618 var div = construct.create("div");
619 domStyle.set(div, {
620 position: "absolute",
621 opacity: 0,
622 overflow: "hidden",
623 width: "50px",
624 height: "50px",
625 zIndex: "-100",
626 top: "-200px",
627 padding: "0px",
628 margin: "0px"
629 });
630 var iDiv = construct.create("div");
631 domStyle.set(iDiv, {
632 width: "200px",
633 height: "10px"
634 });
635 div.appendChild(iDiv);
636 baseWindow.body().appendChild(div);
637
638 //Figure out content size before and after
639 //scrollbars are there, then just subtract to
640 //get width.
641 var b = geometry.getContentBox(div);
642 domStyle.set(div, "overflow", "scroll");
643 var a = geometry.getContentBox(div);
644 baseWindow.body().removeChild(div);
645 return { v: b.w - a.w, h: b.h - a.h };
646 },
647
648 /* The following are functions that tie into _Widget.attr() */
649
650 _setTextAttr: function(text){
651 // summary:
652 // Function to allow widget.attr to set the text displayed in center
653 // if using text display.
654 // text: String
655 // The text to set.
656 this._textNode.innerHTML = text;
657 this.text = text;
658 },
659
660 _setColorAttr: function(c){
661 // summary:
662 // Function to allow widget.attr to set the color used for the translucent
663 // div overlay.
664 // c: String
665 // The color to set the background underlay to in #XXXXXX format..
666 domStyle.set(this._underlayNode, "backgroundColor", c);
667 this.color = c;
668 },
669
670 _setImageTextAttr: function(text){
671 // summary:
672 // Function to allow widget.attr to set the ALT text text displayed for
673 // the image (if using image center display).
674 // text: String
675 // The text to set.
676 attr.set(this._imageNode, "alt", text);
677 this.imageText = text;
678 },
679
680 _setImageAttr: function(url){
681 // summary:
682 // Function to allow widget.attr to set the url source for the center image
683 // text: String
684 // The url to set for the image.
685 attr.set(this._imageNode, "src", url);
686 this.image = url;
687 },
688
689 _setCenterIndicatorAttr: function(indicator){
690 // summary:
691 // Function to allow widget.attr to set the node used for the center indicator,
692 // either the image or the text.
693 // indicator: String
694 // The indicator to use, either 'image' or 'text'.
695 this.centerIndicator = indicator;
696 if(indicator === "image"){
697 this._centerNode = this._imageNode;
698 domStyle.set(this._textNode, "display", "none");
699 }else{
700 this._centerNode = this._textNode;
701 domStyle.set(this._imageNode, "display", "none");
702 }
703 },
704
705 _setTargetAttr:function(target){
706 // summary:
707 // Function to allow widget.attr to set the target used
708 // target: String
709 // The target to use.
710 if(typeof target === "string"){
711 var w = registry.byId(target);
712 this._set("target", w ? w.domNode : dom.byId(target));
713 }
714 else {
715 this._set("target", target);
716 }
717 },
718
719 _disableOverflow: function(){
720 // summary:
721 // Function to disable scrollbars on the body. Only used if the overlay
722 // targets the body or the document.
723 if(this.target === baseWindow.body() || this.target === baseWindow.doc){
724 // Store the overflow state we have to restore later.
725 // IE had issues, so have to check that it's defined. Ugh.
726 this._overflowDisabled = true;
727 var body = baseWindow.body();
728 if(body.style && body.style.overflow){
729 this._oldOverflow = domStyle.get(body, "overflow");
730 }else{
731 this._oldOverflow = "";
732 }
733 if(has("ie") && !has("quirks")){
734 // IE will put scrollbars in anyway, html (parent of body)
735 // also controls them in standards mode, so we have to
736 // remove them, argh.
737 if(body.parentNode &&
738 body.parentNode.style &&
739 body.parentNode.style.overflow){
740 this._oldBodyParentOverflow = body.parentNode.style.overflow;
741 }else{
742 try{
743 this._oldBodyParentOverflow = domStyle.get(body.parentNode, "overflow");
744 }catch(e){
745 this._oldBodyParentOverflow = "scroll";
746 }
747 }
748 domStyle.set(body.parentNode, "overflow", "hidden");
749 }
750 domStyle.set(body, "overflow", "hidden");
751 }
752 },
753
754 _enableOverflow: function(){
755 // summary:
756 // Function to restore scrollbars on the body. Only used if the overlay
757 // targets the body or the document.
758 if(this._overflowDisabled){
759 delete this._overflowDisabled;
760 var body = baseWindow.body();
761 // Restore all the overflow.
762 if(has("ie") && !has("quirks")){
763 body.parentNode.style.overflow = this._oldBodyParentOverflow;
764 delete this._oldBodyParentOverflow;
765 }
766 domStyle.set(body, "overflow", this._oldOverflow);
767 if(has("webkit")){
768 //Gotta poke WebKit, or scrollers don't come back. :-(
769 var div = construct.create("div", { style: {
770 height: "2px"
771 }
772 });
773 body.appendChild(div);
774 setTimeout(function(){
775 body.removeChild(div);
776 }, 0);
777 }
778 delete this._oldOverflow;
779 }
780 }
781 });
782
783 });