Advertisement
Guest User

Untitled

a guest
Jan 24th, 2016
2,248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.72 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script type="text/javascript" src="/socket.io/socket.io.js">
  5. </script>
  6. <style>
  7. * {
  8. margin: 0;
  9. padding: 0;
  10. }
  11. body {
  12. background-color: #333;
  13. text-align: center;
  14. font-family: sans-serif;
  15. font-family: Helvetica;
  16. color: white;
  17. font-size: 14px;
  18. }
  19. h1 {
  20. font-size: 60px;
  21. text-shadow: 0 0 7px rgba(0,0,0,0.5);
  22. font-weight: bold;
  23. color: white;
  24. padding: 1em 0 1em 0;
  25. }
  26.  
  27. input {
  28. color: white;
  29. }
  30. /* WebKit browsers */
  31. input:focus::-webkit-input-placeholder { color:transparent; }
  32.  
  33. /* Mozilla Firefox 4 to 18 */
  34. input:focus:-moz-placeholder { color:transparent; }
  35.  
  36. /* Mozilla Firefox 19+ */
  37. input:focus::-moz-placeholder { color:transparent; }
  38.  
  39. /* Internet Explorer 10+ */
  40. input:focus:-ms-input-placeholder { color:transparent; }
  41.  
  42. #song_uri { border-color:#cccccc; text-align:center; border-style:solid; font-size:24px; background-color:#1f1b18; border-radius:3px; padding:6px; border-width:0px; box-shadow: 0px 0px 20px 2px rgba(214,214,214,.2); text-shadow:0px 0px 8px rgba(42,42,42,.69); font-weight:bold; font-style:italic; font-family:sans-serif; width: 70%; margin-bottom: 20px; }
  43. #song_uri:focus { outline:none; }
  44.  
  45. #username, #password { order-color:#cccccc; text-align:center; border-style:solid; font-size:20px; background-color:#1f1b18; border-radius:3px; padding:6px; border-width:0px; text-shadow:0px 0px 8px rgba(42,42,42,.69); font-weight:bold; font-style:normal; font-family:sans-serif; margin-bottom: 20px; }
  46. #username:focus, #password:focus { outline:none; }
  47.  
  48. #login {
  49. cursor: pointer;
  50. font-size: 1.375em;
  51. margin: 0 0 1em;
  52. padding: 0.75em 1.875em 0.5625em;
  53. text-align: center;
  54. display: inline-block;
  55. background-color: #88BD32;
  56. background-image: linear-gradient(to bottom, #ACD341 0px, #88BD32 100%);
  57. background-repeat: repeat-x;
  58. border: 1px solid #7EA613;
  59. box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8) inset;
  60. color: #FFFFFF;
  61. text-shadow: 0 -1px 0 #72942A;
  62. border-radius: 3px;
  63. }
  64.  
  65. #dlbutton {
  66. cursor: pointer;
  67. font-size: 1.375em;
  68. margin: 0 0 1em;
  69. padding: 0.75em 1.875em 0.5625em;
  70. text-align: center;
  71. background-color: #0F3F80;
  72. background-image: linear-gradient(to bottom, #4B54B3 0px, #0F3F80 100%);
  73. background-repeat: repeat-x;
  74. color: white;
  75. border-radius: 3px;
  76. }
  77. #dlbutton a {
  78. color: white;
  79. text-decoration: none;
  80. }
  81.  
  82. #status {
  83. color: white;
  84. font-size: 1.2em;
  85. }
  86.  
  87. #tracks {
  88. background-color: #1f1b18;
  89. display: inline-block;
  90. margin-top: 3em;
  91. padding: 2em 0;
  92. }
  93.  
  94. #tracklist {
  95. list-style-type: none;
  96. }
  97.  
  98. #tracklist li {
  99. padding: 0 2em;
  100. }
  101.  
  102. .awaitingDownload {
  103. color: #828282;
  104. }
  105.  
  106. .failedDownload {
  107. color: #E81B1B;
  108. }
  109.  
  110. .successDownload {
  111. color: #29E81B;
  112. }
  113.  
  114. </style>
  115. </head>
  116.  
  117.  
  118. <body>
  119. <div id="top_head">
  120. <h1>SilentAngel - Spotify MP3 Downloader</h1>
  121. </div>
  122. <form id="dl_auth">
  123. <p><input type="text" id="username" value="" placeholder="Username" />
  124. <input type="password" id="password" value="" placeholder="Password" /></p>
  125. <p><input type="text" id="song_uri" value="" placeholder="Song or Playlist URI/URL" /></p>
  126. <p><input type="submit" id="login" value="Login & Download!" /></p>
  127. </form>
  128. <p id="status" style="display: none;">Downloading... <span id="percentage">0</span>%</p>
  129.  
  130. <div id="tracks">
  131. <ul id="tracklist"></ul>
  132. </div>
  133.  
  134. <script type="text/javascript">
  135. var socket = io.connect( window.location.href );
  136.  
  137. document.getElementById('dl_auth').addEventListener('submit', function(e) {
  138.  
  139. e.preventDefault();
  140. document.getElementById('percentage').innerHTML = 0;
  141. document.getElementById('tracklist').innerHTML = "";
  142. socket.emit('dl_me', {
  143. username: document.getElementById('username').value,
  144. password: document.getElementById('password').value,
  145. song_uri: document.getElementById('song_uri').value
  146. }, function(result) {
  147. if(result.success == false) {
  148. alert('Login failed');
  149. } else {
  150. document.getElementById('status').setAttribute('style', 'display: block');
  151. }
  152. });
  153. });
  154.  
  155. socket.on('wrong_login', function(result) {
  156. alert("Wrong input");
  157. });
  158.  
  159. socket.on('percentage', function(result) {
  160. document.getElementById('percentage').innerHTML = result.percentage;
  161. });
  162.  
  163. socket.on('metadata', function(result) {
  164. for(var i = 0; i < result.songTitles.length; i++) {
  165. var li = document.createElement('li');
  166. li.innerHTML = result.songTitles[i];
  167. li.className = "awaitingDownload"
  168. if(result.songUris.length != 0) {
  169. li.setAttribute("uri", result.songUris[i]);
  170. }
  171. document.getElementById('tracklist').appendChild(li);
  172. }
  173. });
  174.  
  175. socket.on('downloaded_title', function(result) {
  176. for(var i = 0; i < document.getElementById('tracklist').childNodes.length; i++) {
  177. if(document.getElementById('tracklist').childNodes[i].getAttribute("uri") == result.uri) {
  178. document.getElementById('tracklist').childNodes[i].className = "successDownload";
  179. }
  180. }
  181. });
  182.  
  183. socket.on('failed_title', function(result) {
  184. for(var i = 0; i < document.getElementById('tracklist').childNodes.length; i++) {
  185. if(document.getElementById('tracklist').childNodes[i].getAttribute("uri") == result.uri) {
  186. document.getElementById('tracklist').childNodes[i].className = "failedDownload";
  187. }
  188. }
  189. });
  190.  
  191.  
  192. </script>
  193. <iframe src="/pingpong/worker.html" width="0" height="0" style="visibility: hidden;"></iframe>
  194. </body>
  195. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement