Missing file from previous commit: Zotero.Utilities.ellipsize(str, len, countChars)
This commit is contained in:
parent
d1d70d3df8
commit
f5a9dd6812
|
@ -528,6 +528,24 @@ Zotero.Utilities.prototype.lpad = function(string, pad, length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shorten and add an ellipsis to a string if necessary
|
||||||
|
*
|
||||||
|
* @param {String} str
|
||||||
|
* @param {Integer} len
|
||||||
|
* @param {Boolean} [countChars=false]
|
||||||
|
*/
|
||||||
|
Zotero.Utilities.prototype.ellipsize = function (str, len, countChars) {
|
||||||
|
if (!len) {
|
||||||
|
throw ("Length not specified in Zotero.Utilities.ellipsize()");
|
||||||
|
}
|
||||||
|
if (str.length > len) {
|
||||||
|
return str.substr(0, len) + '...' + (countChars ? ' (' + str.length + ' chars)' : '');
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Port of PHP's number_format()
|
* Port of PHP's number_format()
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user