/templates/home.html

https://github.com/meirish/backbone-intro · HTML · 163 lines · 154 code · 9 blank · 0 comment · 0 complexity · 6c4d69b632b09c5108a7c7c87aaffa41 MD5 · raw file

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>LSTN</title>
  5. <style>
  6. #player{
  7. position: fixed; right:-400px;
  8. background: rgba(0,0,0,.3);
  9. top: 20px;
  10. padding: 10px;
  11. }
  12. .search-suggest{
  13. width: 400px;
  14. background: white;
  15. position: absolute;
  16. padding: 15px 5px;
  17. top: 170px;
  18. }
  19. .close{
  20. position: absolute;
  21. top: 5px;
  22. right: 5px;
  23. }
  24. #page .rdio-obj{
  25. display: inline-block;
  26. vertical-align: middle;
  27. padding: .5em;
  28. margin: .5em;
  29. }
  30. </style>
  31. </head>
  32. <body>
  33. <h1><a href="#">LSTN</a></h1>
  34. <% if (user.lastSongPlayed) { %>
  35. <a href="/logout">Log out of Rdio</a>
  36. <p>Logged in as <%= user.firstName %></p>
  37. <% } else { %>
  38. <a href="/login">Sign in with Rdio</a>
  39. <% } %>
  40. <input type="search" name="some_name" id="search" value="Find Some Music" />
  41. <section id="page">
  42. <% if (user.lastSongPlayed) { %>
  43. <h1>What's playing in your network</h1>
  44. <% } else { %>
  45. <h1>Hear what's playing on Rdio</h1>
  46. <% } %>
  47. </section>
  48. <div id="player">
  49. <div id="rdioSwf"></div>
  50. <section class="track">
  51. <% if (user.lastSongPlayed) { %>
  52. <img src="<%= user.lastSongPlayed.icon %>"/>
  53. <h1><%= user.lastSongPlayed.name %></h1>
  54. <h2><%= user.lastSongPlayed.album %></h2>
  55. <h3><%= user.lastSongPlayed.artist %></h3>
  56. <% } %>
  57. </section>
  58. <button class="play play-pause">Play</button>
  59. <button class="prev">Previous</button>
  60. <button class="next">Next</button>
  61. </div>
  62. <script id="player-details" type="text/template">
  63. <section class="track">
  64. <img src="{{ icon }}"/>
  65. <h1>{{ name }}</h1>
  66. <h2>{{ album }}</h2>
  67. <h3>{{ artist }}</h3>
  68. </section>
  69. </script>
  70. <script id="rdio-obj" type="text/template">
  71. {{#icon}}
  72. <img src="{{ icon }}"/>
  73. {{/icon}}
  74. {{#firstName}}
  75. {{firstName}} {{lastName}}
  76. {{/firstName}}
  77. {{#name}}
  78. <h1>{{ name }}</h1>
  79. {{/name}}
  80. {{#album}}
  81. <h2><a href="#albums/{{albumKey}}">{{ album }}</a></h2>
  82. {{/album}}
  83. {{#artist}}
  84. <h3><a href="#artists/{{artistKey}}">{{ artist }}</a></h3>
  85. {{/artist}}
  86. {{#canPlay}}
  87. <button class="play">PLAY ME</button>
  88. {{/canPlay}}
  89. </script>
  90. <script id="search-suggest" type="text/template">
  91. <a href="#" class="go-to-search">See all search results</a>
  92. </script>
  93. <script id="search-result" type="text/template">
  94. <a href="{{permalink}}">
  95. {{#firstName}}
  96. {{firstName}} {{lastName}}
  97. {{/firstName}}
  98. {{#name}}
  99. <span class="name">{{ name }}</span>
  100. {{/name}}
  101. {{#album}}
  102. <span class="album">{{ album }}</span>
  103. {{/album}}
  104. {{#artist}}
  105. <span class="artist">{{ artist }}</span>
  106. {{/artist}}
  107. </a>
  108. </script>
  109. <script id="obj-detail" type="text/template">
  110. {{#icon}}
  111. <img src="{{ icon }}"/>
  112. {{/icon}}
  113. {{#firstName}}
  114. {{firstName}} {{lastName}}
  115. {{/firstName}}
  116. {{#name}}
  117. <h1>{{ name }}</h1>
  118. {{/name}}
  119. {{#album}}
  120. <h2><a href="#albums/{{albumKey}}">{{ album }}</a></h2>
  121. {{/album}}
  122. {{#artist}}
  123. <h3><a href="#artists/{{artistKey}}">{{ artist }}</a></h3>
  124. {{/artist}}
  125. {{#canPlay}}
  126. <button class="play" data-key="{{key}}">PLAY ME</button>
  127. {{/canPlay}}
  128. {{#hasRadio}}
  129. <button class="play" data-key="{{radioKey}}">
  130. Play station
  131. </button
  132. {{/hasRadio}}
  133. </script>
  134. <script src="/js/vendor/jquery-min.js"></script>
  135. <script src="/js/vendor/swfobject.js"></script>
  136. <script src="/js/vendor/mustache.js"></script>
  137. <script src="/js/vendor/underscore.js"></script>
  138. <script src="/js/vendor/backbone.js"></script>
  139. <script src="/js/app/setup.js"></script>
  140. <script src="/js/app/player.js"></script>
  141. <script src="/js/app/rdio.js"></script>
  142. <script src="/js/app/search.js"></script>
  143. <script>
  144. Lstn.bootstrap = <%= heavyRotation %>
  145. $(function(){
  146. <% if (user.lastSongPlayed) { %>
  147. Lstn.init({ lastPlayed: '<%= user.lastSongPlayed.key %>' });
  148. <% } else { %>
  149. Lstn.init();
  150. <% } %>
  151. });
  152. </script>
  153. </body>
  154. </html>