You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
2.7 KiB
114 lines
2.7 KiB
13 years ago
|
/*
|
||
|
Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
|
||
|
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
|
see: http://dojotoolkit.org/license for details
|
||
|
*/
|
||
|
|
||
|
|
||
|
if(!dojo._hasResource["dojo.window"]){
|
||
|
dojo._hasResource["dojo.window"]=true;
|
||
|
dojo.provide("dojo.window");
|
||
|
dojo.getObject("window",true,dojo);
|
||
|
dojo.window.getBox=function(){
|
||
|
var _1=(dojo.doc.compatMode=="BackCompat")?dojo.body():dojo.doc.documentElement;
|
||
|
var _2=dojo._docScroll();
|
||
|
return {w:_1.clientWidth,h:_1.clientHeight,l:_2.x,t:_2.y};
|
||
|
};
|
||
|
dojo.window.get=function(_3){
|
||
|
if(dojo.isIE&&window!==document.parentWindow){
|
||
|
_3.parentWindow.execScript("document._parentWindow = window;","Javascript");
|
||
|
var _4=_3._parentWindow;
|
||
|
_3._parentWindow=null;
|
||
|
return _4;
|
||
|
}
|
||
|
return _3.parentWindow||_3.defaultView;
|
||
|
};
|
||
|
dojo.window.scrollIntoView=function(_5,_6){
|
||
|
try{
|
||
|
_5=dojo.byId(_5);
|
||
|
var _7=_5.ownerDocument||dojo.doc,_8=_7.body||dojo.body(),_9=_7.documentElement||_8.parentNode,_a=dojo.isIE,_b=dojo.isWebKit;
|
||
|
if((!(dojo.isMoz||_a||_b||dojo.isOpera)||_5==_8||_5==_9)&&(typeof _5.scrollIntoView!="undefined")){
|
||
|
_5.scrollIntoView(false);
|
||
|
return;
|
||
|
}
|
||
|
var _c=_7.compatMode=="BackCompat",_d=(_a>=9&&_5.ownerDocument.parentWindow.frameElement)?((_9.clientHeight>0&&_9.clientWidth>0&&(_8.clientHeight==0||_8.clientWidth==0||_8.clientHeight>_9.clientHeight||_8.clientWidth>_9.clientWidth))?_9:_8):(_c?_8:_9),_e=_b?_8:_d,_f=_d.clientWidth,_10=_d.clientHeight,rtl=!dojo._isBodyLtr(),_11=_6||dojo.position(_5),el=_5.parentNode,_12=function(el){
|
||
|
return ((_a<=6||(_a&&_c))?false:(dojo.style(el,"position").toLowerCase()=="fixed"));
|
||
|
};
|
||
|
if(_12(_5)){
|
||
|
return;
|
||
|
}
|
||
|
while(el){
|
||
|
if(el==_8){
|
||
|
el=_e;
|
||
|
}
|
||
|
var _13=dojo.position(el),_14=_12(el);
|
||
|
if(el==_e){
|
||
|
_13.w=_f;
|
||
|
_13.h=_10;
|
||
|
if(_e==_9&&_a&&rtl){
|
||
|
_13.x+=_e.offsetWidth-_13.w;
|
||
|
}
|
||
|
if(_13.x<0||!_a){
|
||
|
_13.x=0;
|
||
|
}
|
||
|
if(_13.y<0||!_a){
|
||
|
_13.y=0;
|
||
|
}
|
||
|
}else{
|
||
|
var pb=dojo._getPadBorderExtents(el);
|
||
|
_13.w-=pb.w;
|
||
|
_13.h-=pb.h;
|
||
|
_13.x+=pb.l;
|
||
|
_13.y+=pb.t;
|
||
|
var _15=el.clientWidth,_16=_13.w-_15;
|
||
|
if(_15>0&&_16>0){
|
||
|
_13.w=_15;
|
||
|
_13.x+=(rtl&&(_a||el.clientLeft>pb.l))?_16:0;
|
||
|
}
|
||
|
_15=el.clientHeight;
|
||
|
_16=_13.h-_15;
|
||
|
if(_15>0&&_16>0){
|
||
|
_13.h=_15;
|
||
|
}
|
||
|
}
|
||
|
if(_14){
|
||
|
if(_13.y<0){
|
||
|
_13.h+=_13.y;
|
||
|
_13.y=0;
|
||
|
}
|
||
|
if(_13.x<0){
|
||
|
_13.w+=_13.x;
|
||
|
_13.x=0;
|
||
|
}
|
||
|
if(_13.y+_13.h>_10){
|
||
|
_13.h=_10-_13.y;
|
||
|
}
|
||
|
if(_13.x+_13.w>_f){
|
||
|
_13.w=_f-_13.x;
|
||
|
}
|
||
|
}
|
||
|
var l=_11.x-_13.x,t=_11.y-Math.max(_13.y,0),r=l+_11.w-_13.w,bot=t+_11.h-_13.h;
|
||
|
if(r*l>0){
|
||
|
var s=Math[l<0?"max":"min"](l,r);
|
||
|
if(rtl&&((_a==8&&!_c)||_a>=9)){
|
||
|
s=-s;
|
||
|
}
|
||
|
_11.x+=el.scrollLeft;
|
||
|
el.scrollLeft+=s;
|
||
|
_11.x-=el.scrollLeft;
|
||
|
}
|
||
|
if(bot*t>0){
|
||
|
_11.y+=el.scrollTop;
|
||
|
el.scrollTop+=Math[t<0?"max":"min"](t,bot);
|
||
|
_11.y-=el.scrollTop;
|
||
|
}
|
||
|
el=(el!=_e)&&!_14&&el.parentNode;
|
||
|
}
|
||
|
}
|
||
|
catch(error){
|
||
|
console.error("scrollIntoView: "+error);
|
||
|
_5.scrollIntoView(false);
|
||
|
}
|
||
|
};
|
||
|
}
|