make sure truncation falls back to character split (bug 651929)
This commit is contained in:
Родитель
36996d7956
Коммит
a45d5239d1
|
@ -26,17 +26,19 @@ $.fn.truncate = function(opts) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
var chunk = Math.ceil(txt.length/2), oc=0, wid, delim;
|
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);
|
$tel.html(txt.slice(0,cutoff).join(delim)+truncText);
|
||||||
wid = (this[scrollProp] - this[offsetProp]);
|
wid = (this[scrollProp] - this[offsetProp]);
|
||||||
if (wid < 2 && chunk == oc || cutoff < 1) {
|
if (cutoff < 1) {
|
||||||
success = true;
|
break;
|
||||||
$el.addClass("truncated");
|
} else if (wid < 2 && chunk == oc) {
|
||||||
break;
|
success = true;
|
||||||
|
$el.addClass("truncated");
|
||||||
|
break;
|
||||||
} else if (wid > 1) {
|
} else if (wid > 1) {
|
||||||
cutoff -= chunk;
|
cutoff -= chunk;
|
||||||
} else {
|
} else {
|
||||||
cutoff += chunk;
|
cutoff += chunk;
|
||||||
}
|
}
|
||||||
oc = chunk;
|
oc = chunk;
|
||||||
chunk = Math.ceil(chunk/2);
|
chunk = Math.ceil(chunk/2);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче