corrade-http-templates – Diff between revs 4 and 5
?pathlinks?
Rev 4 | Rev 5 | |||
---|---|---|---|---|
Line 37... | Line 37... | |||
37 | $('#message').val(""); |
37 | $('#message').val(""); |
|
38 | $("#controls").animate({ opacity: 'show' }, 'slow'); |
38 | $("#controls").animate({ opacity: 'show' }, 'slow'); |
|
39 | }); |
39 | }); |
|
40 | } |
40 | } |
|
41 | // Polls the chatlog every second for changes. |
41 | // Polls the chatlog every second for changes. |
|
42 | setInterval(function () { |
42 | (function retrieveMessages() { |
|
43 | $.get("chat.log?t=" + Math.random(), function(data) { |
43 | $.get("chat.log?t=" + Math.random(), function(data) { |
|
44 | $("#chat").html(data); |
44 | $("#chat").html(data); |
|
- | 45 | $("#chat").animate({ |
||
- | 46 | scrollTop:$("#chat")[0].scrollHeight - $("#chat").height() |
||
- | 47 | },1000); |
||
- | 48 | setTimeout(retrieveMessages, 1000); |
||
45 | }); |
49 | }); |
|
46 | $("#chat").animate({ |
- | ||
47 | scrollTop:$("#chat")[0].scrollHeight - $("#chat").height() |
- | ||
48 | },1000); |
- | ||
49 | }, 1000); |
50 | }()); |
|
50 | // When the send button is pressed, then call the sendGroupMessage function to |
51 | // When the send button is pressed, then call the sendGroupMessage function to |
|
51 | // send the message to the PHP script, which then send the message to Corrade. |
52 | // send the message to the PHP script, which then send the message to Corrade. |
|
52 | $("#send").click(function(e){ |
53 | $("#send").click(function(e){ |
|
53 | sendGroupMessage(); |
54 | sendGroupMessage(); |
|
54 | }); |
55 | }); |
|
Line 63... | Line 64... | |||
63 | </script> |
64 | </script> |
|
64 | </head> |
65 | </head> |
|
Line 65... | Line 66... | |||
65 | |
66 | |
|
66 | <body> |
67 | <body> |
|
67 | <div id="container"> |
68 | <div id="container"> |
|
68 | <textarea id="chat" rows="12"></textarea><br/> |
69 | <textarea readonly='readonly' id="chat" rows="12"></textarea><br/> |
|
69 | <div id="controls"> |
70 | <div id="controls"> |
|
70 | Name: <input type="text" size="8" value="Someone" id="name"></input> |
71 | Name: <input type="text" size="8" value="Someone" id="name"></input> |
|
71 | Message: <input type="text" size="35" id="message"></input> |
72 | Message: <input type="text" size="35" id="message"></input> |
|
72 | <button type="button" id="send">Send</button> |
73 | <button type="button" id="send">Send</button> |