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

@uncinc/cookie-consent

v1.1.1

Published

Cookie consent package for non headless frontend websites

Downloads

12

Readme

Unc Inc - Cookie consent

Cookie consent package for non headless frontend websites

How to implement in a non headless project in jquery:

Implement the following block in your main JS file, replacing YOUR_THEME with the proper folder:

    $(once('cookie-banner', 'html')).each(function(e) {
      const body = document.getElementsByTagName('body')[0];
      const div = document.createElement('div');
      div.id = 'uncinc-cookie-compliance';
      body.appendChild(div);

      $.getJSON('/themes/YOUR_THEME/cookie/cookie-consent.json', function(data){
          window.cookieBannerSettings = data;
          const head = document.getElementsByTagName('head')[0];
          const script= document.createElement('script');
          script.type= 'text/javascript';
          script.src= '/themes/YOUR_THEME/cookie/uncinc-cookie.min.js';
          head.appendChild(script);
      });
    });

Add a cookie consent json with the properties you want to set to the component, and include a build js from this project in the project as well in the proper folder.

See for example this JSON example:


{
  "loadDelay": 1000,
  "title": "Test",
  "manualText": "Zelf instellen",
  "acceptAllText": "Alles accepteren",
  "acceptSelectionText": "Selectie Accepteren",
  "onlyNecessaryText": "Alleen benodigde",
  "cookieContentsShowMore": "Toon meer",
  "cookieContentsShowLess": "Toon minder",
  "manualHeader": true,
  "cookieLevels": [
    {
      "value": "necessary",
      "label": "Nodig",
      "description": "Beschrijving",
      "disabled": true,
      "consentOptions": ["security_storage"]
    },
    {
      "value": "preferences",
      "label": "Voorkeuren",
      "description": "Beschrijving",
      "disabled": false,
      "consentOptions": ["functionality_storage", "personalization_storage"]
    },
    {
      "value": "statistics",
      "label": "Statistieken",
      "description": "Beschrijving",
      "disabled": false,
      "consentOptions": ["analytics_storage"]
    },
    {
      "value": "marketing",
      "label": "Test",
      "description": "Beschrijving",
      "disabled": false,
      "consentOptions": ["ad_personalization", "ad_user_data", "ad_storage"]
    }
  ],
  "defaultValues": {
    "necessary": true,
    "preferences": false,
    "statistics": false,
    "marketing": false
  },
  "bodyContents": "<h3>Welkom bij 'naam klant'</h3><p>Accepteer je deze cookies? <a href=\"test\"> zie onze cookie link </a></p>"
}

The component can be styled from the outside.