From: stevenaw Date: Tue, 19 Apr 2011 19:25:43 +0000 (-0400) Subject: [#380] Soundcloud updated to remove data-* X-Git-Tag: v0.5~1^2~5 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=0813567d6030d83eef9ba21554ef41ca1be1731b;p=popcorn-js.git [#380] Soundcloud updated to remove data-* --- diff --git a/players/soundcloud/popcorn.soundcloud.html b/players/soundcloud/popcorn.soundcloud.html index c22c370..a575711 100644 --- a/players/soundcloud/popcorn.soundcloud.html +++ b/players/soundcloud/popcorn.soundcloud.html @@ -59,6 +59,7 @@ It is to be used for demonstration purposes only, and for only this demo */ api_key: "PRaNFlda6Bhf5utPjUsptg", + src: "http://soundcloud.com/forss/flickermood", commentdiv: "commentDisplay", commentformat: (function() { var count = 0; @@ -160,7 +161,7 @@ -

+

diff --git a/players/soundcloud/popcorn.soundcloud.js b/players/soundcloud/popcorn.soundcloud.js index b466813..23eaa25 100644 --- a/players/soundcloud/popcorn.soundcloud.js +++ b/players/soundcloud/popcorn.soundcloud.js @@ -333,10 +333,14 @@ bounds = container.getBoundingClientRect(), tmp, undef; + + if ( !options.src ) { + throw "An audio source must be supplied!"; + } - that.width = options.width || container.getAttribute( "data-width" ) || getStyle( container, "width" ) || "100%"; - that.height = options.height || container.getAttribute( "data-height" ) || getStyle( container, "height" ) || "81px"; - that.src = options.src || container.getAttribute( "data-src" ); + that.width = options.width || getStyle( container, "width" ) || "100%"; + that.height = options.height || getStyle( container, "height" ) || "81px"; + that.src = options.src; that.autoplay = container.getAttribute( "data-autoplay" ) || undef; if ( parseFloat( that.height, 10 ) !== 81 ) { diff --git a/players/soundcloud/popcorn.soundcloud.unit.html b/players/soundcloud/popcorn.soundcloud.unit.html index dc2e486..5ab3489 100644 --- a/players/soundcloud/popcorn.soundcloud.unit.html +++ b/players/soundcloud/popcorn.soundcloud.unit.html @@ -36,8 +36,8 @@
    -
    -
    +
    +
    diff --git a/players/soundcloud/popcorn.soundcloud.unit.js b/players/soundcloud/popcorn.soundcloud.unit.js index 7246058..a74b070 100644 --- a/players/soundcloud/popcorn.soundcloud.unit.js +++ b/players/soundcloud/popcorn.soundcloud.unit.js @@ -64,7 +64,7 @@ test( "API", function () { }); test( "Default Attribute Functionality", function () { - var expects = 7, + var expects = 5, count = 0, playerDefault, playerOverride, @@ -101,7 +101,9 @@ test( "Default Attribute Functionality", function () { expect( expects ); stop( 10000 ); - playerDefault = Popcorn.soundcloud( "player_2" ); + playerDefault = Popcorn.soundcloud( "player_2", { + src: "http://soundcloud.com/forss/flickermood" + }); playerOverride = Popcorn.soundcloud( "player_2", { height: "100px", width: '90%', @@ -135,18 +137,12 @@ test( "Default Attribute Functionality", function () { equals( playerOverride.height, "81px", "Height has been overridden to 100px, but set back again to 81px" ); plus(); - - notEqual( playerOverride.src, document.getElementById( "player_2" ).getAttribute( "data-src" ), "Source has been overridden" ); - plus(); - - equals( playerOverride.src, "http://soundcloud.com/forss/journeyman", "Source is set correctly" ); - plus(); }); test( "Player Volume Control", function () { var expects = 3, count = 0, - player = Popcorn.soundcloud( "player_1" ), + player = Popcorn.soundcloud( "player_1", { src: "http://soundcloud.com/forss/flickermood" } ), targetVolume, startVolume; @@ -190,13 +186,14 @@ test( "Testing Comments", function() { cmtDate = new Date(), comment, players = { - player1: Popcorn.soundcloud( "player_1" ), + player1: Popcorn.soundcloud( "player_1", { src: "http://soundcloud.com/forss/flickermood" } ), player2: Popcorn.soundcloud( "player_2", { + src: "http://soundcloud.com/forss/flickermood", commentformat: function( comment ) { return comment.text } }), - player3: Popcorn.soundcloud( "player_1" ) + player3: Popcorn.soundcloud( "player_1", { src: "http://soundcloud.com/forss/flickermood" } ) } // Expecteed comment output commentOutput = { @@ -257,7 +254,7 @@ test( "Testing Comments", function() { test( "Popcorn Integration", function () { var expects = 4, count = 0, - player = Popcorn.soundcloud( "player_1" ); + player = Popcorn.soundcloud( "player_1", { src: "http://soundcloud.com/forss/flickermood" } ); function plus() { if ( ++count === expects ) { @@ -300,7 +297,7 @@ test( "Popcorn Integration", function () { test( "Events and Player Control", function () { var expects = 14, count = 0, - player = Popcorn.soundcloud( "player_1" ), + player = Popcorn.soundcloud( "player_1", { src: "http://soundcloud.com/forss/flickermood" } ), targetVolume; function plus() {