From: ScottDowne
Date: Tue, 8 Mar 2011 18:54:44 +0000 (-0500)
Subject: [#340] lastfm global scope should now be empty, including the lastfm callback. Using...
X-Git-Tag: v0.4~11^2
X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=077e064aa6c8e8b91d99b8c8d15fe017005c1e9d;p=popcorn-js.git
[#340] lastfm global scope should now be empty, including the lastfm callback. Using getJSONP instead of getScript
---
diff --git a/plugins/lastfm/popcorn.lastfm.js b/plugins/lastfm/popcorn.lastfm.js
index c156a6c..d0b3bab 100644
--- a/plugins/lastfm/popcorn.lastfm.js
+++ b/plugins/lastfm/popcorn.lastfm.js
@@ -1,31 +1,32 @@
// PLUGIN: LASTFM
- var _artists = [],
- lastFMcallback = function(data){
- if (data.artist) {
- var htmlString = ''+data.artist.name+'
';
- htmlString += '
';
- htmlString += ''+ data.artist.bio.summary +'
';
- htmlString += '
Tags
';
-
- Popcorn.forEach( data.artist.tags.tag, function( val, i) {
- htmlString += '- '+ val.name +'
';
- });
-
- htmlString += '
';
- htmlString += '
Similar
';
-
- Popcorn.forEach( data.artist.similar.artist, function( val, i) {
- htmlString += '- '+ val.name +'
';
- });
-
- htmlString += '
';
-
- _artists[data.artist.name.toLowerCase()] = htmlString;
- }
- };
(function (Popcorn) {
-
+
+ var _artists = [],
+ lastFMcallback = function(data){
+ if (data.artist) {
+ var htmlString = ''+data.artist.name+'
';
+ htmlString += '
';
+ htmlString += ''+ data.artist.bio.summary +'
';
+ htmlString += '
Tags
';
+
+ Popcorn.forEach( data.artist.tags.tag, function( val, i) {
+ htmlString += '- '+ val.name +'
';
+ });
+
+ htmlString += '
';
+ htmlString += '
Similar
';
+
+ Popcorn.forEach( data.artist.similar.artist, function( val, i) {
+ htmlString += '- '+ val.name +'
';
+ });
+
+ htmlString += '
';
+
+ _artists[data.artist.name.toLowerCase()] = htmlString;
+ }
+ };
+
/**
* LastFM popcorn plug-in
* Appends information about a LastFM artist to an element on the page.
@@ -83,7 +84,7 @@
if(!_artists[options.artist]) {
_artists[options.artist] = "Unknown Artist";
- Popcorn.getScript("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="+ options.artist +"&api_key="+options.apikey+"&format=json&callback=lastFMcallback");
+ Popcorn.getJSONP("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="+ options.artist +"&api_key="+options.apikey+"&format=json&callback=lastFMcallback", lastFMcallback, false );
}