diff options
author | Andreas Unterkircher <unki@netshadow.at> | 2008-03-27 22:59:06 +0100 |
---|---|---|
committer | Andreas Unterkircher <unki@netshadow.at> | 2008-03-27 22:59:06 +0100 |
commit | af0be8f9546fb5dec947be33e465bb6d9e85d0a7 (patch) | |
tree | 46fa7f026d861e54753e78ac8265563b0ddfca36 /autocomplete/js/getobject2.js | |
parent | 2b589908f4624b0ee41217f21d5b0b7cb383d38c (diff) |
issue111, first try of auto completion for tag search box
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
Diffstat (limited to 'autocomplete/js/getobject2.js')
-rw-r--r-- | autocomplete/js/getobject2.js | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/autocomplete/js/getobject2.js b/autocomplete/js/getobject2.js new file mode 100644 index 0000000..d8125c5 --- /dev/null +++ b/autocomplete/js/getobject2.js @@ -0,0 +1,126 @@ +//misc objects +//a simple encapsulation object +//used to query widths and heights + +function cDomObject( sId ) +{ + if( bw.dom || bw.ie ) + { + this.hElement = document.getElementById( sId ) + this.hStyle = this.hElement.style + } +} + +cDomObject.prototype.getWidth = function( ) +{ + return cDomObject.getWidth( this.hElement ) +} + +cDomObject.getWidth = function( hElement ) +{ + if( hElement.currentStyle ) + { + var nWidth = parseInt( hElement.currentStyle.width ) + if( isNaN( nWidth ) ) + { + return parseInt( hElement.offsetWidth ) + } + else + { + return nWidth + } + } + else + { + return parseInt( hElement.offsetWidth ) + } +} + +cDomObject.prototype.getHeight = function( ) +{ + return cDomObject.getHeight( this.hElement ) +} + +cDomObject.getHeight = function( hElement ) +{ + if( hElement.currentStyle ) + { + var nHeight = parseInt( hElement.currentStyle.height ) + if( isNaN( nHeight ) ) + { + return parseInt( hElement.offsetHeight ) + } + else + { + return nHeight + } + } + else + { + return parseInt( hElement.offsetHeight ) + } +} + +cDomObject.prototype.getLeft = function() +{ + return cDomObject.getLeft( this.hElement ) +} + +cDomObject.getLeft = function( hElement ) +{ + return parseInt( hElement.offsetLeft ) +} + +cDomObject.prototype.getTop = function( ) +{ + return cDomObject.getTop( this.hElement ) +} + +cDomObject.getTop = function( hElement ) +{ + return parseInt( hElement.offsetTop ) +} + + +// used to get the absolute position of an relativeli position element +// by accumulating the offset parameters +// example +// cDomObject.getOffsetParam( hElement,'offsetLeft' ) + +cDomObject.getOffsetParam = function( hElement, sParam, hLimitParent ) +{ + var nRes = 0 + if( hLimitParent == null ) + { + hLimitParent = document.body.parentElement + } + while( hElement != hLimitParent ) + { + nRes += eval( 'hElement.' + sParam ) + if( !hElement.offsetParent ) { break } + hElement = hElement.offsetParent + } + return nRes +} + + +// used to get the absolute position of an relativeli position element +// by accumulating the scroll offset parameters +// example +// cDomObject.getScrollOffset( hElement,'Left' ) + +cDomObject.getScrollOffset = function( hElement, sParam, hLimitParent ) +{ + nRes = 0 + if( hLimitParent == null ) + { + hLimitParent = document.body.parentElement + } + while( hElement != hLimitParent ) + { + nRes += eval( 'hElement.scroll' + sParam ) + if( !hElement.offsetParent ) { break } + hElement = hElement.parentNode + } + return nRes +}
\ No newline at end of file |