Created
February 25, 2013 08:26
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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