Created
February 26, 2013 14:13
-
-
Save thinkphp/5038692 to your computer and use it in GitHub Desktop.
lastfm plugin for cui2 AMD
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
| 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