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

ab-element

v1.4.4

Published

AB Element - DOM Element with super powers.

Downloads

19

Readme

ab-element

DOM Element prototype addons.

methods

  • Element.prototype.hasClass // same as jQuery equivalent
  • Element.prototype.addClass // same as jQuery equivalent
  • Element.prototype.removeClass // same as jQuery equivalent
  • Element.prototype.toggleClass // same as jQuery equivalent
  • Element.prototype.setChildOf // moves element to a new parent
  • Element.prototype.preloadImagesAndCallBack // preloads all IMGs inside element and calls a given callBack
  • Element.prototype.activateSuperPowers // activates x, y, z, width, height, rotation, scale, animated, opacity
  • Element.prototype.loadImageInside //creates an IMG element inside with given src, provides two on-load options: callback and fade in
  • Element.prototype.loadImage // assumes element is IMG, applies src and provides two on-load options: callback and fade in
  • Element.prototype.loadImageBackground // (src, onLoadCallBack) loads an image as background-image
  • Element.prototype.loadImageBackgroundFadeIn // (src, onLoadCallBack, disableFadeIn) loads an image as background-image and fades it in
  • Element.prototype.changeElementType // creates a new element of desired tagName, replaces it with current element and move in HTML contents
  • Element.prototype.getStyle // cross-browser helper to get style values
  • Element.prototype.onTap // sets up a touch "tap" handler, with distance tolerance (in px) and a click fallback in non-touch devices
  • Element.prototype.activateCSSTransitions // sets up CSS transitions, accepts property value (can be 'all') and transition duration. Major vendor prefixes included
  • Element.prototype.deactivateCSSTransitions // removes CSS transitions

properties

  • x
  • y
  • z
  • width
  • height
  • rotation
  • scale
  • animated

Install

With npm do:

$ npm install ab-element --save-dev

Usage

require('ab-element');

var my_el = addChildToBody('DIV');
my_el.activateSuperPowers();
my_el.animated = true;
my_el.x = 50;
my_el.y = 50;
my_el.width = 50;
my_el.height = 50;
my_el.bgColor = 'red';
my_el.hasClass('some-class');
my_el.addClass('some-class');
my_el.removeClass('some-class');
my_el.toggleClass('some-class');
my_el.rotation = 45;
my_el.scale = 3;
my_el.changeElementType('IMG');
my_el.loadImage('http://lorempixel.com/400/200/', function(){ console.log('image loaded')}, true );
my_el.onTap(function(){ test.rotation = Math.random() * 360; });

License

MIT