Permalink
Browse files

.

  • Loading branch information...
1 parent 3e20db1 commit bea944008c5c969996b221b2221da63f92d6c42a @PeterHimschoot committed Sep 29, 2011
View
37 app.js
@@ -1,46 +1,13 @@
var express = require('express');
var app = module.exports = express.createServer();
-var io = require('socket.io').listen(app);
//configure express
app.configure(function(){
- app.use(express["static"](__dirname + '/public'));
+ app.use(express.static(__dirname + '/public'));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
//start the http server
app.listen(process.env.C9_PORT);
console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
-
-//setup the chat server
-var clients = [];
-
-io.sockets.on('connection', function (socket) {
- //add the new client and send welcome message
- clients.push(socket);
- socket.emit('message', { time: new Date().toLocaleTimeString(), person: 'Chat Server', message: 'Welcome to Chat!' });
-
- //relay messages
- socket.on('message', function (data) {
- //add server time to the message
- data.time = new Date().toLocaleTimeString();
- //log the message
- console.log(data.person + ': ' + data.message);
- //send messages to all clients
- for (var i = 0; i < clients.length; i++)
- {
- clients[i].emit('message', data);
- }
- });
-
- //notify pending messages
- socket.on('typing', function (data) {
- //log the message
- console.log(data.person + ': is typing');
- //send messages to all clients
- for (var i = 0; i < clients.length; i++)
- {
- clients[i].emit('typing', data);
- }
- });
-});
+//
View
107 public/Detection/DetectIt.html
@@ -1,107 +0,0 @@
-<!DOCTYPE html>
-<html >
-<head>
- <title>HTML 5 Detection Techniques</title>
- <script src="../js/modernizr-2.0.6-development-only.js"></script>
- <script src="../js/jquery-1.6.2.js"></script>
- <script >
-
- function supports_canvas()
- {
- return !!document.createElement('canvas').getContext;
- }
-
- function show(message)
- {
- document.getElementById("output").innerHTML = message;
- }
-
- function checkCanvas()
- {
- if (Modernizr.canvas)
- {
- show("Canvas present");
- } else
- {
- show("No canvas there");
- }
- }
-
- function checkCanvasText()
- {
- if (Modernizr.canvastext)
- {
- show("Canvas Text API present");
- } else
- {
- show("No canvas Text API here");
- }
- }
-
- function supports_video()
- {
- return !!document.createElement('video').canPlayType;
- }
-
- function supports_h264_baseline_video()
- {
- if (!supports_video()) { return false; }
- var v = document.createElement("video");
- return v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');
- }
-
- function supports_local_storage()
- {
- try
- {
- return 'localStorage' in window && window['localStorage'] !== null;
- } catch (e)
- {
- return false;
- }
- }
-
- function check_web_workers()
- {
- if (Modernizr.webworkers)
- {
- show("Web workers ready!");
- } else
- {
- show("Web workers stuck in traffic");
- }
- }
-
- function check_input_types()
- {
- var i = document.createElement("input");
- i.setAttribute("type", "color");
- return i.type !== "text";
- }
-
- function checkInputTypes()
- {
- if (check_input_types())
- show("Input types available");
- else
- show("Old input types ...");
- }
-
- </script>
-</head>
-<body>
- <p id="output">Click one of the buttons to test</p>
- <span>
- <button type="button" onclick="checkCanvas()">Canvas</button>
- <button type="button" onclick="checkCanvasText()">
- Canvas Text API</button>
- <button type="button" onclick="check_web_workers()">
- Web workers</button>
- <button type="button" onclick="checkInputTypes()">
- Input Types</button>
- </span>
- <div>
- <a href="http://www.html5test.com">Or try this...</a>
- </div>
-</body>
-</html>
View
44 public/FileAPI/filestorage.html
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Using the File Storage API's (Chrome only)</title>
- <script src="../js/jquery-1.6.4.min.js" type="text/javascript"></script>
- <script src="../js/storage.js" type="text/javascript"></script>
-</head>
-<body>
- <div>
- <h1>
- First check if filesystem is available</h1>
- <button id='check'>
- Check File Storage API's</button><div id='checkOutput'>
- </div>
- </div>
- <div>
- <h1>
- Now request some local storage</h1>
- <button id='request'>
- Request 2 Mb of storage</button>
- <div id='storage'>
- </div>
- </div>
- <div>
- <h1>
- Working with files</h1>
- <span>
- <button id='create' class='storage'>
- Create a file</button>
- <button id='load' class='storage'>
- Load</button>
- <button id='save' class='storage'>
- Save</button></span>
- <button id='delete' class='storage'>
- Delete the file</button>
- <div id='fileContents' contenteditable>
- The file's contents; feel free to edit</div>
- </div>
- <div>
- <button id='dir' class='storage'>
- List root files</button>
- </div>
-</body>
-</html>
View
48 public/WebSockets/chat.html
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <title>Web Sockets and Chat</title>
- <script src='../js/jquery-1.6.4.js'></script>
- <script src='../js/sproutcore-2.0.js'></script>
- <script src="../socket.io/socket.io.js"></script>
- <script src='../js/chat.js'></script>
- <link href='http://fonts.googleapis.com/css?family=Play' rel='stylesheet'>
- <link href='css/style.css' rel='stylesheet' type='text/css'>
-</head>
-<body>
- <header>
- <h1>Chat</h1>
-
- <script type="text/x-handlebars">
- <label>Name:</label>
- {{view Chat.personView id="person" type="text" placeholder="Enter your name"}}<br>
- <label>Message:</label>
- {{view Chat.messageView id="message" type="text" placeholder="Type a message and press <enter>"}}
- {{#view Chat.locationButton id="locationButton"}}Send Location{{/view}}
- </script>
-
- </header>
- <content>
- <div id='messages'>
- <div id='pending'>
-
- <script type="text/x-handlebars">
- {{#collection contentBinding="Chat.pending" tagName="div"}}
- <span class="name">{{content}} is typing...</span>
- {{/collection}}
- </script>
-
- </div>
-
- <script type="text/x-handlebars">
- {{#collection contentBinding="Chat.messages" tagName="div"}}
- <span class="time">[{{content.time}}]</span>
- <span class="name">{{content.person}}</span>:
- <span class="text">{{content.message}}</span>
- {{/collection}}
- </script>
-
- </div>
- </content>
-</body>
-</html>
View
48 public/WebSockets/css/style.css
@@ -1,48 +0,0 @@
-html, body {
- height:90%;
- margin:20px;
-}
-body {
- background: rgb(92,92,92) no-repeat;
- background-image: linear-gradient(bottom, rgb(92,92,92) 0%, rgb(12,68,158) 50%);
- background-image: -o-linear-gradient(bottom, rgb(92,92,92) 0%, rgb(12,68,158) 50%);
- background-image: -moz-linear-gradient(bottom, rgb(92,92,92) 0%, rgb(12,68,158) 50%);
- background-image: -webkit-linear-gradient(bottom, rgb(92,92,92) 0%, rgb(12,68,158) 50%);
- background-image: -ms-linear-gradient(bottom, rgb(92,92,92) 0%, rgb(12,68,158) 50%);
-
- background-image: -webkit-gradient(
- linear,
- left bottom,
- left top,
- color-stop(0, rgb(92,92,92)),
- color-stop(0.5, rgb(12,68,158))
- );
-}
-header {
- color: white;
-}
-h1 {
- text-shadow: 3px 3px 5px #222;
-}
-body, input[type=text] {
- font-family: 'Play';
- font-size: 15pt;
-}
-#name {
- width: 200px;
-}
-#message {
- width: 400px;
-}
-label {
- width: 120px;
- display: inline-block;
-}
-#messages {
- margin: 15px;
- padding: 5px;
- background-color: white;
-}
-#pending {
- background-color: #bbb;
-}
View
BIN public/images/U2U.JPG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
24 public/index.html
@@ -1,15 +1,15 @@
-<! DOCTYPE html>
-<html>
-<head>
- <title>HTML5</title>
-</head>
-<body>
- <h1>Welcome to HTML5</h1>
- <img src="images/u2u.jpg" />
-
-
+<!DOCTYPE html > < html >
+<head >
+<title > HTML5 < /title>
+</head >
+<body >
+ <h1> Welcome to HTML5 < /h1>
+ <img src="images/u2u.jpg " />
<article>
- <h2>Using File Storage API's</h2>
- <a href='FileAPI/filestorage.html'>link</a>
+ <a href='detection/htmldetection.html'>HTML 5 feature detection</a>
+ </article>
+ <article>
+ <a href='fileapi/filestorage.html'>
+ file storage</a>
</article>
</body>

0 comments on commit bea9440

Please sign in to comment.