Truncate text with javascript