(I thought I submitted this just now, but it's not showing up.)
Drupal.truncateUtf8 = function (string, len, wordsafe, dots) {
if (string.length <= len) {
return string;
}
if (dots) {
len -= 4;
}
if (wordsafe) {
string = string.substring(0, len + 1);
if (lastSpace = string.lastIndexOf(' ')) {
string = string.substring(0, lastSpace);
}
else {
string = string.substring(0, len);
}
}
else {
string = string.substring(0, len);
}
if (dots) {
string += ' ...';
}
return string;
}
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | example.patch | 1.05 KB | jpmckinney |
Comments
Comment #1
litwol commentedSubmit a patch please. information on how to make patches is here: http://drupal.org/patch
Comment #2
jpmckinney commentedComment #3
jpmckinney commented