mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-27 19:47:42 +01:00
1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
|
function getAnchorPosition(a){var b=new Object,c=0,d=0,e=!1,f=!1,g=!1;if(document.getElementById?e=!0:document.all?f=!0:document.layers&&(g=!0),e&&document.all)c=AnchorPosition_getPageOffsetLeft(document.all[a]),d=AnchorPosition_getPageOffsetTop(document.all[a]);else if(e){var h=document.getElementById(a);c=AnchorPosition_getPageOffsetLeft(h),d=AnchorPosition_getPageOffsetTop(h)}else if(f)c=AnchorPosition_getPageOffsetLeft(document.all[a]),d=AnchorPosition_getPageOffsetTop(document.all[a]);else{if(!g)return b.x=0,b.y=0,b;for(var i=0,j=0;j<document.anchors.length;j++)if(document.anchors[j].name==a){i=1;break}if(0==i)return b.x=0,b.y=0,b;c=document.anchors[j].x,d=document.anchors[j].y}return b.x=c,b.y=d,b}function getAnchorWindowPosition(a){var b=getAnchorPosition(a),c=0,d=0;return document.getElementById?isNaN(window.screenX)?(c=b.x-document.body.scrollLeft+window.screenLeft,d=b.y-document.body.scrollTop+window.screenTop):(c=b.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset,d=b.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset):document.all?(c=b.x-document.body.scrollLeft+window.screenLeft,d=b.y-document.body.scrollTop+window.screenTop):document.layers&&(c=b.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset,d=b.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset),b.x=c,b.y=d,b}function AnchorPosition_getPageOffsetLeft(a){for(var b=a.offsetLeft;null!=(a=a.offsetParent);)b+=a.offsetLeft;return b}function AnchorPosition_getWindowOffsetLeft(a){return AnchorPosition_getPageOffsetLeft(a)-document.body.scrollLeft}function AnchorPosition_getPageOffsetTop(a){for(var b=a.offsetTop;null!=(a=a.offsetParent);)b+=a.offsetTop;return b}function AnchorPosition_getWindowOffsetTop(a){return AnchorPosition_getPageOffsetTop(a)-document.body.scrollTop}function PopupWindow_getXYPosition(a){var b;b="WINDOW"==this.type?getAnchorWindowPosition(a):getAnchorPosition(a),this.x=b.x,this.y=b.y}function PopupWindow_setSize(a,b){this.width=a,this.height=b}function PopupWindow_populate(a){this.contents=a,this.populated=!1}function PopupWindow_setUrl(a){this.url=a}function PopupWindow_setWindowProperties(a){this.windowProperties=a}function PopupWindow_refresh(){if(null!=this.divName){if(this.use_gebi)document.getElementById(this.divName).innerHTML=this.contents;else if(this.use_css)document.all[this.divName].innerHTML=this.contents;else if(this.use_layers){var a=document.layers[this.divName];a.document.open(),a.document.writeln(this.contents),a.document.close()}}else null==this.popupWindow||this.popupWindow.closed||(""!=this.url?this.popupWindow.location.href=this.url:(this.popupWindow.document.open(),this.popupWindow.document.writeln(this.contents),this.popupWindow.document.close()),this.popupWindow.focus())}function PopupWindow_showPopup(a){if(this.getXYPosition(a),this.x+=this.offsetX,this.y+=this.offsetY,this.populated||""==this.contents||(this.populated=!0,this.refresh()),null!=this.divName)this.use_gebi?(document.getElementById(this.divName).style.left=this.x+"px",document.getElementById(this.divName).style.top=this.y,document.getElementById(this.divName).style.visibility="visible"):this.use_css?(document.all[this.divName].style.left=this.x,document.all[this.divName].style.top=this.y,document.all[this.divName].style.visibility="visible"):this.use_layers&&(document.layers[this.divName].left=this.x,document.layers[this.divName].top=this.y,document.layers[this.divName].visibility="visible");else{if(null==this.popupWindow||this.popupWindow.closed){this.x<0&&(this.x=0),this.y<0&&(this.y=0),screen&&screen.availHeight&&this.y+this.height>screen.availHeight&&(this.y=screen.availHeight-this.height),screen&&screen.availWidth&&this.x+this.width>screen.availWidth&&(this.x=screen.availWidth-this.width);var b=window.opera||document.layers&&!navigator.mimeTypes["*"]||"KDE"==navigator.vendor||document.childNodes&&!document.all&&!navigator.taintEnabled;this.popupWindow=window.open(b?"":"about:blank","window_"+a,this.windowProperties+",width="+this.width+",height
|