I need to implement ellipsis (\"...\") in the middle of a text within a resizable element. Here is what it might look like. So,
\"...\"
\"Lorem ipsum do
Here's the shortest bit I could find which replaces 3 characters in the middle with ....
function shorten(s, max) { return s.length > max ? s.substring(0, (max / 2) - 1) + '...' + s.substring(s.length - (max / 2) + 2, s.length) : s }