{"id":19006888,"url":"https://github.com/yowainwright/truncated.js","last_synced_at":"2025-08-01T20:38:05.442Z","repository":{"id":57380311,"uuid":"67905993","full_name":"yowainwright/truncated.js","owner":"yowainwright","description":"Text truncation that doesn't get in the way ✔️ is now called Shave -\u003e npm i shave","archived":false,"fork":false,"pushed_at":"2020-04-20T20:09:59.000Z","size":30358,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T21:03:35.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dollarshaveclub.github.io/shave/","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yowainwright.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-11T02:40:50.000Z","updated_at":"2017-11-05T10:35:12.000Z","dependencies_parsed_at":"2022-08-28T22:01:52.128Z","dependency_job_id":null,"html_url":"https://github.com/yowainwright/truncated.js","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yowainwright%2Ftruncated.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yowainwright%2Ftruncated.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yowainwright%2Ftruncated.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yowainwright%2Ftruncated.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yowainwright","download_url":"https://codeload.github.com/yowainwright/truncated.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240029662,"owners_count":19736624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T18:34:57.536Z","updated_at":"2025-02-21T14:26:10.811Z","avatar_url":"https://github.com/yowainwright.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version 0.1.1](https://badge.fury.io/js/truncated.js.svg)](https://www.npmjs.com/package/truncated.js)\n[![Bower version 0.1.1](https://badge.fury.io/bo/truncated.js.svg)](https://github.com/yowainwright/truncated.js)\n\n# Truncated.js\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/yowainwright/truncated.js.svg)](https://greenkeeper.io/)\n\n\u003e A plugin for effeciently and semantically truncating text.\n\nThis project is now called [**shave**](https://github.com/dollarshaveclub/shave) and is supported [here](https://github.com/dollarshaveclub/shave). ~Thanks\n\n\n## Setup\n\n```terminal\nnpm i truncated.js --save-dev\n```\nor\n```terminal\nbower i truncated.js --save-dev\n```\n\n## Run\n\n1. Add **dist/truncated.js**.\n2. `truncate` text within the element you'd like to.\n\n```javascript\ntruncated('selector', maxHeight);🔥\n```\n\n## Basic Examples\n\n**Basic**\n```javascript\ntruncated('selector', maxHeight);\n```\n\n**Or Multiples**\n```javascript\ntruncated('selector', maxHeight);\n```\n\n**But not this one**\n```javascript\ntruncated('selector:not([not this selector])', maxHeight);\n```\n**With a special symbol**\n```javascript\ntruncated('selector', maxHeight, {character:'🍻'});\n```\n\n**With a special CSS Class**\n```javascript\ntruncated('selector', maxHeight, {character:'🙌', classname:'your-css-class'});\n```\n\n**Or with jQuery**\n```javascript\n$('selector').truncated(maxHeight);\n```\n\n## How?\n\n**Truncated.js** trims an element's text string to the last full word that can fit within a specified max height.\n\n## Why?\n\n**Truncated.js** is made for simpicity; it doesn't try to oversolve truncation or provide tons of options. It truncates text to a max height.\n\n## What about the original text?\n\n**Truncated.js** re-adds the _diff_ of the original seleected elements's text in a hidden `\u003cspan\u003e`. It runs a check for that `\u003cspan\u003e` to make sure text is truncated as desired every time.\n\n## What about size?\n\n**Truncated.js** is small - `~1.5kb` unminified and is meant to do 1 thing - _truncate text to fit beatifully to a specified max height_.\n\n## How can I use it?\n\nYou can use **Truncated.js** in all modern formats and as a `jQuery` or `zepto` plugin.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyowainwright%2Ftruncated.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyowainwright%2Ftruncated.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyowainwright%2Ftruncated.js/lists"}