Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c1b611

Browse files
committed
Merge branch 'master' of github.com:automattic/socket.io
2 parents 507054c + dfceb00 commit 2c1b611

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

Readme.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
### This Readme corresponds to the upcoming 1.0 release. Please refer to http://socket.io for the current 0.9.x documentation.
2-
3-
<hr />
4-
51
# socket.io
62

73
[![Build Status](https://secure.travis-ci.org/automattic/socket.io.png)](http://travis-ci.org/automattic/socket.io)
@@ -129,7 +125,7 @@ server.listen(3000);
129125

130126
Sets the adapter `v`. Defaults to an instance of the `Adapter` that
131127
ships with socket.io which is memory based. See
132-
[socket.io-adapter](https://github.com/learnboost/socket.io-adapter).
128+
[socket.io-adapter](https://github.com/Automattic/socket.io-adapter).
133129

134130
If no arguments are supplied this method returns the current value.
135131

@@ -288,7 +284,7 @@ server.listen(3000);
288284

289285
The mechanics of joining rooms are handled by the `Adapter`
290286
that has been configured (see `Server#adapter` above), defaulting to
291-
[socket.io-adapter](https://github.com/socket.io/socket.io-adapter).
287+
[socket.io-adapter](https://github.com/Automattic/socket.io-adapter).
292288

293289
### Socket#leave(name:String[, fn:Function]):Socket
294290

@@ -299,7 +295,7 @@ server.listen(3000);
299295

300296
The mechanics of leaving rooms are handled by the `Adapter`
301297
that has been configured (see `Server#adapter` above), defaulting to
302-
[socket.io-adapter](https://github.com/socket.io/socket.io-adapter).
298+
[socket.io-adapter](https://github.com/Automattic/socket.io-adapter).
303299

304300
### Socket#to(room:String):Socket
305301
### Socket#in(room:String):Socket

examples/chat/public/main.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ $(function() {
7070

7171
// Log a message
7272
function log (message, options) {
73-
var el = '<li class="log">' + message + '</li>';
74-
addMessageElement(el, options);
73+
var $el = $('<li>').addClass('log').text(message);
74+
addMessageElement($el, options);
7575
}
7676

7777
// Adds the visual chat message to the message list
@@ -84,16 +84,17 @@ $(function() {
8484
$typingMessages.remove();
8585
}
8686

87-
var colorStyle = 'style="color:' + getUsernameColor(data.username) + '"';
88-
var usernameDiv = '<span class="username"' + colorStyle + '>' +
89-
data.username + '</span>';
90-
var messageBodyDiv = '<span class="messageBody">' +
91-
data.message + '</span>';
87+
var $usernameDiv = $('<span class="username"/>')
88+
.text(data.username)
89+
.css('color', getUsernameColor(data.username));
90+
var $messageBodyDiv = $('<span class="messageBody">')
91+
.text(data.message);
9292

9393
var typingClass = data.typing ? 'typing' : '';
94-
var messageDiv = '<li class="message ' + typingClass + '">' +
95-
usernameDiv + messageBodyDiv + '</li>';
96-
var $messageDiv = $(messageDiv).data('username', data.username);
94+
var $messageDiv = $('<li class="message"/>')
95+
.data('username', data.username)
96+
.addClass(typingClass)
97+
.append($usernameDiv, $messageBodyDiv);
9798

9899
addMessageElement($messageDiv, options);
99100
}
@@ -145,7 +146,7 @@ $(function() {
145146

146147
// Prevents input from having injected markup
147148
function cleanInput (input) {
148-
return $('<div/>').text(input).html() || input;
149+
return $('<div/>').text(input).text();
149150
}
150151

151152
// Updates the typing event

examples/chat/public/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ html, body {
2525

2626
ul {
2727
list-style: none;
28+
word-wrap: break-word;
2829
}
2930

3031
/* Pages */

0 commit comments

Comments
 (0)