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

jfortune

v1.2.1

Published

A wheel of fortune plugin for jquery.

Downloads

26

Readme

jfortune travis

A jquery plugin to make wheel of fortunes (roulettes)

Working examples:

  • http://codepen.io/tehsis/pen/AFCwz
  • http://codepen.io/tehsis/pen/zilBg
  • http://codepen.io/asleepypenguin/pen/bebZBj // Counter clockwise and divided wedges

Description

Provides an UI component to make roulettes effects and provides methods to handle the prices on which the roulette stops.

Usage

// You can initialize the roulette by specifying the number of elements
$(selector).roulette(8);

// Or by passing an array of elements
$(selector).roulette([{description: '1000 u$s'}, {description: '200 u$s'}]);

// Array elements can also be arrays of elements to allow for split wedges
$(selector).roulette([
    {description: '1000 u$s'}, 
    {description: '200 u$s'},
    [{description: '100 u$s'},{description: '5000 u$s'},{description: '100 u$s'}]
    ]);

// Or you can fully configurate the roulette behaviour
$(selector).roulette({
  prices: [{description: "1000 u$s"}, {description: "200 u$s"}],
  duration: 3000, // The amount of milliseconds the roulette to spin
  separation: 2, // The separation between each roulette price
  min_spins: 10, // The minimum number of spins 
  max_spins: 15, // The maximum number of spins
  clockWise: true, // The direction the wheel will spin
  onSpinBounce: function() {
    Sounds.play('taka');
  } // A callback to be called each time the roulette hits a price bound.
})

// After initialization you can spin the wheel and it will turn to a random
// position.
$(selector).spin();

// Or you can specify a predefined position
$(selector).spin(4);

// The spin methods returns a promise, which its first arguments is the object that
// is at that position (only if you have used the second form of initilization)
$(selector).spin().then(function(price) {
  console.log(price.description);
});

// or you can specify a fixed price
$(selector).spin(1).spin().then(function(price) {
  console.log(price.description); // "200 u$s"
});

Usage notes

The plugin must be initiated using and array of elements or a number. Both, the array length or the number's value, must be conscistent with the number of positions your roulette's image has, this is not magic. (yet).

At this moment, the css' styles for the roulette animation are hard-coded inside the plugin. This has been done on porpouse to not requiring external files.