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