npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sjaakp/telex

v2.0.7

Published

Horizontal message scroller

Downloads

1,015

Readme

Telex 2.0

News scroller

Telex is a horizontal news scroller for text messages. It can be used for continuously displaying breaking news, traffic information, stock quotes, and the like. Messages can be added or removed while scrolling, speed and other options can be updated.

Telex is a Javascript (ES2015) widget. It works with modern browsers supporting the CSS property animation. This includes:

  • IE >= 10
  • Edge
  • Firefox >= 38
  • Chrome >= 43
  • Safari >= 9
  • Opera >= 32
  • Android Browser >= 44

A demo of Telex is here.

Here is Telex's GitHub page.

Telex is distributed under the MIT License.

Installing

Install Telex with Bower:

bower install telex

You can also manually install Telex by downloading the source in ZIP-format.

Dependencies

From version 2.0, Telex has no external dependencies whatsoever.

Usage

  • Load /dist/telex.js.
  • Create a <div> with an id.
  • In the document-ready function, set a Javascript variable with the result of a call to the function Telex.widget with parameters id, options and (optionally) the first messages. Options are in a Javascript Plain Old Object, messages are in a Javascript Array.

A minimum HTML page with a Telex would look like this:

<html>
<body>

	<div id="tx"></div>

	<script src="/dist/telex.js"></script>

	<script>
		$(document).ready(function () {
			var qtx = Telex.widget("tx", {/* options */}, [/* messages */]);
	</script>
</body>
</html>

The Telex-container gets the CSS-class telex. This may also be used for styling purposes.

Load from CDN

You may also load the Telex code from a content distribution network (CDN), like so:

<script src="https://unpkg.com/@sjaakp/telex/dist/telex.js"></script>

Messages

Messages can be set at create time, but also by assigning a value to Telex's property messages, like so:

qtx.messages: [
		{
        	id: 'msg1',
        	content: 'This is the first message'
		},
		{
        	id: 'msg2',
        	content: 'This is the second message',
			class: 'cls-second'
		}
		/* more messages... */
	]
	/* more options... */
	});

messages is an Array of Objects, each representing a message, with the following properties:

content

The content of the message. Can be text, but also a piece of HTML (like a link).

id

Optional. Id of the message, starting with a word character. It is only used in the remove method. It is not employed as a DOM-id.

class

Optional. The CSS-class of the message. May be used for styling purposes.

A message may also be represented by a String in stead of an Object.

Other options

Telex has the following general options:

speed

integer or float. Scrolling speed in pixels per second. Default: 200.

direction

string. Scroll direction. Can be normal (from right to left) or reverse (from left to right). Default: normal.

timing

string. Determines the way a single message scrolls. Can be any value valid for the animation-timing-function. Default: linear. Another sensible value would be ease-in-out.

pauseOnHover

boolean. Determines whether the scrolling pauses when the mouse cursor hovers above it. Default: false.

onCycle

function(tlx). Callback function, called after each completed cycle of newly loaded messages. This may be used as an opportunity to load new (realtime) messages.

Setting and getting options

Options can (and should) be set at create time, and later simply by assigning a value to the Telex property with the option name:

qtx.speed = <newValue>;  

Options can be read with:

<value> = qtx.direction;

Methods

Telex has five methods. They can be called like:

qtx.add({
	id: "newMsg",
	content: "This message will be added while Telex is running"
});  

add(message)

Adds a message to Telex while it is scrolling. Note that it takes some time for the message to appear.

remove(id)

Removes the message with the given id.

update(id, message)

Updates the message with the given id.

pause()

Pauses the scroller.

resume()

Resumes scrolling.

Building telex.js

Be sure that npm is installed.

Run npm install.

Run rollup -c.