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

cardsJS

v1.1.1

Published

Scalable playing cards with various hand layouts.

Downloads

584

Readme

cardsJS

Travis build status npm version

Showing playing cards that are scalable in a browser is possible with cardJS. See the web site for some examples and the wiki for documentation.

I'm using the Vectorized Playing Cards 1.3 designed by Chris Aguilar, see the readme file for the details. The original SVGs are changed to not render in an A4 page, but to fit to size.

The change log is automatically produced with the help of semantic-release.

Getting started

cardsJS is available for Node.js and most modern browsers. If you want to know if your currrent browser is compatible, run the online test suite.

Install with npm

> npm install cardsJS --save

Browser

Include the package from the unpkg CDN

<link rel="stylesheet" type="text/css" href="https://unpkg.com/cardsJS/dist/cards.min.css" />

<script src="https://unpkg.com/cardsJS/dist/cards.min.js" type="text/javascript"></script>

Cards

Use the <img class='card' src='cards/id.svg'> HTML tag; where id is the identifier of the card. The id is composed of the rank and then the suit of the card, e.g. 'KS' is the King of spades. The suits are 'S', 'H', 'D' and 'C' for spades, hearts, diamonds and clubs. The rank '10' of a suit x is either '10x' or 'Tx'.

The king of spades is rendered as <img class='card' src='cards/KS.svg'>.

Hands

Cards can be grouped into a hand. A hand is a <div class='hand'> containing the card(s). With an active hand, <div class='hand active-hand'>, moving the mouse over a card will move it veritically/horizontally to indicate that the card will be selected.

<div class="hand hhand-compact active-hand">
    <img class='card' src='cards/AS.svg'>
    <img class='card' src='cards/KS.svg'>
    <img class='card' src='cards/QS.svg'>
    <img class='card' src='cards/JS.svg'>
    <img class='card' src='cards/10S.svg'>
    <img class='card' src='cards/9H.svg'>
    <img class='card' src='cards/3H.svg'>
</div>

A hand can also be declared with the data-hand attribute, see Controlling the hand for more details. Also see Controlling the fan

<div class="hand active-hand"
     data-hand="flow: horizontal; cards: AS,KS,QS,JS,10S,9H,3H">
</div>

Hello world

<html>
  <head>
    <link rel="stylesheet" type="text/css" href="cards.css">
    <title>Hello CardsJS</title>
  </head>
  <body>
  <p>
    The king of spades is rendered as <img class='card' src='cards/KS.svg'>.
  </p>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
  <script src="cards.js"></script>
  </body>
</html>

Run the hello world sample using rawgit.

License

Copyright © 2015 Richard Schneider ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.