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

@dunks1980/cookiemunch

v1.3.11

Published

A simple, customizable, minimal setup cookie plugin that allows your users to select which cookies to accept or decline.

Downloads

902

Readme

Cookiemunch

Its a simple, customizable, minimal setup cookie plugin that allows your users to select which cookies to accept or decline. Go to Cookiemunch for documentation and demos.

If you wish to support this project please buy me a coffee.

How do I install it?

npm i @dunks1980/cookiemunch --save

As a custom element:

Add the following element and script tag to the body of your web page.

The custom element option is best for preventing CSS on the page interfering with Cookiemunch's CSS.

<cookie-munch css-file="https://unpkg.com/@dunks1980/cookiemunch/cookiemunch.min.css"></cookie-munch>
<script src="https://unpkg.com/@dunks1980/cookiemunch/cookie_munch_element.min.js"></script>

Without package manager:

Add the following script and style tags inside the head of your web page.

<script src="https://unpkg.com/@dunks1980/cookiemunch/cookiemunch.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@dunks1980/cookiemunch/cookiemunch.min.css">

Optional themes:

<!-- https://unpkg.com/@dunks1980/cookiemunch/cookiemunch_flat_light.min.css -->
<!-- https://unpkg.com/@dunks1980/cookiemunch/cookiemunch_flat_dark.min.css --> 

Boilderplate settings:

This code should run after Cookiemunch scripts have loaded.

Settings are optional, tweak to your needs.

<script>
cookiemunch_options = {
  settings: {
    reload: false,
    required: false,
    hide_icon: false,
    cookies_to_exclude: [],
    keep_all_cookies: false,
    first_visit_checked: false,
    start_dropdown_closed: false,
    check_switch_icons: false,
    cookies_duration: 365,
    cookies_secure: false,
    cookie_image: 'https://unpkg.com/@dunks1980/cookiemunch/cookiemunch.svg',
    cookie_title: 'Cookies settings',
    cookie_optional: 'Optional',
    cookie_required: 'Required',
    cookie_accept_label: 'Allow Cookies:',
    cookie_required_label: 'These Cookies are required in order for the site to function.',
    cookie_button_none: 'None',
    cookie_button_required: 'Required',
    cookie_button_select: 'Select',
    cookie_button_selected: 'Selected',
    cookie_button_all: 'All',
    cookie_button_no: 'No',
    cookie_button_yes: 'Yes',
    cookie_button_agree: 'Close'
  },
  cookies: [
    {
      id: 'Optional Example',
      group: '',
      name: 'Optional Example',
      used_for: 'Description or what this cookie is for.',
      url_text: 'Read more',
      url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies',
      accepted_function: accepted_function,
      declined_function: declined_function
    }
  ],
  required_cookies: [
    {
      name: 'Essential cookies',
      used_for: 'these are cookies that are either: used solely to carry out or facilitate the transmission of communications over a network; or. strictly necessary to provide an online service (e.g. our website or a service on our website) which you have requested.',
      url_text: 'Read more',
      url: 'https://gdprprivacypolicy.org/cookies-policy/'
    }
  ]
};

function accepted_function() {
  console.log("accepted_function");
}

function declined_function() {
  console.log("declined_function");
}

// loads Cookiemunch with the above settings
cookiemunch(cookiemunch_options);
</script>