fast, intelligent javascript text truncation