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

cookie-notice

v1.3.9

Published

A very simple configurable and small (4.5kb / 2kB gzipped) vanilla JS lib with out of the box multi language support [it, en, fr, pt, es, nl, de, pl] for GDPR/DSGVO and notification purposes

Downloads

7,345

Readme

Build status — Travis-CI cookie-notice on Npmjs License Total downloads ~ Npmjs Size of Javascript

CookieNotice

CookieNoticeJS is a very simple, extendable and small (→ 2 kB gzip) vanilla JS script with multi language support for GDPR/DSGVO‎ transparency and notification purposes that provides an easy way to show a cookie notice on your website.

Cookie notice at the bottom of the page

Cookie notice at the top of the page

Available via npm

npm install cookie-notice
npm test

To use in your project There are plenty ways for integration:

When installed via npm, include in any project by using path below:


<script src="node-modules/cookie-notice/dist/cookie.notice.min.js"></script>

For usage with Angular2+ add line below in "scripts" section in angular-cli.json:

{
    "scripts": [
        "../node_modules/cookie-notice/dist/cookie.notice.js",
        "../optional/path/to/custom/cookie-notice-config.js"
    ]
}

When cloned directly from gitHub use path below:


<script src="cookie-notice/dist/cookie.notice.min.js"></script>

Behavior

You will get a dismissable banner on the bottom of your pages showing a default cookie audit like the following:

We use cookies to make sure you can have the best experience on our website. If you continue to use this site we assume that you will be happy with it.

You can check out an example integration at Deutsche Telekom.

Depending on the visitor browser language one of the preloaded translations will be shown. At the moment ** CookieNoticeJS** supports following languages out of the box:

  • IT (Italiano)
  • EN (English) default
  • FR (Français)
  • PT (Português)
  • ES (Español)
  • NL (Nederlands)
  • DE (Deutsch)
  • PL (Polski)

You can also add any other language code

If you want to contribute with an extra language or find translation issues do not hesitate to open an issue or a PR.

CookieNoticeJS has been successfully tested on IE9+, Chrome, Firefox and Safari.

Customize CookieNoticeJS

For the most of you including the script should be enough but CookieNoticeJS comes with many customization options. Let's see an example:


<script src="js/cookie.notice.min.js"></script>
<script>
    new cookieNoticeJS({

        // Localizations of the notice message
        'messageLocales': {
            'it': 'Custom localized message'
        },

        // Localizations of the dismiss button text
        'buttonLocales': {
            'it': 'Chiudi'
        },

        // Position for the cookie-notifier (default=bottom)
        'cookieNoticePosition': 'top',

        // Shows the "learn more button (default=false)
        'learnMoreLinkEnabled': false,

        // The href of the learn more link must be applied if (learnMoreLinkEnabled=true)
        'learnMoreLinkHref': '/learn/more/index.html',

        // Text for optional learn more button
        'learnMoreLinkText': {
            'en': 'learn more'
        },

        // The message will be shown again in X days
        'expiresIn': 30,

        // Specify a custom font family and size in pixels
        'fontFamily': 'inherit',
        'fontSize': '12px',

        // Dismiss button background color
        'buttonBgColor': '#d35400',

        // Dismiss button text color
        'buttonTextColor': '#fff',

        // Notice background color
        'noticeBgColor': '#000',

        // Notice text color
        'noticeTextColor': '#fff',

        // the learnMoreLink color (default='#009fdd')
        'linkColor': '#f00',

        // The target of the learn more link (default='', or '_blank')
        'linkTarget': '',

        // Print debug output to the console (default=false)
        'debug': false
    });
</script>

Configuration via data- attribute

Configuration options can be put in a data-cookie-notice HTML attribute in JSON format. Note, you can include the Javascript from the unpkg CDN (browse). For example:


<script
    data-cookie-notice='{ "learnMoreLinkEnabled": true, "learnMoreLinkHref": "/privacy.html" }'
    src="https://unpkg.com/cookie-notice@^1/dist/cookie.notice.min.js"
></script>

Author

Alessandro Benoit

Contributors

License

License: MIT