mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 14:47:12 -04:00
use jshint
This commit is contained in:
parent
a07563b922
commit
ac74ba10d0
1 changed files with 133 additions and 128 deletions
|
@ -22,7 +22,7 @@ var crypto = require("crypto");
|
|||
*/
|
||||
exports.cleanText = function (txt) {
|
||||
return txt.replace(/\r\n/g,'\n').replace(/\r/g,'\n').replace(/\t/g, ' ').replace(/\xa0/g, ' ');
|
||||
}
|
||||
};
|
||||
|
||||
Class('Pad', {
|
||||
|
||||
|
@ -70,8 +70,8 @@ Class('Pad', {
|
|||
BUILD : function (id)
|
||||
{
|
||||
return {
|
||||
'id' : id,
|
||||
}
|
||||
'id' : id
|
||||
};
|
||||
},
|
||||
|
||||
appendRevision : function(aChangeset, author)
|
||||
|
@ -91,10 +91,10 @@ Class('Pad', {
|
|||
newRevData.meta.timestamp = new Date().getTime();
|
||||
|
||||
//ex. getNumForAuthor
|
||||
if(author != '')
|
||||
if(author !== '')
|
||||
this.pool.putAttrib(['author', author || '']);
|
||||
|
||||
if(newRev % 100 == 0)
|
||||
if(newRev % 100 === 0)
|
||||
{
|
||||
newRevData.meta.atext = this.atext;
|
||||
}
|
||||
|
@ -127,9 +127,9 @@ Class('Pad', {
|
|||
{
|
||||
var authors = [];
|
||||
|
||||
for(key in this.pool.numToAttrib)
|
||||
for(var key in this.pool.numToAttrib)
|
||||
{
|
||||
if(this.pool.numToAttrib[key][0] == "author" && this.pool.numToAttrib[key][1] != "")
|
||||
if(this.pool.numToAttrib[key][0] == "author" && this.pool.numToAttrib[key][1] !== "")
|
||||
{
|
||||
authors.push(this.pool.numToAttrib[key][1]);
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ Class('Pad', {
|
|||
function(callback)
|
||||
{
|
||||
//this chat message doesn't exist, return null
|
||||
if(entry == null)
|
||||
if(!entry)
|
||||
{
|
||||
callback();
|
||||
return;
|
||||
|
@ -332,8 +332,9 @@ Class('Pad', {
|
|||
var cleanedEntries = [];
|
||||
for(var i=0;i<entries.length;i++)
|
||||
{
|
||||
if(entries[i]!=null)
|
||||
if(entries[i]) {
|
||||
cleanedEntries.push(entries[i]);
|
||||
}
|
||||
else
|
||||
console.warn("WARNING: Found broken chat entry in pad " + _this.id);
|
||||
}
|
||||
|
@ -347,7 +348,7 @@ Class('Pad', {
|
|||
var _this = this;
|
||||
|
||||
//replace text with default text if text isn't set
|
||||
if(text == null)
|
||||
if(!text)
|
||||
{
|
||||
text = settings.defaultPadText;
|
||||
}
|
||||
|
@ -358,30 +359,34 @@ Class('Pad', {
|
|||
if(ERR(err, callback)) return;
|
||||
|
||||
//if this pad exists, load it
|
||||
if(value != null)
|
||||
if(value)
|
||||
{
|
||||
_this.head = value.head;
|
||||
_this.atext = value.atext;
|
||||
_this.pool = _this.pool.fromJsonable(value.pool);
|
||||
|
||||
//ensure we have a local chatHead variable
|
||||
if(value.chatHead != null)
|
||||
if(value.chatHead) {
|
||||
_this.chatHead = value.chatHead;
|
||||
else
|
||||
}
|
||||
else {
|
||||
_this.chatHead = -1;
|
||||
|
||||
}
|
||||
//ensure we have a local publicStatus variable
|
||||
if(value.publicStatus != null)
|
||||
if(value.publicStatus) {
|
||||
_this.publicStatus = value.publicStatus;
|
||||
else
|
||||
}
|
||||
else {
|
||||
_this.publicStatus = false;
|
||||
|
||||
}
|
||||
//ensure we have a local passwordHash variable
|
||||
if(value.passwordHash != null)
|
||||
if(value.passwordHash) {
|
||||
_this.passwordHash = value.passwordHash;
|
||||
else
|
||||
}
|
||||
else {
|
||||
_this.passwordHash = null;
|
||||
}
|
||||
}
|
||||
//this pad doesn't exist, so create it
|
||||
else
|
||||
{
|
||||
|
@ -483,7 +488,7 @@ Class('Pad', {
|
|||
{
|
||||
if(ERR(err, callback)) return;
|
||||
callback();
|
||||
})
|
||||
});
|
||||
},
|
||||
//set in db
|
||||
setPublicStatus: function(publicStatus)
|
||||
|
@ -493,18 +498,18 @@ Class('Pad', {
|
|||
},
|
||||
setPassword: function(password)
|
||||
{
|
||||
this.passwordHash = password == null ? null : hash(password, generateSalt());
|
||||
this.passwordHash = password ? hash(password, generateSalt()) : null;
|
||||
db.setSub("pad:"+this.id, ["passwordHash"], this.passwordHash);
|
||||
},
|
||||
isCorrectPassword: function(password)
|
||||
{
|
||||
return compare(this.passwordHash, password)
|
||||
return compare(this.passwordHash, password);
|
||||
},
|
||||
isPasswordProtected: function()
|
||||
{
|
||||
return this.passwordHash != null;
|
||||
return this.passwordHash ? true : false;
|
||||
}
|
||||
}, // methods
|
||||
} // methods
|
||||
});
|
||||
|
||||
/* Crypto helper methods */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue