| 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 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
image: require.toUrl("dojox/widget/Standby/images/loading.gif").toString(), |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
imageText: "Please Wait...", |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
text: "Please wait...", |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
centerIndicator: "image", |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
target: "", |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
color: "#C0C0C0", |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
duration: 500, |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
zIndex: "auto", |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
opacity: 0.75, |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 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 |
|
| 111 |
|
| 112 |
|
| 113 |
_underlayNode: null, |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
_imageNode: null, |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
_textNode: null, |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
_centerNode: null, |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
_displayed: false, |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
_resizeCheck: null, |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
_started: false, |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
_parent: null, |
| 143 |
|
| 144 |
startup: function(args){ |
| 145 |
|
| 146 |
|
| 147 |
|
| 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 |
|
| 172 |
|
| 173 |
|
| 174 |
if(this.domNode.parentNode && this.domNode.parentNode != baseWindow.body()){ |
| 175 |
baseWindow.body().appendChild(this.domNode); |
| 176 |
} |
| 177 |
|
| 178 |
|
| 179 |
|
| 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 |
|
| 196 |
|
| 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 |
|
| 211 |
|
| 212 |
if(this._displayed){ |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 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 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
return this._displayed; |
| 242 |
}, |
| 243 |
|
| 244 |
onShow: function(){ |
| 245 |
|
| 246 |
|
| 247 |
}, |
| 248 |
|
| 249 |
onHide: function(){ |
| 250 |
|
| 251 |
|
| 252 |
}, |
| 253 |
|
| 254 |
uninitialize: function(){ |
| 255 |
|
| 256 |
|
| 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 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 307 |
|
| 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 |
|
| 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 |
|
| 324 |
ziUl = parseInt(ziUl, 10); |
| 325 |
ziIn = parseInt(ziIn, 10); |
| 326 |
}else{ |
| 327 |
|
| 328 |
|
| 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 |
|
| 345 |
cNode = cNode.parentNode; |
| 346 |
} |
| 347 |
} |
| 348 |
} |
| 349 |
} |
| 350 |
}else{ |
| 351 |
|
| 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 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
var obh = box.h; |
| 372 |
var obw = box.w; |
| 373 |
var pnBox = geometry.position(pn, true); |
| 374 |
|
| 375 |
|
| 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 |
|
| 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 |
|
| 391 |
|
| 392 |
|
| 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 |
|
| 404 |
} |
| 405 |
} |
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
if(pnBox.w < box.w){ |
| 411 |
|
| 412 |
box.w = box.w - pnBox.w; |
| 413 |
} |
| 414 |
if(pnBox.h < box.h){ |
| 415 |
|
| 416 |
box.h = box.h - pnBox.h; |
| 417 |
} |
| 418 |
|
| 419 |
|
| 420 |
|
| 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 |
|
| 431 |
if(bBottom > vpTop && |
| 432 |
bTop < vpTop){ |
| 433 |
box.y = pnBox.y; |
| 434 |
|
| 435 |
delta = vpTop - bTop; |
| 436 |
var visHeight = obh - delta; |
| 437 |
|
| 438 |
|
| 439 |
if(visHeight < pnBox.h){ |
| 440 |
box.h = visHeight; |
| 441 |
}else{ |
| 442 |
|
| 443 |
box.h -= 2*(pn.scrollWidth > pn.clientWidth && |
| 444 |
pn.clientWidth > 0? scrollers.h: 0); |
| 445 |
} |
| 446 |
}else if(bTop < vpBottom && bBottom > vpBottom){ |
| 447 |
|
| 448 |
|
| 449 |
box.h = vpBottom - bTop; |
| 450 |
}else if(bBottom <= vpTop || bTop >= vpBottom){ |
| 451 |
|
| 452 |
box.h = 0; |
| 453 |
} |
| 454 |
|
| 455 |
|
| 456 |
if(bRight > vpLeft && bLeft < vpLeft){ |
| 457 |
box.x = pnBox.x; |
| 458 |
|
| 459 |
delta = vpLeft - bLeft; |
| 460 |
var visWidth = obw - delta; |
| 461 |
|
| 462 |
|
| 463 |
if(visWidth < pnBox.w){ |
| 464 |
box.w = visWidth; |
| 465 |
}else{ |
| 466 |
|
| 467 |
box.w -= 2*(pn.scrollHeight > pn.clientHeight && |
| 468 |
pn.clientHeight > 0? scrollers.w:0); |
| 469 |
} |
| 470 |
}else if(bLeft < vpRight && bRight > vpRight){ |
| 471 |
|
| 472 |
|
| 473 |
box.w = vpRight - bLeft; |
| 474 |
}else if(bRight <= vpLeft || bLeft >= vpRight){ |
| 475 |
|
| 476 |
box.w = 0; |
| 477 |
} |
| 478 |
} |
| 479 |
|
| 480 |
if(box.h > 0 && box.w > 0){ |
| 481 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 518 |
domStyle.set(this._underlayNode, "display", "none"); |
| 519 |
domStyle.set(this._centerNode, "display", "none"); |
| 520 |
} |
| 521 |
if(this._resizeCheck === null){ |
| 522 |
|
| 523 |
|
| 524 |
var self = this; |
| 525 |
this._resizeCheck = setInterval(function(){self._size();}, 100); |
| 526 |
} |
| 527 |
} |
| 528 |
}, |
| 529 |
|
| 530 |
_cloneStyles: function(list){ |
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 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 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 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 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 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 |
|
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
if(e){ |
| 605 |
event.stop(e); |
| 606 |
} |
| 607 |
}, |
| 608 |
|
| 609 |
_scrollerWidths: function(){ |
| 610 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 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 |
|
| 639 |
|
| 640 |
|
| 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 |
|
| 649 |
|
| 650 |
_setTextAttr: function(text){ |
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
this._textNode.innerHTML = text; |
| 657 |
this.text = text; |
| 658 |
}, |
| 659 |
|
| 660 |
_setColorAttr: function(c){ |
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
domStyle.set(this._underlayNode, "backgroundColor", c); |
| 667 |
this.color = c; |
| 668 |
}, |
| 669 |
|
| 670 |
_setImageTextAttr: function(text){ |
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
|
| 675 |
|
| 676 |
attr.set(this._imageNode, "alt", text); |
| 677 |
this.imageText = text; |
| 678 |
}, |
| 679 |
|
| 680 |
_setImageAttr: function(url){ |
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
attr.set(this._imageNode, "src", url); |
| 686 |
this.image = url; |
| 687 |
}, |
| 688 |
|
| 689 |
_setCenterIndicatorAttr: function(indicator){ |
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 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 |
|
| 707 |
|
| 708 |
|
| 709 |
|
| 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 |
|
| 721 |
|
| 722 |
|
| 723 |
if(this.target === baseWindow.body() || this.target === baseWindow.doc){ |
| 724 |
|
| 725 |
|
| 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 |
|
| 735 |
|
| 736 |
|
| 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 |
|
| 756 |
|
| 757 |
|
| 758 |
if(this._overflowDisabled){ |
| 759 |
delete this._overflowDisabled; |
| 760 |
var body = baseWindow.body(); |
| 761 |
|
| 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 |
|
| 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 |
}); |