Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 57 lines (50 sloc) 1.307 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
<html>
<head>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<style type="text/css">
body {
font-family: Helvetica;
font-size: 11pt;
}

#messages {
list-style-type: none;
margin: 0;
padding: 0;
}

#messages li {
margin: 0;
padding: 5px 0;
border-bottom: 1px #ddd solid;
}

#messages .from {
color: #74b5ca;
}

#messages .unsynced {
color: #bbb;
}
</style>
</head>
<body>
<script type="text/javascript">
function receiveMessage(data) {
$("#loading").hide();
if($('#msg_'+data.date).length == 0) {
$("#messages").append('<li><span class="from" id="msg_'+data.date+'">'+data.from+'</span> <span class="text">'+data.text+'</span></li>');
window.scrollTo(document.body.scrollWidth, document.body.scrollHeight);
}
}
function sentMessage(data) {
$("#messages").append('<li class="unsynced" id="tag_'+data.tag+'"><span class="from">You</span> <span class="text">'+data.text+'</span></li>');
window.scrollTo(document.body.scrollWidth, document.body.scrollHeight);
}
function confirmMessage(tag) {
$("#tag_"+tag).removeClass("unsynced");
}
</script>

<!-- <div id="loading"><img src="ajax-loader.gif" /></div> -->

<ul id="messages">
<li>This is a message</li>
<li>This is another message</li>
</ul>

</body>
</html>
Something went wrong with that request. Please try again.