]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
API Key configurable [#292]
authorstevenaw <sweerdenburg@gmail.com>
Tue, 25 Jan 2011 22:25:38 +0000 (17:25 -0500)
committerstevenaw <sweerdenburg@gmail.com>
Tue, 25 Jan 2011 22:25:38 +0000 (17:25 -0500)
plugins/lastfm/popcorn.lastfm.html
plugins/lastfm/popcorn.lastfm.js
plugins/lastfm/popcorn.lastfm.unit.js

index 5d0011d35347fb43149de457c16a797ec5f5bb62..0523c8efd9e8e1b485f59423bcf391d3692f48cc 100644 (file)
@@ -5,7 +5,7 @@
   
   <script src="../../popcorn.js"></script>
   <script src="popcorn.lastfm.js"></script>
-  <script>
+  <script> 
     document.addEventListener('DOMContentLoaded', function () {
       var p = Popcorn('#video')
       .play()
         start: 5, // seconds
         end: 15, // seconds
         artist: 'yacht',
-        target: 'lastfmdiv'
+        target: 'lastfmdiv',
+        apikey: '30ac38340e8be75f9268727cb4526b3d'
       } )
       .lastfm({
         start: 10, // seconds
         end: 20, // seconds
         artist: 'the beatles',
-        target: 'lastfmdiv'
+        target: 'lastfmdiv',
+        apikey: '30ac38340e8be75f9268727cb4526b3d'
       } )
       .lastfm({
         start: 15, // seconds
         end: 30, // seconds
         artist: 'sdfsdfsdfdsddfsdfsdfsddfsf',
-        target: 'lastfmdiv'
+        target: 'lastfmdiv',
+        apikey: '30ac38340e8be75f9268727cb4526b3d'
       } )
            .lastfm({
         start: 20, // seconds
         end: 45, // seconds
         artist: 'Coldplay',
-        target: 'lastfmdiv'
+        target: 'lastfmdiv',
+        apikey: '30ac38340e8be75f9268727cb4526b3d'
       } )
       .lastfm({
         start: 25, // seconds
         end: 40, // seconds
         artist: 'yacht',
-        target: 'lastfmdiv'
+        target: 'lastfmdiv',
+        apikey: '30ac38340e8be75f9268727cb4526b3d'
       } )
     }, false);
   </script>
index fc8a0fccc3b6b124fc68ce220f8bc3604b175126..fb54577295b3e31ff9f4e6e1761181a4107bd727 100644 (file)
@@ -14,7 +14,7 @@ var lastFMcallback;
    *  appended to, this target element must exist on the DOM
    * 
    * @param {Object} options
-   * 
+   *  
    * Example:
      var p = Popcorn('#video')
         .lastfm({
@@ -61,7 +61,7 @@ var lastFMcallback;
           var head = document.getElementsByTagName('head')[0];
           var script = document.createElement('script');
          
-          script.src = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="+ options.artist +"&api_key=30ac38340e8be75f9268727cb4526b3d&format=json&callback=lastFMcallback";
+          script.src = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="+ options.artist +"&api_key="+options.apikey+"&format=json&callback=lastFMcallback";
           script.type = "text/javascript";
           head.insertBefore( script, head.firstChild );
           
index 092984d1b8d88b0bd1436c067fd7f9071d48efbd..f319dd35e91d251381bb7fb5d4084b00daa6933a 100644 (file)
@@ -28,19 +28,22 @@ test("Popcorn LastFM Plugin", function () {
       start: 1, // seconds
       end: 4, // seconds
       artist: 'yacht',
-      target: 'lastfmdiv'
+      target: 'lastfmdiv',
+      apikey: '30ac38340e8be75f9268727cb4526b3d'
     } )
     .lastfm({
       start: 2.5, // seconds
       end: 7, // seconds
       artist: 'the beatles',
-      target: 'lastfmdiv'
+      target: 'lastfmdiv',
+      apikey: '30ac38340e8be75f9268727cb4526b3d'
     } )
     .lastfm({
       start: 4.5, // seconds
       end: 7, // seconds
       artist: '',
-      target: 'lastfmdiv'
+      target: 'lastfmdiv',
+      apikey: '30ac38340e8be75f9268727cb4526b3d'
     } );
 
   interval = setInterval( function() {