Skip to content

Instantly share code, notes, and snippets.

@meirish
Created October 15, 2011 18:52
Show Gist options
  • Save meirish/1289978 to your computer and use it in GitHub Desktop.
Save meirish/1289978 to your computer and use it in GitHub Desktop.
under _.template on both
<!DOCTYPE html>
<html>
<head>
<title>Rdio-Simple Example</title>
</head>
<body>
<a href="/logout">Log out of Rdio</a>
<p>Logged in as <%= firstName %></p>
<div id="player">
<div id="rdioSwf"></div>
<section class="track">
<% if (lastSongPlayed) { %>
<img src="<%= lastSongPlayed.icon %>"/>
<h1><%= lastSongPlayed.name %></h1>
<h2><%= lastSongPlayed.album %></h2>
<h3><%= lastSongPlayed.artist %></h3>
<% } %>
</section>
<button class="play play-pause">Play</button>
<button class="prev">Previous</button>
<button class="next">Next</button>
</div>
<script id="player-details" type="text/template">
<section class="track">
<img src="{{ icon }}"/>
<h1>{{ name }}</h1>
<h2>{{ album }}</h2>
<h3>{{ artist }}</h3>
</section>
</script>
<script src="/js/vendor/jquery-min.js"></script>
<script src="/js/vendor/swfobject.js"></script>
<script src="/js/vendor/underscore.js"></script>
<script src="/js/vendor/backbone.js"></script>
<script src="/js/app/bootstrap.js"></script>
<script type="text/javascript" charset="utf-8">
$(function(){
_.templateSettings = {
interpolate : /\{\{(.+?)\}\}/g,
evaluate : /\{\%(.+?)\%\}/g
};
Lstn.init({ lastPlayed: <%= lastSongPlayed.key %> });
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment