mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-05 14:47:12 -04:00
db/API: use jshint
This commit is contained in:
parent
224e82d8b0
commit
07626170d4
1 changed files with 66 additions and 66 deletions
|
@ -83,9 +83,9 @@ exports.getText = function(padID, rev, callback)
|
|||
if(rev !== undefined && typeof rev != "number")
|
||||
{
|
||||
//try to parse the number
|
||||
if(!isNaN(parseInt(rev)))
|
||||
if(!isNaN(parseInt(rev, 10)))
|
||||
{
|
||||
rev = parseInt(rev);
|
||||
rev = parseInt(rev, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ exports.getText = function(padID, rev, callback)
|
|||
data = {text: atext.text};
|
||||
|
||||
callback(null, data);
|
||||
})
|
||||
});
|
||||
}
|
||||
//the client wants the latest text, lets return it to him
|
||||
else
|
||||
|
@ -139,7 +139,7 @@ exports.getText = function(padID, rev, callback)
|
|||
callback(null, {"text": pad.text()});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
setText(padID, text) sets the text of a pad
|
||||
|
@ -163,7 +163,7 @@ exports.setText = function(padID, text, callback)
|
|||
//update the clients on the pad
|
||||
padMessageHandler.updatePadClients(pad, callback);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
getHTML(padID, [rev]) returns the html of a pad
|
||||
|
@ -183,9 +183,9 @@ exports.getHTML = function(padID, rev, callback)
|
|||
|
||||
if (rev !== undefined && typeof rev != "number")
|
||||
{
|
||||
if (!isNaN(parseInt(rev)))
|
||||
if (!isNaN(parseInt(rev, 10)))
|
||||
{
|
||||
rev = parseInt(rev);
|
||||
rev = parseInt(rev, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ exports.getHTML = function(padID, rev, callback)
|
|||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.setHTML = function(padID, html, callback)
|
||||
{
|
||||
|
@ -257,7 +257,7 @@ exports.setHTML = function(padID, html, callback)
|
|||
padMessageHandler.updatePadClients(pad, callback);
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/*****************/
|
||||
/**PAD FUNCTIONS */
|
||||
|
@ -280,7 +280,7 @@ exports.getRevisionsCount = function(padID, callback)
|
|||
|
||||
callback(null, {revisions: pad.getHeadRevisionNumber()});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
createPad(padName [, text]) creates a new pad in this group
|
||||
|
@ -305,7 +305,7 @@ exports.createPad = function(padID, text, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
deletePad(padID) deletes a pad
|
||||
|
@ -323,7 +323,7 @@ exports.deletePad = function(padID, callback)
|
|||
|
||||
pad.remove(callback);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
getReadOnlyLink(padID) returns the read only link of a pad
|
||||
|
@ -347,7 +347,7 @@ exports.getReadOnlyID = function(padID, callback)
|
|||
callback(null, {readOnlyID: readOnlyId});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
setPublicStatus(padID, publicStatus) sets a boolean for the public status of a pad
|
||||
|
@ -380,7 +380,7 @@ exports.setPublicStatus = function(padID, publicStatus, callback)
|
|||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
getPublicStatus(padID) return true of false
|
||||
|
@ -406,7 +406,7 @@ exports.getPublicStatus = function(padID, callback)
|
|||
|
||||
callback(null, {publicStatus: pad.getPublicStatus()});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
setPassword(padID, password) returns ok or a error message
|
||||
|
@ -435,7 +435,7 @@ exports.setPassword = function(padID, password, callback)
|
|||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
isPasswordProtected(padID) returns true or false
|
||||
|
@ -461,7 +461,7 @@ exports.isPasswordProtected = function(padID, callback)
|
|||
|
||||
callback(null, {isPasswordProtected: pad.isPasswordProtected()});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/******************************/
|
||||
/** INTERNAL HELPER FUNCTIONS */
|
||||
|
@ -470,7 +470,7 @@ exports.isPasswordProtected = function(padID, callback)
|
|||
//checks if a number is an int
|
||||
function is_int(value)
|
||||
{
|
||||
return (parseFloat(value) == parseInt(value)) && !isNaN(value)
|
||||
return (parseFloat(value) == parseInt(value, 10)) && !isNaN(value);
|
||||
}
|
||||
|
||||
//gets a pad safe
|
||||
|
@ -502,12 +502,12 @@ function getPadSafe(padID, shouldExist, text, callback)
|
|||
if(ERR(err, callback)) return;
|
||||
|
||||
//does not exist, but should
|
||||
if(exists == false && shouldExist == true)
|
||||
if(!exists && shouldExist)
|
||||
{
|
||||
callback(new customError("padID does not exist","apierror"));
|
||||
}
|
||||
//does exists, but shouldn't
|
||||
else if(exists == true && shouldExist == false)
|
||||
else if(exists && !shouldExist)
|
||||
{
|
||||
callback(new customError("padID does already exist","apierror"));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue