Add contribution and style guide to README.md
Esse commit está contido em:
+132
@@ -46,6 +46,138 @@ Starting the server in _development_ mode is as simple as:
|
||||
To start the server in _production_ mode:
|
||||
EXPRESS_ENV=production node server/app.js
|
||||
|
||||
## Contributing
|
||||
|
||||
Pull requests are being accepted! If you would like to contribute, simply fork
|
||||
the project and make your changes.
|
||||
|
||||
### Style Guide
|
||||
|
||||
If you intend on contributing, please follow this style guide when submitting
|
||||
patches or commits. Submissions that do not follow these guidelines will not
|
||||
be accepted.
|
||||
|
||||
* Use 4 space indents (not tabs!)
|
||||
* No trailing whitespace
|
||||
* Blank line at the end of files
|
||||
* Semi-colons at the ends of lines, where appropriate
|
||||
* Keep lines to 80 characters or less
|
||||
* Never bump the version
|
||||
|
||||
No whitespace between keys and values:
|
||||
{foo: 'bar'}
|
||||
// good
|
||||
|
||||
{foo : 'bar'}
|
||||
// bad
|
||||
|
||||
Hash formatting:
|
||||
{foo: 'bar', baz: 'taz'}
|
||||
// good
|
||||
|
||||
{
|
||||
foo: 'bar',
|
||||
baz: 'taz',
|
||||
moo: 'cow'
|
||||
}
|
||||
// good
|
||||
|
||||
{ foo: 'bar', baz: 'taz' }
|
||||
// bad
|
||||
|
||||
{foo: 'bar',
|
||||
baz: 'taz',
|
||||
moo: 'cow'}
|
||||
// bad
|
||||
|
||||
Chained methods:
|
||||
str
|
||||
.strip
|
||||
.replace(...)
|
||||
.replace(...)
|
||||
// good
|
||||
|
||||
str
|
||||
.strip
|
||||
.replace(...)
|
||||
.replace(...)
|
||||
// bad
|
||||
|
||||
str.
|
||||
strip.
|
||||
replace(...).
|
||||
replace(...)
|
||||
// bad
|
||||
|
||||
Single quotes over double quotes, unless double quotes make sense:
|
||||
'hello'
|
||||
// good
|
||||
|
||||
"what's up?"
|
||||
// good
|
||||
|
||||
"hello"
|
||||
// bad
|
||||
|
||||
Ternary expressions are fine, but cannot be nested and must be formatted as:
|
||||
foo = (a ? b : c);
|
||||
// good
|
||||
|
||||
foo = (something.hasAPropertyLikeThis == 'some other value'
|
||||
? 'result one'
|
||||
: 'result two'
|
||||
);
|
||||
// good
|
||||
|
||||
foo = something.hasAPropertyLikeThis === 'some other value' ?
|
||||
'result one' :
|
||||
'result two'
|
||||
// bad
|
||||
|
||||
Use braces for conditionals, unless conditionals are single statements:
|
||||
if(foo) {
|
||||
bar();
|
||||
baz();
|
||||
}
|
||||
// good
|
||||
|
||||
if(foo) bar();
|
||||
else baz();
|
||||
// good
|
||||
|
||||
if(foo)
|
||||
bar(),
|
||||
baz()
|
||||
// bad
|
||||
|
||||
Closures:
|
||||
function() {
|
||||
}
|
||||
// good
|
||||
|
||||
function () {
|
||||
}
|
||||
// bad
|
||||
|
||||
function()
|
||||
{
|
||||
}
|
||||
// bad
|
||||
|
||||
Methods:
|
||||
foo.bar = function() {
|
||||
}
|
||||
// good
|
||||
|
||||
foo.bar = function (){
|
||||
}
|
||||
// bad
|
||||
|
||||
foo.bar = function()
|
||||
{
|
||||
}
|
||||
// bad
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
+5
-34
@@ -1,31 +1,4 @@
|
||||
// = im.js =
|
||||
//
|
||||
// **Copyright © 2005 – 2010 Joshua Gross**\\
|
||||
// //MIT Licensed//
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
// This is the main library for Ajax IM. It encompasses the UI controls,
|
||||
// and connecting with the server. It does //not// handle registration or
|
||||
// account management.
|
||||
|
||||
(function($) {
|
||||
//(function($) {
|
||||
// Cookies API
|
||||
var cookies = {
|
||||
// === {{{AjaxIM.}}}**{{{cookies.set(name, value, days)}}}** ===
|
||||
@@ -369,7 +342,7 @@
|
||||
});
|
||||
|
||||
this.chatstore = chatstore;
|
||||
storage.set(self.username + '-chats', chatstore);
|
||||
store.set(self.username + '-chats', chatstore);
|
||||
} else {
|
||||
this.chatstore = chatstore;
|
||||
}
|
||||
@@ -1170,10 +1143,8 @@
|
||||
var tab = $(this).parents('.imjs-tab');
|
||||
tab.css('display', 'none').data('state', 'closed');
|
||||
|
||||
if(self.settings.storageMethod && self.storageReady) {
|
||||
delete self.chatstore[tab.find('.imjs-chatbox').data('username')];
|
||||
store.set(self.username + '-chats', self.chatstore);
|
||||
}
|
||||
delete self.chatstore[tab.find('.imjs-chatbox').data('username')];
|
||||
store.set(self.username + '-chats', self.chatstore);
|
||||
|
||||
$(self).trigger('tabToggled', ['closed', tab]);
|
||||
|
||||
@@ -1580,4 +1551,4 @@
|
||||
registerUsernameTaken: 'The chosen username is already in use; please choose another.',
|
||||
registerUnknown: 'An unknown error occurred. Please try again.'
|
||||
}
|
||||
})(jQuery || $, false);
|
||||
//})(jQuery || $, false);
|
||||
+1
-1
@@ -48,7 +48,7 @@ app.post('/message', function(req, res) {
|
||||
});
|
||||
|
||||
app.post('/message/typing', function(req, res) {
|
||||
if(-~packages.TYPING_STATES.indexOf('typing' + req.body['state'])) {
|
||||
if(~packages.TYPING_STATES.indexOf('typing' + req.body['state'])) {
|
||||
res.find(req.body['to'], function(user) {
|
||||
if(user) {
|
||||
res.message(user, new packages.Status(
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário