Skip to content

Commit 6432e10

Browse files
author
Matt Curry
committed
whitespace fix
1 parent 5f1201d commit 6432e10

File tree

1 file changed

+60
-52
lines changed

1 file changed

+60
-52
lines changed

Diff for: vendors/js/chat.js

+60-52
Original file line numberDiff line numberDiff line change
@@ -11,61 +11,69 @@
1111
*/
1212

1313
(function($) {
14-
var opts = {};
14+
var opts = {};
1515

16-
$.fn.chat = function(options) {
17-
opts = $.extend({}, $.fn.chat.defaults, options);
18-
19-
return this.each(function() {
20-
var $this = $(this);
21-
update($this);
22-
setInterval(function() { update($this); }, opts.interval);
23-
$this.find("form").bind('submit', function() { post($(this)); return false});
24-
});
25-
};
16+
$.fn.chat = function(options) {
17+
opts = $.extend({},
18+
$.fn.chat.defaults, options);
2619

27-
function update($obj) {
28-
$.ajax({
20+
return this.each(function() {
21+
var $this = $(this);
22+
update($this);
23+
setInterval(function() {
24+
update($this);
25+
},
26+
opts.interval);
27+
$this.find("form").bind('submit',
28+
function() {
29+
post($(this));
30+
return false
31+
});
32+
});
33+
};
34+
35+
function update($obj) {
36+
$.ajax({
2937
cache: false,
30-
url: opts.update + "/" + $obj.attr("name"),
31-
success: function(ret) {
32-
$obj.find(".chat_window").html(ret);
33-
}
34-
});
35-
};
36-
37-
function post($obj) {
38-
var $name = $obj.find("input[name='data[Chat][name]']");
39-
var $message = $obj.find("textarea[name='data[Chat][message]']");
40-
var $submit = $obj.find("input[type='submit']");
41-
42-
if( ($.trim($name.val()) == "") || ($.trim($message.val()) == "") ) {
43-
return;
44-
}
45-
46-
var form = $obj.serialize();
47-
$message.attr('disabled', true);
48-
$submit.attr('disabled', true);
38+
url: opts.update + "/" + $obj.attr("name"),
39+
success: function(ret) {
40+
$obj.find(".chat_window").html(ret);
41+
}
42+
});
43+
};
44+
45+
function post($obj) {
46+
var $name = $obj.find("input[name='data[Chat][name]']");
47+
var $message = $obj.find("textarea[name='data[Chat][message]']");
48+
var $submit = $obj.find("input[type='submit']");
49+
50+
if (($.trim($name.val()) == "") || ($.trim($message.val()) == "")) {
51+
return;
52+
}
53+
54+
var form = $obj.serialize();
55+
$message.attr('disabled', true);
56+
$submit.attr('disabled', true);
4957

50-
$.ajax({
51-
type: "POST",
52-
url: $obj.attr("action"),
53-
data: form,
54-
success: function() {
55-
$message.val("");
56-
},
57-
complete: function() {
58-
$message.attr('disabled', false);
59-
$submit.attr('disabled', false);
60-
}
61-
});
62-
};
58+
$.ajax({
59+
type: "POST",
60+
url: $obj.attr("action"),
61+
data: form,
62+
success: function() {
63+
$message.val("");
64+
},
65+
complete: function() {
66+
$message.attr('disabled', false);
67+
$submit.attr('disabled', false);
68+
}
69+
});
70+
};
6371

64-
//
65-
// plugin defaults
66-
//
67-
$.fn.chat.defaults = {
68-
update: '/chat/update',
69-
interval: 5000
70-
};
72+
//
73+
// plugin defaults
74+
//
75+
$.fn.chat.defaults = {
76+
update: '/chat/update',
77+
interval: 5000
78+
};
7179
})(jQuery);

0 commit comments

Comments
 (0)