• This repository has been archived on 09/Jun/2022
  • Stars
    star
    486
  • Rank 90,527 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Multi-line ellipsis made possible

FTEllipsis Build Status

Solves the problem of applying ellipsis (…) on a multi-line block of text at the point it overflows its container. Ellipsis will work in conjuction with CSS column-count if you wish.

Results are best in webkit browsers due to the availability of webkit-line-clamp. For non-webkit browsers FTEllipsis falls back to clamping text and positioning an element over the end of the overflowing line, allowing the developer to style this however they wish.

Getting Started

NPM
$ npm install ftellipsis
Bower
$ bower install ftellipsis

or download the production version or the development version.

Examples

Usage

var element = document.getElementById('my-element');
var ellipsis = new Ellipsis(element);

ellipsis.calc();
ellipsis.set();

Requirements:

  • The element must have a fixed height so that content overflows.
  • The element must have child elements (eg. <p>s).

Unsetting

Unsetting an ellipsis instance removes any styling.

ellipsis.unset();

Destroying

Destroying an ellipsis instance resets the instance back to it's original state, unsetting internal variables and state.

ellipsis.destroy();

Tests

$ npm install
$ npm test

API

Ellipsis();

Initialize a new Ellipsis instance with the given element.

Options:

  • container A parent container element
  • reRender Forces a redraw after ellipsis applied

Ellipsis#calc();

Measures the element and finds the overflowing child.

Ellipsis#set();

Clamps the overflowing child using the information acquired from #calc().

Ellipsis#unset();

Unclamps the overflowing child.

Ellipsis#destroy();

Clears any references

Credits and collaboration

The lead developer of FTEllipsis is Wilson Page at FT Labs. All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request. Enjoy...

More Repositories

1

fastclick

Polyfill to remove click delays on browsers with touch UIs
HTML
18,668
star
2

ftscroller

FTScroller is a cross-browser Javascript/CSS library to allow touch, mouse or scrollwheel scrolling within specified elements, with pagination, snapping and bouncing support.
JavaScript
1,186
star
3

ftcolumnflow

A polyfill that fixes the inadequacies of CSS column layouts
JavaScript
633
star
4

fruitmachine

View rendering engine
JavaScript
247
star
5

transcription-service

A Node.js server that accepts audio/video files and transcribes the content
JavaScript
61
star
6

ftdatasquasher

Data compression and decompression support, packing base64 into UTF8 high and low bytes
JavaScript
39
star
7

big-ft

A view of the FT homepage designed for non-interactive video walls and billboards
JavaScript
23
star
8

perf-widget

JavaScript
22
star
9

Hancock

A Node.js module for determining a similarity between handwritten signatures.
JavaScript
17
star
10

text-summarization-experiment

Experiment on text summarization techniques and exploring Tensorflow.
Jupyter Notebook
15
star
11

three-sixty-video

Experiment with converting 360videos to VR.
JavaScript
14
star
12

screens

A way to distribute websites to multiple displays
JavaScript
12
star
13

single-frame-video

Simple service to convert mp3s to mp4s with images for social networks
Handlebars
8
star
14

alignment

exploring Go, aligning some text, looking for poetry, for faux-artistic reasons
Roff
8
star
15

tech-radar

Generate tech-radars based off of Google Spreadsheets
JavaScript
7
star
16

autovoice-podcast

take in an rss feed of articles, return a podcast of those articles with automated voices
JavaScript
7
star
17

inklink

Image recognition tool
JavaScript
6
star
18

email-signatures

A Chrome Extension that automagically adds links from RSS feeds to the end of emails sent in the Gmail web client
JavaScript
6
star
19

Signature-Signatures

A small exploration to try to match handwritten signatures by generating a fingerprint out of the number of black pixels along the Y Axis of the image
JavaScript
6
star
20

fruitmachine-media

FruitMachine helper that allows different setup and teardown callbacks to be called based on media queries
JavaScript
6
star
21

googlehome

Experimenting with what is possible with via voice commands on the Google Home
JavaScript
4
star
22

textrequireify

