From 7c635b114d7a7ae314febecf0869747ac614284e Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 13 Apr 2011 14:34:08 -0400 Subject: [PATCH] [#380] Fix getBoundingClientRect() --- players/soundcloud/popcorn.soundcloud.js | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/players/soundcloud/popcorn.soundcloud.js b/players/soundcloud/popcorn.soundcloud.js index 04e8b3c..b466813 100644 --- a/players/soundcloud/popcorn.soundcloud.js +++ b/players/soundcloud/popcorn.soundcloud.js @@ -584,9 +584,40 @@ }, timeupdateInterval); } }, + getBoundingClientRect: function() { - return !this.swfObj || this.swfObj.getBoundingClientRect(); + var b, + self = this; + + if ( this.swfObj ) { + b = this.swfObj.getBoundingClientRect(); + + return { + bottom: b.bottom, + left: b.left, + right: b.right, + top: b.top, + + // These not guaranteed to be in there + width: b.width || ( b.right - b.left ), + height: b.height || ( b.bottom - b.top ) + }; + } else { + //container = document.getElementById( this.playerId ); + tmp = this._container.getBoundingClientRect(); + + // Update bottom, right for expected values once the container loads + return { + left: tmp.left, + top: tmp.top, + width: self.offsetWidth, + height: self.offsetHeight, + bottom: tmp.top + this.width, + right: tmp.top + this.height + }; + } }, + registerPopcornWithPlayer: function( popcorn ) { if ( !this.swfObj ) { this.addEventListener( "load", function() { -- 2.43.0