12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <!doctype html>
- <html>
- <head>
- <title>Socket.IO chat</title>
- <style>
- * { margin: 0; padding: 0; box-sizing: border-box; }
- body { font: 13px Helvetica, Arial; }
- form { background: #000; padding: 3px; position: fixed; bottom: 0; width: 100%; }
- form input { border: 0; padding: 10px; width: 90%; margin-right: .5%; }
- form button { width: 9%; background: rgb(130, 224, 255); border: none; padding: 10px; }
- #messages { list-style-type: none; margin: 0; padding: 0; }
- #messages li { padding: 5px 10px; }
- #messages li:nth-child(odd) { background: #eee; }
- </style>
- </head>
- <body>
- <h1>LAN Jukebox</h1>
- <a href='/youtube'>Add a Youtube video</a><br/>
- <a href='/file'>Add a music file</a><br/>
- {{{playlist_view}}}
- {{{playing_view}}}
- {{{played_view}}}
- <button type='button' id='control-button'></button>
- <p>Allan put music player here</p>
- <script src='/socket.io/socket.io.js'></script>
- <script src='https://code.jquery.com/jquery-1.11.1.js'></script>
- <script>
- $(function () {
- var socket = io();
- $('form').submit(function(){
- socket.emit('chat message', $('#m').val());
- $('#m').val('');
- return false;
- });
- socket.on('chat message', function(msg){
- $('#messages').append($('<li>').text(msg));
- });
- socket.on('player-transition', function(state) {
- $('#control-button').attr('disabled', 'disabled');
- $('#control-button').html(state);
- });
- socket.on('paused', function() {
- $('#control-button').removeAttr('disabled');
- $('#control-button').html('Play');
- $('#control-button').unbind('click').click(function() {
- socket.emit('play');
- });
- });
- socket.on('playing', function() {
- $('#control-button').removeAttr('disabled');
- $('#control-button').html('Pause');
- $('#control-button').unbind('click').click(function() {
- socket.emit('pause');
- });
- });
- });
- </script>
- <h3>Chat Log:</h3>
- <ul id='messages'></ul>
- <form action=''>
- <input id='m' autocomplete='off' /><button>Send</button>
- </form>
- </body>
- </html>
|