Browserify transform that includes text files using `requireText('module/filename')` syntax.
JavaScript
4
star
23

gpt2-gui

GPT-2 prototype/investigation
Python
3
star
24

Screens-Chrome-App

A kiosk-enabled app for Chrome to use with FT Labs Screens project
JavaScript
3
star
25

chatbot

An FT bot
JavaScript
3
star
26

o-three-sixty

Three Sixty Video Player powered by Brightcove
JavaScript
3
star
27

overview

Exploration(s) of summarising and displaying news
JavaScript
3
star
28

cite-n-snap

JavaScript
3
star
29

ftlabs.github.io

porting the team blog to github pages
HTML
2
star
30

idiom-explorer

whimsical investigation into use of idioms in news articles
JavaScript
2
star
31

suggestr

Recommendation algorithm(s)
JavaScript
2
star
32

Listen-to-the-FT

Make podcasts great again.
JavaScript
2
star
33

correlations-game-test

Trying out Alexa testing via Mocha
JavaScript
2
star
34

fruitmachine-ftdomdelegate

An ftdomdelegate plugin for FruitMachine
JavaScript
2
star
35

audio-search

Want to find audio content on the FT? No problem!
JavaScript
2
star
36

Twitter-digest

Chrome extension for Twitter filtering
JavaScript
2
star
37

webtorrent-audio

Where possible, deliver audio files to clients using WebTorrent
JavaScript
2
star
38

fruitmachine-bindall

A FruitMachine helper that binds all the methods in FruitMachine modules to each instance
JavaScript
2
star
39

barcode

An API endpoint to gather all of the main images used in FT articles from a provided date range, the last 24 hours for example, and squash them (width wise) to give one condensed image that represents the news. The final result looks similar to a coloured barcode.
JavaScript
2
star
40

ft-quiz

Automated quiz api for news in specified date range.
JavaScript
1
star
41

key-fetch

Get keys for your project
JavaScript
1
star
42

ft-dash

A minimal view of FT content designed for as a HUD for car dashboards
JavaScript
1
star
43

Absorber

The (newly separated) absorber component of the Ingestion service.
JavaScript
1
star
44

PPS

Product Project Summariser
JavaScript
1
star
45

left

Handlebars
1
star
46

inshort

JavaScript
1
star
47

email-signatures-server

JavaScript
1
star
48

summarize

1
star
49

assistant-authenticator

A service for ephemerally linking an FT user to a Google Home device
JavaScript
1
star
50

fruitmachine-fastdom

A fastdom helper for FruitMachine
JavaScript
1
star
51

touchbar-news

It puts the news on your shiny Macbook's Touch Bar
JavaScript
1
star
52

correlations-game

A Node.js app for playing the FT Labs Correlation game
HTML
1
star
53

Interrogable-Articles-Demo

A PWA to demonstrate the concept of 'interrogable' articles
JavaScript
1
star
54

audio-available

A small Node.js app for checking whether or not an audio version of an FT article exists.
JavaScript
1
star
55

correlations-service

exploring a node version of slurp which was a ruby version of a graph db
JavaScript
1
star
56

time-to-read

A lambda that provides the reading time from a text and image input.
JavaScript
1
star
57

FT-Labs-AWS-Archives

A PoC for having AWS OCR the entire FT Digital Archive
JavaScript
1
star
58

Falcon-Snippets

Content scripts for manipulating FT content on the Falon ft.com site
JavaScript
1
star
59

chars-to-wav

Letters in, sounds out
JavaScript
1
star
60

audio-management

A place for managing audio assets at the FT
Handlebars
1
star
61

js-abbreviate

Takes *any* JavaScript object and returns a JSON-serializable finite-sized copy of it.
JavaScript
1
star
62

order-order

A swiss army knife of various forms of structured comments.
JavaScript
1
star
63

pages

experiments with simple static pages
JavaScript
1
star
64

fruitmachine-boundarize

FruitMachine helper to isolate components from the rest of the DOM tree
JavaScript
1
star
65

boilerplates

some simple, no-nonsense examples of things
HTML
1
star