Skip to content

Instantly share code, notes, and snippets.

@kenda
Created April 17, 2012 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenda/2409479 to your computer and use it in GitHub Desktop.
Save kenda/2409479 to your computer and use it in GitHub Desktop.
modified index.php of candy webchat
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Candy - Chats are not dead yet</title>
<link rel="shortcut icon" href="/candy/res/img/favicon.png" type="image/gif" />
<link rel="stylesheet" type="text/css" href="/candy/res/default.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript" src="/candy/libs/libs.min.js"></script>
<script type="text/javascript" src="/candy/candy.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
<?php
// check whether the chat parameter is given
// if not join default room
if ( $_GET["chat"] ){
$chat = $_GET["chat"]."@conference.chat.nlp2rdf.org";
} else {
$chat = "lobby@conference.chat.nlp2rdf.org";
}
// output the candy init snippet
echo('
Candy.init("http-bind/", {
core: { debug: true, autojoin: ["'.$chat.'"] },
view: { resources: "/candy/res/" }
});
');
// connect anonymously or with a given nickname
if ( $_GET["name"] ){
echo('
Candy.Core.connect("localhost", null, "'.$_GET["name"].'");
');
}
else{
echo('
Candy.Core.connect("localhost");
');
}
?>
});
</script>
</head>
<body>
<div id="candy"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment