Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

notie

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notie - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

117

dist/notie.js

@@ -13,3 +13,3 @@ /*

Version: 3.1.0
Version: 3.2.0

@@ -22,2 +22,8 @@ */

var options = {
colorSuccess: '',
colorWarning: '',
colorError: '',
colorInfo: '',
colorNeutral: '',
colorText: '',
animationDelay: 300,

@@ -74,2 +80,4 @@ backgroundClickDismiss: true

if (options.colorText.length > 0) alertText.style.color = options.colorText;
blur();

@@ -127,12 +135,16 @@

case 1:
addClass(alertOuter, 'notie-background-success');
if (options.colorSuccess.length > 0) alertOuter.style.backgroundColor = options.colorSuccess;
else addClass(alertOuter, 'notie-background-success');
break;
case 2:
addClass(alertOuter, 'notie-background-warning');
if (options.colorWarning.length > 0) alertOuter.style.backgroundColor = options.colorWarning;
else addClass(alertOuter, 'notie-background-warning');
break;
case 3:
addClass(alertOuter, 'notie-background-error');
if (options.colorError.length > 0) alertOuter.style.backgroundColor = options.colorError;
else addClass(alertOuter, 'notie-background-error');
break;
case 4:
addClass(alertOuter, 'notie-background-info');
if (options.colorInfo.length > 0) alertOuter.style.backgroundColor = options.colorInfo;
else addClass(alertOuter, 'notie-background-info');
break;

@@ -236,2 +248,11 @@ }

if (options.colorInfo.length > 0) confirmInner.style.backgroundColor = options.colorInfo;
if (options.colorSuccess.length > 0) confirmYes.style.backgroundColor = options.colorSuccess;
if (options.colorError.length > 0) confirmNo.style.backgroundColor = options.colorError;
if (options.colorText.length > 0) {
confirmText.style.color = options.colorText;
confirmTextYes.style.color = options.colorText;
confirmTextNo.style.color = options.colorText;
}
blur();

@@ -373,9 +394,9 @@

var inputYesText = document.createElement('span');
inputYesText.id = 'notie-input-text-yes';
inputYes.appendChild(inputYesText);
var inputTextYes = document.createElement('span');
inputTextYes.id = 'notie-input-text-yes';
inputYes.appendChild(inputTextYes);
var inputNoText = document.createElement('span');
inputNoText.id = 'notie-input-text-no';
inputNo.appendChild(inputNoText);
var inputTextNo = document.createElement('span');
inputTextNo.id = 'notie-input-text-no';
inputNo.appendChild(inputTextNo);

@@ -396,8 +417,17 @@ // Attach input elements to the body element

function input(options, title, submitText, cancelText, submitCallback, cancelCallback) {
function input(settings, title, submitText, cancelText, submitCallback, cancelCallback) {
if (options.colorInfo.length > 0) inputInner.style.backgroundColor = options.colorInfo;
if (options.colorSuccess.length > 0) inputYes.style.backgroundColor = options.colorSuccess;
if (options.colorError.length > 0) inputNo.style.backgroundColor = options.colorError;
if (options.colorText.length > 0) {
inputText.style.color = options.colorText;
inputTextYes.style.color = options.colorText;
inputTextNo.style.color = options.colorText;
}
blur();
if (typeof options.type !== 'undefined' && options.type) {
inputField.setAttribute('type', options.type);
if (typeof settings.type !== 'undefined' && settings.type) {
inputField.setAttribute('type', settings.type);
}

@@ -408,4 +438,4 @@ else {

if (typeof options.placeholder !== 'undefined' && options.placeholder) {
inputField.setAttribute('placeholder', options.placeholder);
if (typeof settings.placeholder !== 'undefined' && settings.placeholder) {
inputField.setAttribute('placeholder', settings.placeholder);
}

@@ -416,4 +446,4 @@ else {

if (typeof options.prefilledValue !== 'undefined' && options.prefilledValue) {
inputField.value = options.prefilledValue;
if (typeof settings.prefilledValue !== 'undefined' && settings.prefilledValue) {
inputField.value = settings.prefilledValue;
}

@@ -467,4 +497,4 @@ else {

inputText.innerHTML = title;
inputYesText.innerHTML = submitText;
inputNoText.innerHTML = cancelText;
inputTextYes.innerHTML = submitText;
inputTextNo.innerHTML = cancelText;

@@ -577,2 +607,9 @@ // Get input's height

if (options.colorInfo.length > 0) selectInner.style.backgroundColor = options.colorInfo;
if (options.colorNeutral.length > 0) selectCancel.style.backgroundColor = options.colorNeutral;
if (options.colorText.length > 0) {
selectText.style.color = options.colorText;
selectCancel.style.color = options.colorText;
}
var funcs = [];

@@ -612,2 +649,4 @@ for (var i = 0; i < arguments.length - 2; i++) {

var selectChoicePrevious;
for (var i = 0; i < choices.length; i++) {

@@ -617,10 +656,36 @@

selectChoice.innerHTML = choices[i].title;
if (choices[i].color) {
addClass(selectChoice, 'notie-select-choice');
selectChoices.appendChild(selectChoice);
selectChoice.style.backgroundColor = window.getComputedStyle(selectChoice).backgroundColor;
if (options.colorText.length > 0) selectChoice.style.color = options.colorText;
if (choices[i].type) {
switch(choices[i].type) {
case 1:
if (options.colorSuccess.length > 0) selectChoice.style.backgroundColor = options.colorSuccess;
else addClass(selectChoice, 'notie-background-success');
break;
case 2:
if (options.colorWarning.length > 0) selectChoice.style.backgroundColor = options.colorWarning;
else addClass(selectChoice, 'notie-background-warning');
break;
case 3:
if (options.colorError.length > 0) selectChoice.style.backgroundColor = options.colorError;
else addClass(selectChoice, 'notie-background-error');
break;
case 4:
if (options.colorInfo.length > 0) selectChoice.style.backgroundColor = options.colorInfo;
else addClass(selectChoice, 'notie-background-info');
break;
}
}
else if (choices[i].color) {
selectChoice.style.backgroundColor = choices[i].color;
}
if (i < choices.length - 1) {
selectChoice.style.borderBottom = '1px solid rgba(255, 255, 255, 0.15)';
if (i > 0) {
if (selectChoice.style.backgroundColor === selectChoicePrevious.style.backgroundColor) {
selectChoicePrevious.style.borderBottom = '1px solid rgba(255, 255, 255, 0.2)';
}
}
addClass(selectChoice, 'notie-select-choice');
selectChoices.appendChild(selectChoice);

@@ -635,2 +700,4 @@ // onclick for this choice

selectChoicePrevious = selectChoice;
}

@@ -637,0 +704,0 @@

@@ -1,1 +0,1 @@

var notie=function(){function e(e){for(var t in e)b[t]=e[t]}function t(e,t,o){y(),H++,setTimeout(function(){H--},b.animationDelay+10),1===H&&(D?(clearTimeout(E),clearTimeout(x),i(function(){n(e,t,o)})):n(e,t,o))}function n(e,t,n){D=!0;var o=0;if("undefined"==typeof n||0===n)var o=864e5;else o=n>0&&1>n?1e3:1e3*n;switch(f(T,"notie-background-success"),f(T,"notie-background-warning"),f(T,"notie-background-error"),f(T,"notie-background-info"),e){case 1:p(T,"notie-background-success");break;case 2:p(T,"notie-background-warning");break;case 3:p(T,"notie-background-error");break;case 4:p(T,"notie-background-info")}C.innerHTML=t,T.style.top="-10000px",T.style.display="table",T.style.top="-"+T.offsetHeight-5+"px",E=setTimeout(function(){p(T,"notie-transition"),T.style.top=0,x=setTimeout(function(){i(function(){})},o)},20)}function i(e){T.style.top="-"+T.offsetHeight-5+"px",setTimeout(function(){f(T,"notie-transition"),T.style.top="-10000px",D=!1,e&&e()},b.animationDelay+10)}function o(e,t,n,o,a){y(),D?(clearTimeout(E),clearTimeout(x),i(function(){c(e,t,n,o,a)})):c(e,t,n,o,a)}function c(e,t,n,i,o){function c(){M.innerHTML=e,V.innerHTML=t,j.innerHTML=n,L.style.top="-10000px",L.style.display="table",L.style.top="-"+L.offsetHeight-5+"px",B.style.display="block",setTimeout(function(){p(L,"notie-transition"),L.style.top=0,B.style.opacity="0.75",setTimeout(function(){z=!0},b.animationDelay+10)},20)}v(),A.onclick=function(){a(),i&&setTimeout(function(){i()},b.animationDelay+10)},N.onclick=function(){a(),o&&setTimeout(function(){o()},b.animationDelay+10)},z?(a(),setTimeout(function(){c()},b.animationDelay+10)):c()}function a(){L.style.top="-"+L.offsetHeight-5+"px",B.style.opacity="0",setTimeout(function(){f(L,"notie-transition"),L.style.top="-10000px",B.style.display="none",h(),z=!1},b.animationDelay+10)}function l(e,t,n,o,c,a){y(),"undefined"!=typeof e.type&&e.type?$.setAttribute("type",e.type):$.setAttribute("type","text"),"undefined"!=typeof e.placeholder&&e.placeholder&&$.setAttribute("placeholder",e.placeholder),"undefined"!=typeof e.prefilledValue&&e.prefilledValue?$.value=e.prefilledValue:$.value="",D?(clearTimeout(E),clearTimeout(x),i(function(){d(t,n,o,c,a)})):d(t,n,o,c,a)}function d(e,t,n,i,o){function c(){G.innerHTML=e,J.innerHTML=t,K.innerHTML=n,I.style.top="-10000px",I.style.display="table",I.style.top="-"+I.offsetHeight-5+"px",O.style.display="block",setTimeout(function(){p(I,"notie-transition"),I.style.top=0,O.style.opacity="0.75",setTimeout(function(){P=!0,$.focus()},b.animationDelay+10)},20)}v(),q.onclick=function(){u(),i&&setTimeout(function(){i($.value)},b.animationDelay+10)},F.onclick=function(){u(),o&&setTimeout(function(){o($.value)},b.animationDelay+10)},P?(u(),setTimeout(function(){c()},b.animationDelay+10)):c()}function u(){I.style.top="-"+I.offsetHeight-5+"px",O.style.opacity="0",setTimeout(function(){f(I,"notie-transition"),O.style.display="none",I.style.top="-10000px",h(),P=!1},b.animationDelay+10)}function r(e,t){for(var n=[],o=0;o<arguments.length-2;o++)n[o]=arguments[o+2];if(n.length!==t.length)throw"notie.select number of choices must match number of functions";y(),D?(clearTimeout(E),clearTimeout(x),i(function(){s(e,t,n)})):s(e,t,n)}function s(e,t,n){function i(e){U.innerHTML=e,Q.style.bottom="-10000px",Q.style.display="table",Q.style.bottom="-"+Q.offsetHeight-5+"px",W.style.display="block",setTimeout(function(){p(Q,"notie-transition"),Q.style.bottom=0,W.style.opacity="0.75",setTimeout(function(){ee=!0},b.animationDelay+10)},20)}v(),document.getElementById("notie-select-choices").innerHTML="";for(var o=0;o<t.length;o++){var c=document.createElement("div");c.innerHTML=t[o].title,t[o].color&&(c.style.backgroundColor=t[o].color),o<t.length-1&&(c.style.borderBottom="1px solid rgba(255, 255, 255, 0.15)"),p(c,"notie-select-choice"),X.appendChild(c),c.onclick=function(e){return function(){m(),setTimeout(function(){n[e]()},b.animationDelay+10)}}(o)}ee?(m(),setTimeout(function(){i(e)},b.animationDelay+10)):i(e)}function m(){Q.style.bottom="-"+Q.offsetHeight-5+"px",W.style.opacity="0",setTimeout(function(){f(Q,"notie-transition"),Q.style.bottom="-10000px",W.style.display="none",h(),ee=!1},b.animationDelay+10)}function p(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function f(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function y(){document.activeElement.blur()}function v(){Z=document.body.style.height,_=document.body.style.overflow,document.body.style.height="100%",document.body.style.overflow="hidden"}function h(){document.body.style.height=Z,document.body.style.overflow=_}var b={animationDelay:300,backgroundClickDismiss:!0},T=document.createElement("div");T.id="notie-alert-outer",T.onclick=function(){clearTimeout(E),clearTimeout(x),i()},document.body.appendChild(T);var k=document.createElement("div");k.id="notie-alert-inner",T.appendChild(k);var g=document.createElement("div");g.id="notie-alert-content",k.appendChild(g);var C=document.createElement("span");C.id="notie-alert-text",g.appendChild(C);var E,x,D=!1,H=0,L=document.createElement("div");L.id="notie-confirm-outer";var w=document.createElement("div");w.id="notie-confirm-inner",L.appendChild(w);var M=document.createElement("span");M.id="notie-confirm-text",w.appendChild(M);var A=document.createElement("div");A.id="notie-confirm-yes",L.appendChild(A);var N=document.createElement("div");N.id="notie-confirm-no",L.appendChild(N);var V=document.createElement("span");V.id="notie-confirm-text-yes",A.appendChild(V);var j=document.createElement("span");j.id="notie-confirm-text-no",N.appendChild(j);var B=document.createElement("div");B.id="notie-confirm-background",p(B,"notie-transition"),B.onclick=function(){b.backgroundClickDismiss&&a()},document.body.appendChild(L),document.body.appendChild(B);var z=!1,I=document.createElement("div");I.id="notie-input-outer";var O=document.createElement("div");O.id="notie-input-background",p(O,"notie-transition");var R=document.createElement("div");R.id="notie-input-inner",I.appendChild(R);var $=document.createElement("input");$.id="notie-input-field",$.setAttribute("autocomplete","off"),$.setAttribute("autocorrect","off"),$.setAttribute("autocapitalize","off"),$.setAttribute("spellcheck","false"),I.appendChild($);var q=document.createElement("div");q.id="notie-input-yes",I.appendChild(q);var F=document.createElement("div");F.id="notie-input-no",I.appendChild(F);var G=document.createElement("span");G.id="notie-input-text",R.appendChild(G);var J=document.createElement("span");J.id="notie-input-text-yes",q.appendChild(J);var K=document.createElement("span");K.id="notie-input-text-no",F.appendChild(K),document.body.appendChild(I),document.body.appendChild(O),O.onclick=function(){b.backgroundClickDismiss&&u()};var P=!1,Q=document.createElement("div");Q.id="notie-select-outer";var S=document.createElement("div");S.id="notie-select-inner",Q.appendChild(S);var U=document.createElement("span");U.id="notie-select-text",S.appendChild(U);var W=document.createElement("div");W.id="notie-select-background",p(W,"notie-transition");var X=document.createElement("div");X.id="notie-select-choices",Q.appendChild(X);var Y=document.createElement("div");Y.id="notie-select-cancel",Y.innerHTML="Cancel",Q.appendChild(Y),document.body.appendChild(Q),document.body.appendChild(W),W.onclick=function(){b.backgroundClickDismiss&&m()},Y.onclick=function(){m()};var Z,_,ee=!1;return window.addEventListener("keydown",function(e){var t=13==e.which||13==e.keyCode,n=27==e.which||27==e.keyCode;D?(t||n)&&(clearTimeout(E),clearTimeout(x),i()):z?t?A.click():n&&a():P?t?q.click():n&&u():ee&&n&&m()}),{setOptions:e,alert:t,confirm:o,input:l,select:r}}();"object"==typeof module&&module.exports&&(module.exports=notie);
var notie=function(){function e(e){for(var t in e)h[t]=e[t]}function t(e,t,i){h.colorText.length>0&&(C.style.color=h.colorText),f(),H++,setTimeout(function(){H--},h.animationDelay+10),1===H&&(D?(clearTimeout(x),clearTimeout(E),n(function(){o(e,t,i)})):o(e,t,i))}function o(e,t,o){D=!0;var i=0;if("undefined"==typeof o||0===o)var i=864e5;else i=o>0&&1>o?1e3:1e3*o;switch(y(k,"notie-background-success"),y(k,"notie-background-warning"),y(k,"notie-background-error"),y(k,"notie-background-info"),e){case 1:h.colorSuccess.length>0?k.style.backgroundColor=h.colorSuccess:p(k,"notie-background-success");break;case 2:h.colorWarning.length>0?k.style.backgroundColor=h.colorWarning:p(k,"notie-background-warning");break;case 3:h.colorError.length>0?k.style.backgroundColor=h.colorError:p(k,"notie-background-error");break;case 4:h.colorInfo.length>0?k.style.backgroundColor=h.colorInfo:p(k,"notie-background-info")}C.innerHTML=t,k.style.top="-10000px",k.style.display="table",k.style.top="-"+k.offsetHeight-5+"px",x=setTimeout(function(){p(k,"notie-transition"),k.style.top=0,E=setTimeout(function(){n(function(){})},i)},20)}function n(e){k.style.top="-"+k.offsetHeight-5+"px",setTimeout(function(){y(k,"notie-transition"),k.style.top="-10000px",D=!1,e&&e()},h.animationDelay+10)}function i(e,t,o,i,l){h.colorInfo.length>0&&(L.style.backgroundColor=h.colorInfo),h.colorSuccess.length>0&&(M.style.backgroundColor=h.colorSuccess),h.colorError.length>0&&(S.style.backgroundColor=h.colorError),h.colorText.length>0&&(I.style.color=h.colorText,A.style.color=h.colorText,N.style.color=h.colorText),f(),D?(clearTimeout(x),clearTimeout(E),n(function(){c(e,t,o,i,l)})):c(e,t,o,i,l)}function c(e,t,o,n,i){function c(){I.innerHTML=e,A.innerHTML=t,N.innerHTML=o,w.style.top="-10000px",w.style.display="table",w.style.top="-"+w.offsetHeight-5+"px",W.style.display="block",setTimeout(function(){p(w,"notie-transition"),w.style.top=0,W.style.opacity="0.75",setTimeout(function(){V=!0},h.animationDelay+10)},20)}g(),M.onclick=function(){l(),n&&setTimeout(function(){n()},h.animationDelay+10)},S.onclick=function(){l(),i&&setTimeout(function(){i()},h.animationDelay+10)},V?(l(),setTimeout(function(){c()},h.animationDelay+10)):c()}function l(){w.style.top="-"+w.offsetHeight-5+"px",W.style.opacity="0",setTimeout(function(){y(w,"notie-transition"),w.style.top="-10000px",W.style.display="none",b(),V=!1},h.animationDelay+10)}function r(e,t,o,i,c,l){h.colorInfo.length>0&&(z.style.backgroundColor=h.colorInfo),h.colorSuccess.length>0&&(R.style.backgroundColor=h.colorSuccess),h.colorError.length>0&&($.style.backgroundColor=h.colorError),h.colorText.length>0&&(q.style.color=h.colorText,F.style.color=h.colorText,G.style.color=h.colorText),f(),"undefined"!=typeof e.type&&e.type?O.setAttribute("type",e.type):O.setAttribute("type","text"),"undefined"!=typeof e.placeholder&&e.placeholder&&O.setAttribute("placeholder",e.placeholder),"undefined"!=typeof e.prefilledValue&&e.prefilledValue?O.value=e.prefilledValue:O.value="",D?(clearTimeout(x),clearTimeout(E),n(function(){a(t,o,i,c,l)})):a(t,o,i,c,l)}function a(e,t,o,n,i){function c(){q.innerHTML=e,F.innerHTML=t,G.innerHTML=o,j.style.top="-10000px",j.style.display="table",j.style.top="-"+j.offsetHeight-5+"px",B.style.display="block",setTimeout(function(){p(j,"notie-transition"),j.style.top=0,B.style.opacity="0.75",setTimeout(function(){J=!0,O.focus()},h.animationDelay+10)},20)}g(),R.onclick=function(){d(),n&&setTimeout(function(){n(O.value)},h.animationDelay+10)},$.onclick=function(){d(),i&&setTimeout(function(){i(O.value)},h.animationDelay+10)},J?(d(),setTimeout(function(){c()},h.animationDelay+10)):c()}function d(){j.style.top="-"+j.offsetHeight-5+"px",B.style.opacity="0",setTimeout(function(){y(j,"notie-transition"),B.style.display="none",j.style.top="-10000px",b(),J=!1},h.animationDelay+10)}function u(e,t){h.colorInfo.length>0&&(P.style.backgroundColor=h.colorInfo),h.colorNeutral.length>0&&(Y.style.backgroundColor=h.colorNeutral),h.colorText.length>0&&(Q.style.color=h.colorText,Y.style.color=h.colorText);for(var o=[],i=0;i<arguments.length-2;i++)o[i]=arguments[i+2];if(o.length!==t.length)throw"notie.select number of choices must match number of functions";f(),D?(clearTimeout(x),clearTimeout(E),n(function(){s(e,t,o)})):s(e,t,o)}function s(e,t,o){function n(e){Q.innerHTML=e,K.style.bottom="-10000px",K.style.display="table",K.style.bottom="-"+K.offsetHeight-5+"px",U.style.display="block",setTimeout(function(){p(K,"notie-transition"),K.style.bottom=0,U.style.opacity="0.75",setTimeout(function(){ee=!0},h.animationDelay+10)},20)}g(),document.getElementById("notie-select-choices").innerHTML="";for(var i,c=0;c<t.length;c++){var l=document.createElement("div");if(l.innerHTML=t[c].title,p(l,"notie-select-choice"),X.appendChild(l),l.style.backgroundColor=window.getComputedStyle(l).backgroundColor,h.colorText.length>0&&(l.style.color=h.colorText),t[c].type)switch(t[c].type){case 1:h.colorSuccess.length>0?l.style.backgroundColor=h.colorSuccess:p(l,"notie-background-success");break;case 2:h.colorWarning.length>0?l.style.backgroundColor=h.colorWarning:p(l,"notie-background-warning");break;case 3:h.colorError.length>0?l.style.backgroundColor=h.colorError:p(l,"notie-background-error");break;case 4:h.colorInfo.length>0?l.style.backgroundColor=h.colorInfo:p(l,"notie-background-info")}else t[c].color&&(l.style.backgroundColor=t[c].color);c>0&&l.style.backgroundColor===i.style.backgroundColor&&(i.style.borderBottom="1px solid rgba(255, 255, 255, 0.2)"),l.onclick=function(e){return function(){m(),setTimeout(function(){o[e]()},h.animationDelay+10)}}(c),i=l}ee?(m(),setTimeout(function(){n(e)},h.animationDelay+10)):n(e)}function m(){K.style.bottom="-"+K.offsetHeight-5+"px",U.style.opacity="0",setTimeout(function(){y(K,"notie-transition"),K.style.bottom="-10000px",U.style.display="none",b(),ee=!1},h.animationDelay+10)}function p(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function y(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function f(){document.activeElement.blur()}function g(){Z=document.body.style.height,_=document.body.style.overflow,document.body.style.height="100%",document.body.style.overflow="hidden"}function b(){document.body.style.height=Z,document.body.style.overflow=_}var h={colorSuccess:"",colorWarning:"",colorError:"",colorInfo:"",colorNeutral:"",colorText:"",animationDelay:300,backgroundClickDismiss:!0},k=document.createElement("div");k.id="notie-alert-outer",k.onclick=function(){clearTimeout(x),clearTimeout(E),n()},document.body.appendChild(k);var v=document.createElement("div");v.id="notie-alert-inner",k.appendChild(v);var T=document.createElement("div");T.id="notie-alert-content",v.appendChild(T);var C=document.createElement("span");C.id="notie-alert-text",T.appendChild(C);var x,E,D=!1,H=0,w=document.createElement("div");w.id="notie-confirm-outer";var L=document.createElement("div");L.id="notie-confirm-inner",w.appendChild(L);var I=document.createElement("span");I.id="notie-confirm-text",L.appendChild(I);var M=document.createElement("div");M.id="notie-confirm-yes",w.appendChild(M);var S=document.createElement("div");S.id="notie-confirm-no",w.appendChild(S);var A=document.createElement("span");A.id="notie-confirm-text-yes",M.appendChild(A);var N=document.createElement("span");N.id="notie-confirm-text-no",S.appendChild(N);var W=document.createElement("div");W.id="notie-confirm-background",p(W,"notie-transition"),W.onclick=function(){h.backgroundClickDismiss&&l()},document.body.appendChild(w),document.body.appendChild(W);var V=!1,j=document.createElement("div");j.id="notie-input-outer";var B=document.createElement("div");B.id="notie-input-background",p(B,"notie-transition");var z=document.createElement("div");z.id="notie-input-inner",j.appendChild(z);var O=document.createElement("input");O.id="notie-input-field",O.setAttribute("autocomplete","off"),O.setAttribute("autocorrect","off"),O.setAttribute("autocapitalize","off"),O.setAttribute("spellcheck","false"),j.appendChild(O);var R=document.createElement("div");R.id="notie-input-yes",j.appendChild(R);var $=document.createElement("div");$.id="notie-input-no",j.appendChild($);var q=document.createElement("span");q.id="notie-input-text",z.appendChild(q);var F=document.createElement("span");F.id="notie-input-text-yes",R.appendChild(F);var G=document.createElement("span");G.id="notie-input-text-no",$.appendChild(G),document.body.appendChild(j),document.body.appendChild(B),B.onclick=function(){h.backgroundClickDismiss&&d()};var J=!1,K=document.createElement("div");K.id="notie-select-outer";var P=document.createElement("div");P.id="notie-select-inner",K.appendChild(P);var Q=document.createElement("span");Q.id="notie-select-text",P.appendChild(Q);var U=document.createElement("div");U.id="notie-select-background",p(U,"notie-transition");var X=document.createElement("div");X.id="notie-select-choices",K.appendChild(X);var Y=document.createElement("div");Y.id="notie-select-cancel",Y.innerHTML="Cancel",K.appendChild(Y),document.body.appendChild(K),document.body.appendChild(U),U.onclick=function(){h.backgroundClickDismiss&&m()},Y.onclick=function(){m()};var Z,_,ee=!1;return window.addEventListener("keydown",function(e){var t=13==e.which||13==e.keyCode,o=27==e.which||27==e.keyCode;D?(t||o)&&(clearTimeout(x),clearTimeout(E),n()):V?t?M.click():o&&l():J?t?R.click():o&&d():ee&&o&&m()}),{setOptions:e,alert:t,confirm:i,input:r,select:u}}();"object"==typeof module&&module.exports&&(module.exports=notie);

@@ -13,3 +13,3 @@ /*

Version: 3.1.0
Version: 3.2.0

@@ -22,2 +22,8 @@ */

var options = {
colorSuccess: '',
colorWarning: '',
colorError: '',
colorInfo: '',
colorNeutral: '',
colorText: '',
animationDelay: 300,

@@ -74,2 +80,4 @@ backgroundClickDismiss: true

if (options.colorText.length > 0) alertText.style.color = options.colorText;
blur();

@@ -127,12 +135,16 @@

case 1:
addClass(alertOuter, 'notie-background-success');
if (options.colorSuccess.length > 0) alertOuter.style.backgroundColor = options.colorSuccess;
else addClass(alertOuter, 'notie-background-success');
break;
case 2:
addClass(alertOuter, 'notie-background-warning');
if (options.colorWarning.length > 0) alertOuter.style.backgroundColor = options.colorWarning;
else addClass(alertOuter, 'notie-background-warning');
break;
case 3:
addClass(alertOuter, 'notie-background-error');
if (options.colorError.length > 0) alertOuter.style.backgroundColor = options.colorError;
else addClass(alertOuter, 'notie-background-error');
break;
case 4:
addClass(alertOuter, 'notie-background-info');
if (options.colorInfo.length > 0) alertOuter.style.backgroundColor = options.colorInfo;
else addClass(alertOuter, 'notie-background-info');
break;

@@ -236,2 +248,11 @@ }

if (options.colorInfo.length > 0) confirmInner.style.backgroundColor = options.colorInfo;
if (options.colorSuccess.length > 0) confirmYes.style.backgroundColor = options.colorSuccess;
if (options.colorError.length > 0) confirmNo.style.backgroundColor = options.colorError;
if (options.colorText.length > 0) {
confirmText.style.color = options.colorText;
confirmTextYes.style.color = options.colorText;
confirmTextNo.style.color = options.colorText;
}
blur();

@@ -373,9 +394,9 @@

var inputYesText = document.createElement('span');
inputYesText.id = 'notie-input-text-yes';
inputYes.appendChild(inputYesText);
var inputTextYes = document.createElement('span');
inputTextYes.id = 'notie-input-text-yes';
inputYes.appendChild(inputTextYes);
var inputNoText = document.createElement('span');
inputNoText.id = 'notie-input-text-no';
inputNo.appendChild(inputNoText);
var inputTextNo = document.createElement('span');
inputTextNo.id = 'notie-input-text-no';
inputNo.appendChild(inputTextNo);

@@ -396,8 +417,17 @@ // Attach input elements to the body element

function input(options, title, submitText, cancelText, submitCallback, cancelCallback) {
function input(settings, title, submitText, cancelText, submitCallback, cancelCallback) {
if (options.colorInfo.length > 0) inputInner.style.backgroundColor = options.colorInfo;
if (options.colorSuccess.length > 0) inputYes.style.backgroundColor = options.colorSuccess;
if (options.colorError.length > 0) inputNo.style.backgroundColor = options.colorError;
if (options.colorText.length > 0) {
inputText.style.color = options.colorText;
inputTextYes.style.color = options.colorText;
inputTextNo.style.color = options.colorText;
}
blur();
if (typeof options.type !== 'undefined' && options.type) {
inputField.setAttribute('type', options.type);
if (typeof settings.type !== 'undefined' && settings.type) {
inputField.setAttribute('type', settings.type);
}

@@ -408,4 +438,4 @@ else {

if (typeof options.placeholder !== 'undefined' && options.placeholder) {
inputField.setAttribute('placeholder', options.placeholder);
if (typeof settings.placeholder !== 'undefined' && settings.placeholder) {
inputField.setAttribute('placeholder', settings.placeholder);
}

@@ -416,4 +446,4 @@ else {

if (typeof options.prefilledValue !== 'undefined' && options.prefilledValue) {
inputField.value = options.prefilledValue;
if (typeof settings.prefilledValue !== 'undefined' && settings.prefilledValue) {
inputField.value = settings.prefilledValue;
}

@@ -467,4 +497,4 @@ else {

inputText.innerHTML = title;
inputYesText.innerHTML = submitText;
inputNoText.innerHTML = cancelText;
inputTextYes.innerHTML = submitText;
inputTextNo.innerHTML = cancelText;

@@ -577,2 +607,9 @@ // Get input's height

if (options.colorInfo.length > 0) selectInner.style.backgroundColor = options.colorInfo;
if (options.colorNeutral.length > 0) selectCancel.style.backgroundColor = options.colorNeutral;
if (options.colorText.length > 0) {
selectText.style.color = options.colorText;
selectCancel.style.color = options.colorText;
}
var funcs = [];

@@ -612,2 +649,4 @@ for (var i = 0; i < arguments.length - 2; i++) {

var selectChoicePrevious;
for (var i = 0; i < choices.length; i++) {

@@ -617,10 +656,36 @@

selectChoice.innerHTML = choices[i].title;
if (choices[i].color) {
addClass(selectChoice, 'notie-select-choice');
selectChoices.appendChild(selectChoice);
selectChoice.style.backgroundColor = window.getComputedStyle(selectChoice).backgroundColor;
if (options.colorText.length > 0) selectChoice.style.color = options.colorText;
if (choices[i].type) {
switch(choices[i].type) {
case 1:
if (options.colorSuccess.length > 0) selectChoice.style.backgroundColor = options.colorSuccess;
else addClass(selectChoice, 'notie-background-success');
break;
case 2:
if (options.colorWarning.length > 0) selectChoice.style.backgroundColor = options.colorWarning;
else addClass(selectChoice, 'notie-background-warning');
break;
case 3:
if (options.colorError.length > 0) selectChoice.style.backgroundColor = options.colorError;
else addClass(selectChoice, 'notie-background-error');
break;
case 4:
if (options.colorInfo.length > 0) selectChoice.style.backgroundColor = options.colorInfo;
else addClass(selectChoice, 'notie-background-info');
break;
}
}
else if (choices[i].color) {
selectChoice.style.backgroundColor = choices[i].color;
}
if (i < choices.length - 1) {
selectChoice.style.borderBottom = '1px solid rgba(255, 255, 255, 0.15)';
if (i > 0) {
if (selectChoice.style.backgroundColor === selectChoicePrevious.style.backgroundColor) {
selectChoicePrevious.style.borderBottom = '1px solid rgba(255, 255, 255, 0.2)';
}
}
addClass(selectChoice, 'notie-select-choice');
selectChoices.appendChild(selectChoice);

@@ -635,2 +700,4 @@ // onclick for this choice

selectChoicePrevious = selectChoice;
}

@@ -637,0 +704,0 @@

@@ -5,3 +5,3 @@ {

"author": "Jared Reich",
"version": "3.1.0",
"version": "3.2.0",
"main": "notie.js",

@@ -8,0 +8,0 @@ "repository": {

@@ -19,3 +19,2 @@ # notie

* Pure JavaScript, no dependencies
* Works in all modern browsers (Chrome, Firefox, Safari, IE 9+, Edge, Opera)
* Easily customizable

@@ -28,7 +27,7 @@ * Change colors to match your style/brand

* Chrome 8+
* Firefox 3.6+
* Firefox for Android 32+
* IE 10+
* Chrome 11+
* Firefox 4+
* Safari 5.1+
* IE 10+
* Opera 11.5+

@@ -109,5 +108,5 @@ ## Installation

{ title: 'Share' },
{ title: 'Open' },
{ title: 'Edit', color: '#D6A14D' },
{ title: 'Delete', color: '#E1715B' }
{ title: 'Open', color: '#57BF57' },
{ title: 'Edit', type: 2 },
{ title: 'Delete', type: 3 }
],

@@ -129,2 +128,8 @@ function() {

notie.setOptions({
colorSuccess: '#57BF57',
colorWarning: '#D6A14D',
colorError: '#E1715B',
colorInfo: '#4D82D6',
colorNeutral: '#A0A0A0',
colorText: '#FFFFFF',
animationDelay: 300, // Be sure to also change "transition: all 0.3s ease" variable in .scss file

@@ -131,0 +136,0 @@ backgroundClickDismiss: true

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc