Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created February 25, 2013 08:26
Show Gist options
  • Select an option

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

Select an option

Save thinkphp/5028500 to your computer and use it in GitHub Desktop.
last.fm Badge based on CUI micro-framework, Script Loader use.js, cui.yql Client and YQL Open Data Table.
use.path("scripts/")
use(["cui","dom","yql"], function(){
var lastfm = function() {
var user = 'thinkphp',
url;
function init() {
var href = cui.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() {
cui.yql(url, function( data ){
cui.dom.select("#result").html(data.query.results.result)
})
}
return{init: init, and: and, render: render}
}();
lastfm.init().and().render();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment