From 077e064aa6c8e8b91d99b8c8d15fe017005c1e9d Mon Sep 17 00:00:00 2001 From: ScottDowne Date: Tue, 8 Mar 2011 13:54:44 -0500 Subject: [PATCH] [#340] lastfm global scope should now be empty, including the lastfm callback. Using getJSONP instead of getScript --- plugins/lastfm/popcorn.lastfm.js | 53 ++++++++++++++++---------------- 1 file changed, 27 insertions(+), 26 deletions(-) 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

'; - htmlString += '

Similar

'; - - _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

'; + htmlString += '

Similar

'; + + _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 ); } -- 2.43.0