forked from 0x2620/oxjs
less obscure Ox.map
This commit is contained in:
parent
33390069b9
commit
12cf77cef5
21 changed files with 125 additions and 101 deletions
|
|
@ -160,16 +160,13 @@ Ox.IconItem = function(options, self) {
|
|||
text = Ox.isArray(text) ? text.join(', ') : text;
|
||||
var lines = Ox.wordwrap(text, maxLength, '\n', true, false).split('\n');
|
||||
return Ox.highlightHTML(
|
||||
Ox.map(lines, function(line, i) {
|
||||
if (i < maxLines - 1) {
|
||||
return line;
|
||||
} else if (i == maxLines - 1) {
|
||||
return lines.length == maxLines ? line : Ox.truncate(lines.map(function(line, i) {
|
||||
return i < maxLines - 1 ? null : line;
|
||||
}).join(' '), maxLength, '...', 'center');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
lines.slice(0, maxLines).map(function(line, i) {
|
||||
return i < maxLines - 1 || lines.length == maxLines
|
||||
? line
|
||||
: Ox.truncate(
|
||||
lines.slice(maxLines).join(' '),
|
||||
maxLength, '...', 'center'
|
||||
);
|
||||
}).join(' <br/>'),
|
||||
self.options.find, 'OxHighlight', ['br']
|
||||
).replace(/ (<.*?>)?<br\/>/g, ' $1<br\/>');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue