Socket
Socket
Sign inDemoInstall

toastifier

Package Overview
Dependencies
0
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.12 to 1.1.1

2

package.json
{
"name": "toastifier",
"version": "1.0.12",
"version": "1.1.1",
"description": "Light and Simple Multi-Framework Toaster",

@@ -5,0 +5,0 @@ "main": "script.js",

function toastifier(msg, options = {}) {
if (typeof window) {
var container;
var check = document.getElementById('listOfToasts');
var check = document.getElementById("listOfToasts");
if (check) {
container = check;
} else {
container = document.createElement('div');
container.classList.add('toastifier__container');
container.id = 'listOfToasts';
container = document.createElement("div");
container.classList.add("toastifier__container");
container.id = "listOfToasts";
document.body.append(container);
}
var h = document.createElement('div');
var icon = document.createElement('div');
var message = document.createElement('div');
var h = document.createElement("div");
var icon = document.createElement("div");
var message = document.createElement("div");
const svg = (val) => {
if (val === 'error') {
return `<img src="https://raw.githubusercontent.com/varun-singhh/Toastifier/main/images/toastifier_error.webp" height="15px" width="15px"/>`;
if (val === "error") {
return `<img src="https://raw.githubusercontent.com/varun-singhh/Toastifier/main/images/toastifier_error.png" height="18px" width="18px"/>`;
}
if (val === 'success') {
return `<img src="https://raw.githubusercontent.com/varun-singhh/Toastifier/main/images/toastifier_success.webp" height="15px" width="15px"/>`;
if (val === "success") {
return `<img src="https://raw.githubusercontent.com/varun-singhh/Toastifier/main/images/toastifier_success.png" height="18px" width="18px"/>`;
}
if (val === 'info') {
return `<img src="https://raw.githubusercontent.com/varun-singhh/Toastifier/main/images/toastifier_info.webp" height="15px" width="15px"/>`;
if (val === "info") {
return `<img src="https://raw.githubusercontent.com/varun-singhh/Toastifier/main/images/toastifier_info.png" height="18px" width="18px"/>`;
}
if (val === 'warn') {
return `<img src="https://raw.githubusercontent.com/varun-singhh/Toastifier/main/images/toastifier_warn.webp" height="15px" width="15px"/>`;
if (val === "warn") {
return `<img src="https://raw.githubusercontent.com/varun-singhh/Toastifier/main/images/toastifier_warn.png" height="18px" width="18px"/>`;
}
};
if (options.showIcon === false) {
icon.style.display = 'none';
icon.style.display = "none";
} else {
icon.innerHTML = `${svg(options.type || 'success')}`;
icon.innerHTML = `${svg(options.type || "success")}`;
}

@@ -39,11 +39,11 @@

h.appendChild(message);
icon.style.marginRight = '5px';
h.classList.add('toastifier__alert');
icon.style.marginRight = "5px";
h.classList.add("toastifier__alert");
if (options.type) {
h.classList.add(`toastifier__${options.type}`);
} else {
h.classList.add('toastifier__success');
h.classList.add("toastifier__success");
}
if (options.shadow) {
h.classList.add('toastifier__shadow');
h.classList.add("toastifier__shadow");
}

@@ -53,6 +53,6 @@ if (options.position) {

} else {
container.classList.add('toastifier__top-center');
container.classList.add("toastifier__top-center");
}
if (options.onClick) {
h.addEventListener('click', () => {
h.addEventListener("click", () => {
options.onClick();

@@ -74,3 +74,3 @@ });

let styles, styleExit;
if (options.animation === 'slide') {
if (options.animation === "slide") {
styles = `

@@ -110,3 +110,3 @@ 0% {

`;
} else if (options.animation === 'fade') {
} else if (options.animation === "fade") {
styles = `

@@ -128,3 +128,3 @@ 0% {

`;
} else if (options.animation === 'zoom') {
} else if (options.animation === "zoom") {
styles = `

@@ -153,3 +153,3 @@ 0% {

`;
} else if (options.animation === 'flip') {
} else if (options.animation === "flip") {
styles = `

@@ -199,3 +199,3 @@ 0% {

`;
} else if (options.animation === 'bounce') {
} else if (options.animation === "bounce") {
styles = `

@@ -315,4 +315,4 @@ %,

if (!styleSheet) {
styleSheet = document.createElement('style');
styleSheet.type = 'text/css';
styleSheet = document.createElement("style");
styleSheet.type = "text/css";
document.head.appendChild(styleSheet);

@@ -336,3 +336,3 @@

h.remove();
if (document.getElementsByClassName('toastifier__alert').length === 0) {
if (document.getElementsByClassName("toastifier__alert").length === 0) {
container.remove();

@@ -342,3 +342,3 @@ }

if (options.onhoverPause) {
h.addEventListener('mouseover', () => {
h.addEventListener("mouseover", () => {
clearTimeout(time1);

@@ -348,7 +348,6 @@ clearTimeout(time2);

if (options.onhoverPause) {
h.addEventListener('mouseleave', () => {
h.addEventListener("mouseleave", () => {
h.style.animation = `animated_exit ${animation_time}s`;
setTimeout(() => {
h.style.display = 'none';
container.remove();
h.style.display = "none";
}, 800);

@@ -355,0 +354,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc