make sure truncation falls back to character split (bug 651929)

This commit is contained in:
Matt Claypotch 2011-04-21 14:57:01 -07:00
Родитель 36996d7956
Коммит a45d5239d1
1 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -26,17 +26,19 @@ $.fn.truncate = function(opts) {
break;
}
var chunk = Math.ceil(txt.length/2), oc=0, wid, delim;
for (counter = 0; counter < 10; counter++) {
for (counter = 0; counter < 15; counter++) {
$tel.html(txt.slice(0,cutoff).join(delim)+truncText);
wid = (this[scrollProp] - this[offsetProp]);
if (wid < 2 && chunk == oc || cutoff < 1) {
success = true;
$el.addClass("truncated");
break;
if (cutoff < 1) {
break;
} else if (wid < 2 && chunk == oc) {
success = true;
$el.addClass("truncated");
break;
} else if (wid > 1) {
cutoff -= chunk;
cutoff -= chunk;
} else {
cutoff += chunk;
cutoff += chunk;
}
oc = chunk;
chunk = Math.ceil(chunk/2);