]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#380] Soundcloud updated to remove data-*
authorstevenaw <sweerdenburg@gmail.com>
Tue, 19 Apr 2011 19:25:43 +0000 (15:25 -0400)
committerstevenaw <sweerdenburg@gmail.com>
Tue, 19 Apr 2011 19:25:43 +0000 (15:25 -0400)
players/soundcloud/popcorn.soundcloud.html
players/soundcloud/popcorn.soundcloud.js
players/soundcloud/popcorn.soundcloud.unit.html
players/soundcloud/popcorn.soundcloud.unit.js

index c22c370896c0c4c8da048094e1263c7180391daf..a575711b04db9c4b103fa9bc7f66ef1513e3b8e7 100644 (file)
@@ -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;
     </script>
   </head>
   <body>
-    <div id="media_1" data-width="" data-height="" data-src="http://soundcloud.com/forss/flickermood" ></div><br />
+    <div id="media_1" ></div><br />
       
     <div>
       <button class="simple" id="btnPlay">Play</button>
index b466813e49caebb499d05599472d5be98ea44e86..23eaa25eedda69b32387db1d790039e9fdb16468 100644 (file)
           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 ) {
index dc2e4869bc25089e756620bad7d7002cd24c1769..5ab34892fc92fd12314c24cbf213df2be35e23f2 100644 (file)
@@ -36,8 +36,8 @@
   <ol id="qunit-tests"></ol>
   <div id="qunit-fixture">  </div>
   
-  <div class="soundcloudPlayer" id="player_1" data-src="http://soundcloud.com/forss/flickermood" ></div>
-  <div class="soundcloudPlayer" id="player_2" data-src="http://soundcloud.com/forss/flickermood" data-width="790px" ></div>
+  <div class="soundcloudPlayer" id="player_1" ></div>
+  <div class="soundcloudPlayer" id="player_2" ></div>
   
 </body>
 </html>
index 724605880cb7b962d033bd4f711ba79bec5f24a5..a74b07077c1df32b8608f9923fcd8224a083132b 100644 (file)
@@ -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() {