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

cookiebanner

v1.4.0

Published

[![Build Status](https://api.travis-ci.org/nephila/cookie-banner.png?branch=master)](https://travis-ci.org/nephila/cookie-banner) ![Bower version](https://img.shields.io/bower/v/cookiebanner.svg) [![npm version](https://img.shields.io/npm/v/cookiebanner.s

Downloads

111

Readme

Cookie Banner

Build Status Bower version npm version

Cookie Banner is a super-easy way to ensure you're complying with the EU cookie law. Just reference the cookiebanner.min.js script from your page and you're done.

Cookie Banner script is very lightweight and depends on no JavaScript libraries, css files or images.

Install

You can install with bower or npm.

$ bower install cookiebanner
$ npm install cookiebanner

Build

$ grunt

Test

$ grunt ci

Quickstart

Add a single line to your web page, just before the closing </body> tag:

<script type="text/javascript" id="cookiebanner"
    src="js/cookiebanner.min.js"></script>

This will display a black-and-white floating banner at the bottom of your web page, informing the user that the site is using cookies, and giving them the link to a page with more information.

When the user clicks the "close" button, the banner will set a cookie (oh, the irony!) remembering that the banner was acknowledged, so the same user will not be bothered again.

Options

If you don't like the defaults, you can modify the banner content and style. The following options are settable through a data- property on the script tag:

  • position - banner position, top or bottom (default: bottom)
  • message - the message text
  • linkmsg - the link text content (default: Learn more)
  • close-text - the text/symbol for the close button (default: &#10006;)
  • effect - effect to use
  • cookie - name for the cookie to store the cookiebanner acceptance information (default: cookiebanner-accepted)
  • expires - cookie expiry date/time (defaults to Infinity aka Fri, 31 Dec 9999 23:59:59 GMT). There's basic support for specifying a callback function (more flexibility, must return one of Number, String, or Date -- see Cookies.set()). You can also just specify a valid UTC string.
  • cookie-path - Path to set for the cookie
  • moreinfo - where the visitor can read more about cookies (default: http://aboutcookies.org)
  • mask - whether to create a mask over the viewport (default: false). Clicking anywhere on the mask is considered as acceptance.
  • mask-opacity - the opacity to use for the window mask (default: 0.5)
  • mask-background - optional background style you wish to apply to the mask (default: #000)
  • zindex - z-index to set on the notice (default: 255). If mask is used, the notice 's z-index is automatically incremented by 1 so it appears above the mask)
  • close-on-interaction - automatically accept cookie policy after any interaction.

Here's an example:

<script type="text/javascript" id="cookiebanner"
    src="js/cookiebanner.min.js"
    data-position="top"
    data-message="We use cookies to improve your browsing experience.">
</script>

Internals and more options

If the banner needs to be shown, the script will create the following DOM subtree and add it just before the closing </body> tag:

<div class="cookiebanner">
    <div class="cookiebanner-close" style="float: right; padding-left:5px;">x</div>
    <span>Message</span>
    <a href=".." target="_blank">Learn more</a>
</div>

You can customize the banner appearance using css, here's an example using SCSS:

.cookiebanner {
    color: #FFF;
    background-color: #000;
    padding: 5px 16px;

    a {
        color: #FFF;
        text-decoration: underline;
        &:hover {
            color: #aaa;
        }
    }
}

.cookiebanner-close {
    color: #FFF;
    &:hover {
        color: #aaa;
    }
}

License

Copyright (C) 2013-2015 Good Code, Nephila

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.