Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
custom-consent-popup
Advanced tools
Readme
The CustomConsentPopup
class is designed for creating and managing a customizable confirmation modal window. This modal window can be used for various purposes, such as user consent for cookies, terms of service, or other custom notifications.
The modal window's behavior and appearance can be configured with the following properties:
show
: Determines if the modal window is initially visible (true) or hidden (false).backgroundBlock
: If true, the modal window overlay is non-interactive; if false, it allows interaction.backgroundBlockColor
: Sets the color of the background overlay when backgroundBlock
is true.position
: A predefined stylesheet value ("center", "bottom", or "top") determining the modal window's position and size.consentExpirationTime
: Manages the display of the consent modal based on user interactions.
modalWindowHeaderHTML
: HTML content for the modal window's header.modalWindowBodyHTML
: HTML content for the main body of the modal window.positiveButtonText
: Text for the positive (confirmation) button.negativeButtonText
: Text for the negative (decline) button.hidemodalWindowOnNegativeClick
: Whether to hide the modal window on clicking the negative button.localStorageObjectName
: Name for the local storage object to store consent date.blockScroll
: Blocks page scrolling when the modal window is displayed if set to true.removeAllContentOnNegativeClick
: If true, removes all content from the document body on a negative button click.onlyPositiveButtonOnModalWindow
: If true, removes negative button from the modal window. False is default.onPositiveButtonClickcallback
: Callback function for when the positive button is clicked.onNegativeButtonClickCallback
: Callback function for when the negative button is clicked.onPreviousConsentFoundCallback
: Callback function for when previous consent is found.onmodalWindowRenderedCallback
: Callback function for when the modal window is rendered.You can find demonstrational sample in examples/main.js
To use CustomConsentPopup
, create an instance with your custom settings and initialize it when the DOM is fully loaded. This can be done using the DOMContentLoaded
event:
document.addEventListener('DOMContentLoaded', (event) => {
// Define your custom settings
const options = {
// Your options here
position: 'center',
consentExpirationTime: true,
// ... other options ...
};
// Initialize the CustomConsentPopup with your options
CustomConsentPopup.init(options);
})
examples/main.js
const options = {
consentExpirationTime: 5,
position: 'top',
backgroundBlock: true,
backgroundBlockColor:'rgba(125, 125, 125, 0.5)',
blockScroll: false,
onPositiveButtonClickCallback: function() {
console.log('hey-hey');
}
};
myConsentPopup.init(options);
Open your terminal or command prompt and install CustomConsentPopup
by running:
npm install custom-consent-popup@0.9.0
Import CustomConsentPopup
in your JavaScript or TypeScript project after installation.
import CustomConsentPopup from 'custom-consent-popup';
To use ES6 modules like the import statement in a browser, ensure your HTML script tag includes type="module":
<script type="module" src="path/to/your/script.js"></script>
FAQs
A customizable modal window for managing user consent, with various configuration options.
The npm package custom-consent-popup receives a total of 22 weekly downloads. As such, custom-consent-popup popularity was classified as not popular.
We found that custom-consent-popup demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.