New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

littering

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

littering

ender based library for littering text with span markup, based on Lettering.js

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
1
Created
Source

#Littering - a less elegant javascript span injector

Littering is an ender based variation of Lettering.js. Where lettering.js injects positional classes for styling chars/words/lins, Littering accepts functions to determine which classes to apply to which elements.

##See it

Check the examples at http://cjc.github.com/littering

##Use it

Get littering by including it in your ender build

ender add littering

###Lettering.js compliant behaviour

Littering mimics the same api as Lettering.js for the base functionality of decorating chars/words/lines with their position.

$("#demo1 h1").littering();
$("#demo2 h1").littering('words');
$("#demo3 p").littering('lines');
$("#demo4 h1").littering('words').children("span").littering();
$("#demo5 h1").littering().children("span").css({'display':'inline-block', '-webkit-transform':'rotate(-25deg)'});

###Other functionality

In addition to simply numbering elements, littering accepts custom formatter functions to allow arbitrary substitution of elements and complex class setting.

$("#demo6 h1").littering('chars',function(){return 'a'});`
$("#demo7 h1").littering('chars',function(item,i){
  var str = item.charCodeAt(0) > 64 && item.charCodeAt(0) < 91 ? " upper" : "" ;
  return '<span class="char'+(i+1)+str+'">'+item+'</span>';
});

##History

0.0.2 - Enable and add examples for passed formatter functions. 0.0.1 - Replicate Lettering.js functionality running on ender.

##Credits

Inspiration and some (ok, a bunch of) code (examples/index.html, the injector func) pinched from the excellent Lettering.js.

##License

Released under the WTFPL license

FAQs

Package last updated on 19 Mar 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts