Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
183 lines (159 sloc) 5.58 KB
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simple Chat</title>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.2.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.2.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.scrollTo-min.js"></script>
<script src="amqp-js/javascripts/mq.js" type="text/javascript"></script>
<script src="amqp-js/javascripts/swfobject.js" type="text/javascript"></script>
<style type="text/css">
/*demo page css*/
body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;}
.demoHeaders { margin-top: 2em; }
#dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}
#dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
ul#icons {margin: 0; padding: 0;}
ul#icons li {margin: 2px; position: relative; padding: 4px 0; cursor: pointer; float: left; list-style: none;}
ul#icons span.ui-icon {float: left; margin: 0 4px;}
#message { width: 40%; margin-top: 30px; margin-right: 30px;}
.chats{
width: 90%; height: 270pt;
}
.chat{
float:left;
width: 30%; height: 250pt;
}
.chat div{
width: 90%; height: 200pt; border: 1px solid rgb(85, 85, 85);
font: 12pt "Trebuchet MS", sans-serif; overflow:auto;
}
.messagenrs{
width: 90%;
}
.messagenrs form {
float:left;
width:30%;
}
.messagenrs form textarea {
width:90%;
margin-top: 10px;
margin-bottom: 10px;
margin-left: 0;
margin-right: 0;
}
</style>
</head>
<body>
<div class="chats">
<div class="chat">
<h1>All games Messages</h1>
<div id="all_game_messages">
</div>
</div>
<div class="chat">
<h1>Game 1</h1>
<div id="game_1_messages">
</div>
</div>
<div class="chat">
<h1>Game 2</h1>
<div id="game_2_messages">
</div>
</div>
</div>
<div class="messagenrs">
<form id="target_messanger_all">
<lable> All games </lable> <br />
<textarea name="message" id="message_all" rows="5"> </textarea> <br />
<input type="submit" value="Add Message" /> <br />
</form>
<form id="target_messanger_game_1">
<lable> Game 1 </lable> <br />
<textarea name="message" id="message_1" rows="5"> </textarea> <br />
<input type="submit" value="Add Message" /> <br />
</form>
<form id="target_messanger_game_2">
<lable> Game 2 </lable> <br />
<textarea name="message" id="message_2" rows="5"> </textarea> <br />
<input type="submit" value="Add Message" /> <br />
</form>
</div>
<div style="clear:both;" />
<script type="text/javascript">
var message_id = 0;
$(function(){
MQ.configure({ host: "109.74.202.172" });
MQ.on("load", function() { console.log("Load"); });
MQ.on("connect", function(){ console.log("Connected !!!"); });
MQ.on("disconnect", function(){ console.log("Disconnected !!!"); });
MQ.queue("auto").callback(function(m){ alert("No Binding Matches"); });
MQ.queue("auto").bind("games", "game_*").callback(function(m){
$("#all_game_messages").append(
"<p style='margin:0px;' id='game_all_message_" + message_id + "''>" +
" > " + m.data.value +
"</p>"
);
$("div#all_game_messages").scrollTo("max");
$("#game_all_message_" + message_id).effect("highlight", {}, 1000);
message_id ++;
});
MQ.queue("auto").bind("games", "game_1").callback(function(m){
$("#game_1_messages").append(
"<p style='margin:0px;' id='game_1_message_" + message_id + "''>" +
" > " + m.data.value +
"</p>"
);
$("div#game_1_messages").scrollTo("max");
$("#game_1_message_" + message_id).effect("highlight", {}, 1000);
message_id ++;
});
MQ.queue("auto").bind("games", "game_2").callback(function(m){
$("#game_2_messages").append(
"<p style='margin:0px;' id='game_2_message_" + message_id + "''>" +
" > " + m.data.value +
"</p>"
);
$("div#game_2_messages").scrollTo("max");
$("#game_2_message_" + message_id).effect("highlight", {}, 1000);
message_id ++;
});
swfobject.embedSWF(
"amqp-js/swfs/amqp.swf?" + Math.random().toString(),
"AMQPProxy",
"1", "1", "9", "amqp-js/swfs/expressInstall.swf",
{},
{ allowScriptAccess: "always", wmode: "opaque", bgcolor: "#ff0000" },
{},
function(){}
);
$('#target_messanger_all').submit(function() {
if( $("#message_all").val() != "" ){
MQ.topic( "games" ).publish({ value: $("#message_all").val() }, "game_*");
$("#message_all").val("");
}
return false;
});
$('#target_messanger_game_1').submit(function() {
if( $("#message_1").val() != "" ){
MQ.topic( "games" ).publish({ value: $("#message_1").val() }, "game_1");
$("#message_1").val("");
}
return false;
});
$('#target_messanger_game_2').submit(function() {
if( $("#message_2").val() != "" ){
MQ.topic( "games" ).publish({ value: $("#message_2").val() }, "game_2");
$("#message_2").val("");
}
return false;
});
});
</script>
<div id="amqp-wrap">
<div id="AMQPProxy">Loading AMQP Proxy</div>
</div>
</body>
</html>