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

hideablejs

v1.1.0

Published

Hide simply, flexibly, beautifully, gigglittely and surprisingly nicely

Downloads

9

Readme

hideable.js

By Nicolas Boisvert :: [email protected]

Hide simply, flexibly, beautifully, gigglittely and surprisingly nicely

  • Why simply? Because you don't do js on your own (I did all the stuff so give a virtual high five),
  • Why flexibly? Beacause you can modify any class/prop name easily to prevent interference with you present work.
  • Why beautifully ? Because it uses jQuery to do all the stuff and the magical magic behind (Go high five the jQuery team).
  • Why gigglittely ? Because well, you know...
  • Why surprisingly ? Because you'll be like "What? But why... how..." Eh?
  • Why nicely ? Because it's 1 include (assuming you use jQuery), 4 words (kind of) and the stuff is done.

I would like to thank anyone who helped me doing this :

  • My cat Louise, for biting my hand and sitting on my keyboard.
  • Tidge, beacause I thought "Hey is it cool?" and he said "That's cool".

Last release

Version 1.1

  • Added the possibility to defined closed element by default
  • Added Styles to your class element

Installation

Link the js file (Note that the path of the file may be different for you)

<script type="text/javascript" src="/js/hideable/hideable.js"></script>

Now we have two things ; A caller and a target (Of course you can use Some caller to some target also, depends on your needs)

<button class="hides" data-hides="socks_box">I am a caller</button>
<div class="hideable" data-hides="socks_box">
    This is a box containing stuff like your socks
</divl>

By default the caller needs class hides and the target needs class hideable. When you'll target a click event on the hides element, the hideable element will slide up/down depending on his states matched by the data-hides attributes

It could've been anything but I selected a button

And its done.

Customization

It may be possible that hides, hideable or the data-hides are already used class on your stuff. If you open the hideable.js file, you'll see an object called opts.

var opts = {
		event:'click',
		classes:{
			caller:'hides',
			target:'hideable',
		},
		props:{
			caller:'hides',
			state:'hidden',
			slides:'slides',
			slideSpeed:'slideSpeed',
			default:'default',
		},
		styles:{
			caller:{
				cursor:'pointer',
			},
			target:{},
		},
		slides:true,
		slideSpeed: 500,
		withStyle:true,
		log:false,
	}

These properties can be modified to fit your needs heres how :

  • event : The event that will trigger the hides, could be any jquery events that you can ship to the .on() method.
  • classes : You can rename thoses classes for something else
    • caller : Represent the classe of the element that'll trigger the event
    • target : Guess what? It's the one who'll slides on the event
  • props : The property you can add your your targets to do special stuffs. Here you will defin the name (you can switch them if needed)
    • caller : The property to match the caller and the target (In this case it'll be data-hides="")
    • state : The property to set the states of of the element
    • slides : We haven't talkded about it yet, but if you set this attribute (data-slides in hour case). Down there you'll see a global slide to prevent adding it to all of your element
    • slideSpeed : Used if you use the slides property, you can enter any and different speed from a target to another.
    • default : The default property is used to define if an element is closed by default by adding the value closed to the property, and tada! Magic!
  • styles : You can define some styles that'll be applied to the respective class values.
    • caller : Will apply the style (Which is by default the cursor to pointer) to all of your caller class
    • target : Will apply the style to all of your target class
  • slides : This is the global slides I was talking. Any target will act depending on this value except if you override it with the attributes in you html
  • slideSpeed : The default speed, this also prevent rewriting the speed attribute everywhere
  • withStyle : If you don't want any style to be applied, turn this off
  • log : If you wanna see what's going on, you can set this to true and everything will be console logged, well, it may reduces the performances of the so it's not recommanded in production

If you want to add stylable classes, you have to add them to you class object and your styles object. If you don't you'll broke everything and you may get mad.

Conclusion

Thank you for using it and feel free to contact me for any question.

Ending joke :

Q : Why did the programmer quit his job ? A : Because he didn't get arrays. (a raise)