Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created February 26, 2013 14:13
Show Gist options
  • Select an option

  • Save thinkphp/5038692 to your computer and use it in GitHub Desktop.

Select an option

Save thinkphp/5038692 to your computer and use it in GitHub Desktop.
lastfm plugin for cui2 AMD
define("lastfm", ["cui", "dom", "event", "yql"], function(cui, dom, event, Y ){
var _lastfm = function() {
var user = 'thinkphp',
url;
function init() {
var href = dom.select("#lastFM a").toString().split("/");
var username = href [ href.length - 1 ] || user;
url = 'use "http://thinkphp.ro/apps/lastfm/YQL-open-data-table/recentlastfm.xml" as lastfm;select * from lastfm where username="'+ username +'" and api_key="2993c6e15c91a2890c2f11fa95673067"';
return this;
}
function and() {
return this;
}
function render() {
Y.yql(url, function( data ){
dom.select("#result").html( data.query.results.result )
})
}
return {init: init,
and: and,
render: render}
}();
return _lastfm;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment