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

@omatech/oma-cookies

v1.3.1

Published

Cookies consent manager

Downloads

9

Readme

Install the package

npm i @omatech/oma-cookies

Import the main js file into your project:

require('@omatech/oma-cookies/dist/js/omacookies.min');

Optionally you can copy into a public folder the JS file located inside the /node_modules/@omatech/oma-cookies/dist/js folder and link it in your HTML layout

<script src="/path_to_copied_file/omacookies.min.js"></script>

There are 2 approaches depending on your styling method:

A) If you are ONLY overriding CSS classes => Import the compiled CSS file

@import "~@omatech/oma-cookies/dist/css/omacookies.min.css"

Optionally you can copy into a public folder the CSS file located inside the /node_modules/@omatech/oma-cookies/dist/css folder and link it in your HTML layout

<link href="/path_to_copied_file/omacookies.min.css" rel="stylesheet">

B) If you want to override the variables and CSS classes => Import all the separated files

@import "~@omatech/oma-cookies/dist/scss/base"
@import "~@omatech/oma-cookies/dist/scss/variables"
//Your own SCSS file overriding the variables from the file above
@import "variables"
@import "~@omatech/oma-cookies/dist/scss/styles"
<meta name="viewport" content="width=device-width, initial-scale=1">

To start things up, you must add this somewhere in your HTML layout (preferably at the end)

<body>
...
<div id="omacookies"></div>
</body>

Every iframe must have the attribute data-omacookies-consent which has 2 possible values marketing or statistics. This specitfy when the content will be un/blocked

The attribute data-omacookies-yt-video-id is the ID found at the end of every YouTube video URL. In /watch?v=uu5k19UaCT0 the ID would be uu5k19UaCT0

<div
    class="omac-iframe-youtube"
    data-omacookies-consent="marketing"
    data-omacookies-yt-video-id="uu5k19UaCT0"
></div>

The attribute data-omacookies-src would work as the normal iframe src attribute

You can add any attribute to the rendered iframe using the attribute data-omacookies-xxx. Simply change xxx for any other attribute. See the attribute width shown in the example.

<div
    class="omac-iframe"
    data-omacookies-consent="statistics"
    data-omacookies-src="https://example.com/"
    data-omacookies-width="720"
></div>

It is required to add the type="text/plain" attribute.

  • For file JavaScript scripts
<script
    class="omac-script"
    type="text/plain"
    data-omacookies-consent="statistics"
    src="https://example.com/"
></script>
  • For inline JavaScript code
<script
    class="omac-script"
    type="text/plain"
    data-omacookies-consent="statistics"
>
    console.log("Hello World!");
</script>
window.OMAC.SelectionModal.open();

Somewhere after the import of the omacookies JS file we will override attributes from the main object.

We can set a new value for any language string with the following declaration:

window.OMAC.available_languages.es.select_box_title = 'Personalizar Cookies';

We can add as many languages as we want, we just need to follow the same object structure we already have for ES and EN.

You can copy the structure from /node_modules/@omatech/oma-cookies/src/lang/en.json

For example, we will add German language:

window.OMAC.available_languages.de = {
    "constent_box_title": "Diese Website verwendet Cookies",
    ...
};

Make sure to set the language after you make any modifications to the available_languages object.

window.OMAC.setLang("en");

Here we will add the website link where the user will be redirected to read the cookie policy.

window.OMAC.readMoreLink = "https://omatech.com/cookies.html";

Here we can set the appearance of the initial cookie dialog. The allowed values are modal (default) or banner.

window.OMAC.format = "banner";

The quick link is enabled by default. Disable it setting the following:

window.OMAC.enableQuickLink = false;

To open the cookies selection modal when disabled, use the this method

Here we can configure in which corner of the screen will the quick link be located, using the values top-right , top-left, bottom-right or bottom-left. The quick link will appear on the bottom-right by default.

window.OMAC.quickLinkPosition = "bottom-left";

This project has MIT license. For further information, read the LICENSE file.