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

popups

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

popups - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

assets/src/colors.css

2

dist/popupS.js

@@ -173,2 +173,4 @@ ;(function (root, factory) {

verticalAlign: 'middle',
maxWidth: '100%',
overflowX: 'hidden',
transform: 'translate3d(0,0,0)'

@@ -175,0 +177,0 @@ },

4

dist/popupS.min.js

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

/*! popups 1.1.2 - MIT | https://github.com/ChiefORZ/popupS.git */
!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.popupS=b()}(this,function(){"use strict";function a(){}function b(a,b){var c=[].slice.call(arguments,2);return b.bind?b.bind.apply(b,[a].concat(c)):function(){return b.apply(a,c.concat([].slice.call(arguments)))}}function c(a,b){if(a)for(var c in a)a.hasOwnProperty(c)&&b(a[c],c,a)}function d(a){a=a||{};for(var b=1;b<arguments.length;b++)if(arguments[b])for(var c in arguments[b])arguments[b].hasOwnProperty(c)&&(a[c]=arguments[b][c]);return a}function e(a,b,c){"function"==typeof a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)}function f(a,b,c){"function"==typeof a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)}function g(a,b,c){if(a&&a.style&&b)if(b instanceof Object)for(var d in b)g(a,d,b[d]);else a.style[b]=c}function h(a){null===a&&(a="div"),"string"==typeof a&&(a={tag:a});var b,d,e=document.createDocumentFragment(),f=a.children,j=r.exec(a.tag||"");return delete a.children,a.tag=j[1]||"div",a.id=a.id||(j[2]||"").substr(1),d=(j[3]||"").split("."),d[0]=a.className||"",a.className=d.join(" "),b=document.createElement(a.tag),i(e,b),delete a.tag,c(a,function(c,d){if("css"===d)g(b,a.css);else if("text"===d)null!==c&&i(b,document.createTextNode(c));else if("html"===d)null!==c&&(b.innerHTML=c);else if(d in b)try{b[d]=c}catch(e){b.setAttribute(d,c)}else/^data-/.test(d)&&b.setAttribute(d,c)}),f&&f.appendChild?i(b,f):f&&(f instanceof Array?c(f,function(a,c){a instanceof Object&&i(b,h(a))}):f instanceof Object&&i(b,h(f))),b}function i(a,b){try{a&&b&&a.appendChild(b)}catch(c){}}function j(a){for(var b,c,d=k(a,"input"),e=0,f=d.length;f>e;e++)if(b=d[e],"submit"===b.type)!c&&(c=b);else if(!/hidden|check|radio/.test(b.type)&&""===b.value){c=b;break}c||(c=k(a,"button")[0]);try{c.focus()}catch(g){}}function k(a,b){return a.getElementsByTagName(b)}function l(a){a&&a.parentNode&&a.parentNode.removeChild(a)}var m=!1,n=[],o=new RegExp(/([^\/\\]+)\.(jpg|jpeg|png|gif)$/i),p={additionalBaseClass:"",additionalButtonHolderClass:"",additionalButtonOkClass:"",additionalButtonCancelClass:"",additionalCloseBtnClass:"",additionalFormClass:"",additionalOverlayClass:"",additionalPopupClass:"",appendLocation:document.body||document.documentElement,baseClassName:"popupS",closeBtn:"&times;",flagBodyScroll:!1,flagButtonReverse:!1,flagCloseByEsc:!0,flagCloseByOverlay:!0,flagShowCloseBtn:!0,labelOk:"OK",labelCancel:"Cancel",loader:"spinner",zIndex:1e4},q=function(){var a,b,c=!1,d=document.createElement("fakeelement"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"};for(a in e)if(e.hasOwnProperty(a)&&void 0!==d.style[a]){b=e[a],c=!0;break}return{type:b,supported:c}}();a.prototype={constructor:a,_open:function(a){if("string"!=typeof a.mode)throw new Error("mode must be a string");if("undefined"!=typeof a.title&&"string"!=typeof a.title)throw new Error("title must be a string");if("undefined"!=typeof a.placeholder&&"string"!=typeof a.placeholder)throw new Error("placeholder must be a string");this.options=a=d({},a);for(var e in p)!(e in a)&&(a[e]=p[e]);c(["additionalBaseClass","additionalButtonHolderClass","additionalButtonOkClass","additionalButtonCancelClass","additionalCloseBtnClass","additionalFormClass","additionalOverlayClass","additionalPopupClass"],function(b){var c=a[b].split(" ").join(".");a[b]="."+c});for(var f in this)"_"===f.charAt(0)&&(this[f]=b(this,this[f]));if(this._init(),a.force===!0)for(;n.length>0;)n.pop();n.push(a),m&&a.force!==!0||this._create()},_init:function(){this.$layerEl&&this.$layerEl.style.opacity&&(this.$layerEl.style.opacity=""),this.$wrapEl||(this.$wrapEl=h({tag:"div."+this.options.baseClassName+"-base"+(this.options.additionalBaseClass?this.options.additionalBaseClass:""),css:{top:0,left:0,right:0,bottom:0,position:"fixed",textAlign:"center",overflowX:"auto",overflowY:"auto",outline:0,whiteSpace:"nowrap",zIndex:this.options.zIndex},children:{css:{height:"100%",display:"inline-block",verticalAlign:"middle"}}}),i(this.$wrapEl,this._getOverlay()),i(this.$wrapEl,this._getLayer()))},_getOverlay:function(){return this.$overlayEl||(this.$overlayEl=h({tag:"#popupS-overlay."+this.options.baseClassName+"-overlay"+(this.options.additionalOverlayClass?this.options.additionalOverlayClass:""),css:{top:0,right:0,bottom:0,left:0,position:"fixed",overflowX:"hidden",userSelect:"none",webkitUserSelect:"none",MozUserSelect:"none"}})),this.$overlayEl.setAttribute("unselectable","on"),this.$overlayEl},_getLayer:function(){return this.$layerEl||(this.$layerEl=h({css:{display:"inline-block",position:"relative",textAlign:"left",whiteSpace:"normal",verticalAlign:"middle",transform:"translate3d(0,0,0)"},children:{tag:"."+this.options.baseClassName+"-layer"+(this.options.additionalPopupClass?this.options.additionalPopupClass:"")}})),this.$layerEl},_resetLayer:function(){this.$layerEl.childNodes[0].innerHTML=""},_create:function(){var a=this,c=n[0],d=c.mode;m=!0,"modal-ajax"!=d?this._createPopup(c):this._loadContents(c);var e=function(b){b.stopPropagation(),_unbind(a.$layerEl,q.type,e)};q.supported&&b(a.$layerEl,q.type,e)},_createPopup:function(a){var b,c,d,f=a.mode,g=a.title,k=a.content,l=a.className?"."+a.className:"",m=k instanceof Object?!0:!1;this.callbacks={onOpen:a.onOpen,onSubmit:a.onSubmit,onClose:a.onClose},b={tag:"button#popupS-button-ok."+this.options.baseClassName+"-button-ok"+(this.options.additionalButtonOkClass?this.options.additionalButtonOkClass:""),text:this.options.labelOk},c={tag:"button#popupS-button-cancel."+this.options.baseClassName+"-button-ok"+(this.options.additionalButtonCancelClass?this.options.additionalButtonCancelClass:""),text:this.options.labelCancel},d=[{html:k},"modal"!=f&&"modal-ajax"!=f&&"prompt"==f&&{tag:"form."+this.options.baseClassName+"-form"+(this.options.additionalFormClass?this.options.additionalFormClass:""),children:[a.placeholder&&{tag:"label",htmlFor:"popupS-input",text:a.placeholder},{tag:"input#popupS-input",type:"text"}]},"modal"!=f&&"modal-ajax"!=f&&{tag:"nav."+this.options.baseClassName+"-buttons"+(this.options.additionalButtonHolderClass?this.options.additionalButtonHolderClass:""),children:"prompt"==f||"confirm"==f?this.options.flagButtonReverse?[b,c]:[c,b]:[b]}],k=h({children:[{tag:"a#popupS-resetFocusBack."+this.options.baseClassName+"-resetFocus",href:"#",text:"Reset Focus"},this.options.flagShowCloseBtn&&{tag:"span#popupS-close."+this.options.baseClassName+"-close"+(this.options.additionalCloseBtnClass?this.options.additionalCloseBtnClass:""),html:this.options.closeBtn},g&&{tag:"h5."+this.options.baseClassName+"-title"+l,text:g},{tag:"."+this.options.baseClassName+"-content"+l,children:m&&k||d},{tag:"a#popupS-resetFocus."+this.options.baseClassName+"-resetFocus",href:"#",text:"Reset Focus"}]}),this._resetLayer(),i(this.$layerEl.childNodes[0],k),this._appendPopup(),this.$contentEl=this.$layerEl.getElementsByClassName(this.options.baseClassName+"-content")[0],this.$btnReset=document.getElementById("popupS-resetFocus"),this.$btnResetBack=document.getElementById("popupS-resetFocusBack"),e(this.$btnReset,"focus",this._resetEvent),e(this.$btnResetBack,"focus",this._resetEvent),j(this.$layerEl),this.$btnOK=document.getElementById("popupS-button-ok")||void 0,this.$btnCancel=document.getElementById("popupS-button-cancel")||void 0,this.$input=document.getElementById("popupS-input")||void 0,"undefined"!=typeof this.$btnOK&&e(this.$btnOK,"click",this._okEvent),"undefined"!=typeof this.$btnCancel&&e(this.$btnCancel,"click",this._cancelEvent),this.options.flagShowCloseBtn&&e(document.getElementById("popupS-close"),"click",this._cancelEvent),this.options.flagCloseByOverlay&&e(this.$overlayEl,"click",this._cancelEvent),this.options.flagCloseByEsc&&e(document.body,"keyup",this._keyEvent),"function"==typeof this.callbacks.onOpen&&this.callbacks.onOpen.call(this)},_appendPopup:function(){this.$targetEl=this.options.appendLocation,i(this.$targetEl,this.$wrapEl),this.$targetEl===(document.body||document.documentElement)&&this.options.flagBodyScroll===!1&&g(this.$targetEl,{overflow:"hidden"}),window.getComputedStyle&&window.getComputedStyle(this.$wrapEl,null).height;var a=function(a){return new RegExp("(|\\s+)"+a+"(\\s+|$)")};a(" "+this.options.baseClassName+"-open").test(this.$wrapEl.className)||(this.$wrapEl.className+=" "+this.options.baseClassName+"-open"),a(" "+this.options.baseClassName+"-open").test(this.$layerEl.childNodes[0].className)||(this.$layerEl.childNodes[0].className+=" "+this.options.baseClassName+"-open")},_hide:function(){var a=this;if(n.splice(0,1),n.length>0)this._create();else{m=!1;var b=function(){l(a.$wrapEl),a.$targetEl===(document.body||document.documentElement)&&a.options.flagBodyScroll===!1&&(a.$targetEl.style.removeProperty?a.$targetEl.style.removeProperty("overflow"):a.$targetEl.style.removeAttribute("overflow"))},c=function(d){d.stopPropagation(),f(a.$wrapEl,q.type,c),b()},d=function(b){b.stopPropagation(),f(a.$layerEl,q.type,c)};this.$wrapEl.className=this.$wrapEl.className.replace(" "+this.options.baseClassName+"-open",""),q.supported?e(a.$wrapEl,q.type,c):b(),this.$layerEl.childNodes[0].className=this.$layerEl.childNodes[0].className.replace(" "+this.options.baseClassName+"-open",""),q.supported&&e(a.$layerEl,q.type,d)}},_loading:function(a){this.$loadingEl=h({tag:"div."+this.options.baseClassName+"-loading."+this.options.loader}),a?(this._resetLayer(),g(this.$layerEl.childNodes[0],{height:"60px",width:"60px",borderRadius:"30px"}),i(this.$layerEl.childNodes[0],this.$loadingEl),this._appendPopup()):g(this.$layerEl.childNodes[0],{height:null,width:null,borderRadius:null})},_loadContents:function(a){var b=a.ajax.url,c="undefined"!=typeof a.ajax.str?a.ajax.str:"",d="undefined"!=typeof a.ajax.post?a.ajax.post:!0,e=this;if(b.match(o)){var f=h({children:{tag:"img",src:b}});this._loading(!0),this._preLoadImage(f,function(){e._loading(!1),a.content=f,e._createPopup(a)})}else this._ajax(b,c,d,function(b){var c=h({html:this});e._preLoadImage(c,function(){e._loading(!1),a.content=c,e._createPopup(a)})},function(){e._loading(!0)})},_preLoadImage:function(a,b){for(var c,d=k(a,"img"),g=d.length,h=g;g--;)c=d[g],c.complete?h--:(e(c,"load",i),e(c,"error",i));!h&&i();var i=function(){if(--h<=0){for(g=d.length;g--;)c=d[g],f(c,"load",i),f(c,"error",i);b()}}},_ajax:function(a,b,c,d,e){var f;if(window.XMLHttpRequest)f=new XMLHttpRequest;else if(ActiveXObject("Microsoft.XMLHTTP"))f=new ActiveXObject("Microsoft.XMLHTTP");else{if(!ActiveXObject("Msxml2.XMLHTTP"))return alert("Error: Your browser does not support AJAX."),!1;f=new ActiveXObject("Msxml2.XMLHTTP")}return f.onreadystatechange=function(){4==f.readyState&&200==f.status&&d&&d.call(f.responseText)},c===!1?(f.open("GET",a+b,!0),f.send(null)):(f.open("POST",a,!0),f.setRequestHeader("Content-type","application/x-www-form-urlencoded"),f.send(b)),e&&e.call(),f},_okEvent:function(a){"undefined"!=typeof a.preventDefault&&a.preventDefault(),"function"==typeof this.callbacks.onSubmit&&("undefined"!=typeof this.$input?this.callbacks.onSubmit.call(this,this.$input.value):this.callbacks.onSubmit.call(this)),this._commonEvent()},_cancelEvent:function(a){"undefined"!=typeof a.preventDefault&&a.preventDefault(),"function"==typeof this.callbacks.onClose&&this.callbacks.onClose.call(this),this._commonEvent()},_commonEvent:function(){"undefined"!=typeof this.$btnOK&&f(this.$btnOK,"click",this._okEvent),"undefined"!=typeof this.$btnCancel&&f(this.$btnCancel,"click",this._cancelEvent),this.options.flagShowCloseBtn&&f(document.getElementById("popupS-close"),"click",this._cancelEvent),this.options.flagCloseByOverlay&&f(this.$overlayEl,"click",this._cancelEvent),this.options.flagCloseByEsc&&f(document.body,"keyup",this._keyEvent),this._hide()},_resetEvent:function(a){j(this.$layerEl)},_keyEvent:function(a){var b=a.keyCode;"undefined"!=typeof this.$input&&13===b&&this._okEvent(a),27===b&&this._cancelEvent(a)}};var r=/^(\w+)?(#[\w_-]+)?((?:\.[\w_-]+)*)/i,s=new a;return s.window=function(a){this._open(a)},s.alert=function(a){a=d(a,{mode:"alert"}),this._open(a)},s.confirm=function(a){a=d(a,{mode:"confirm"}),this._open(a)},s.prompt=function(a){a=d(a,{mode:"prompt"}),this._open(a)},s.modal=function(a){a=d(a,{mode:"modal"}),this._open(a)},s.ajax=function(a){a=d(a,{mode:"modal-ajax"}),this._open(a)},s});
/*! popups 1.1.3 - MIT | https://github.com/ChiefORZ/popupS.git */
!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.popupS=b()}(this,function(){"use strict";function a(){}function b(a,b){var c=[].slice.call(arguments,2);return b.bind?b.bind.apply(b,[a].concat(c)):function(){return b.apply(a,c.concat([].slice.call(arguments)))}}function c(a,b){if(a)for(var c in a)a.hasOwnProperty(c)&&b(a[c],c,a)}function d(a){a=a||{};for(var b=1;b<arguments.length;b++)if(arguments[b])for(var c in arguments[b])arguments[b].hasOwnProperty(c)&&(a[c]=arguments[b][c]);return a}function e(a,b,c){"function"==typeof a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)}function f(a,b,c){"function"==typeof a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)}function g(a,b,c){if(a&&a.style&&b)if(b instanceof Object)for(var d in b)g(a,d,b[d]);else a.style[b]=c}function h(a){null===a&&(a="div"),"string"==typeof a&&(a={tag:a});var b,d,e=document.createDocumentFragment(),f=a.children,j=r.exec(a.tag||"");return delete a.children,a.tag=j[1]||"div",a.id=a.id||(j[2]||"").substr(1),d=(j[3]||"").split("."),d[0]=a.className||"",a.className=d.join(" "),b=document.createElement(a.tag),i(e,b),delete a.tag,c(a,function(c,d){if("css"===d)g(b,a.css);else if("text"===d)null!==c&&i(b,document.createTextNode(c));else if("html"===d)null!==c&&(b.innerHTML=c);else if(d in b)try{b[d]=c}catch(e){b.setAttribute(d,c)}else/^data-/.test(d)&&b.setAttribute(d,c)}),f&&f.appendChild?i(b,f):f&&(f instanceof Array?c(f,function(a,c){a instanceof Object&&i(b,h(a))}):f instanceof Object&&i(b,h(f))),b}function i(a,b){try{a&&b&&a.appendChild(b)}catch(c){}}function j(a){for(var b,c,d=k(a,"input"),e=0,f=d.length;f>e;e++)if(b=d[e],"submit"===b.type)!c&&(c=b);else if(!/hidden|check|radio/.test(b.type)&&""===b.value){c=b;break}c||(c=k(a,"button")[0]);try{c.focus()}catch(g){}}function k(a,b){return a.getElementsByTagName(b)}function l(a){a&&a.parentNode&&a.parentNode.removeChild(a)}var m=!1,n=[],o=new RegExp(/([^\/\\]+)\.(jpg|jpeg|png|gif)$/i),p={additionalBaseClass:"",additionalButtonHolderClass:"",additionalButtonOkClass:"",additionalButtonCancelClass:"",additionalCloseBtnClass:"",additionalFormClass:"",additionalOverlayClass:"",additionalPopupClass:"",appendLocation:document.body||document.documentElement,baseClassName:"popupS",closeBtn:"&times;",flagBodyScroll:!1,flagButtonReverse:!1,flagCloseByEsc:!0,flagCloseByOverlay:!0,flagShowCloseBtn:!0,labelOk:"OK",labelCancel:"Cancel",loader:"spinner",zIndex:1e4},q=function(){var a,b,c=!1,d=document.createElement("fakeelement"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"};for(a in e)if(e.hasOwnProperty(a)&&void 0!==d.style[a]){b=e[a],c=!0;break}return{type:b,supported:c}}();a.prototype={constructor:a,_open:function(a){if("string"!=typeof a.mode)throw new Error("mode must be a string");if("undefined"!=typeof a.title&&"string"!=typeof a.title)throw new Error("title must be a string");if("undefined"!=typeof a.placeholder&&"string"!=typeof a.placeholder)throw new Error("placeholder must be a string");this.options=a=d({},a);for(var e in p)!(e in a)&&(a[e]=p[e]);c(["additionalBaseClass","additionalButtonHolderClass","additionalButtonOkClass","additionalButtonCancelClass","additionalCloseBtnClass","additionalFormClass","additionalOverlayClass","additionalPopupClass"],function(b){var c=a[b].split(" ").join(".");a[b]="."+c});for(var f in this)"_"===f.charAt(0)&&(this[f]=b(this,this[f]));if(this._init(),a.force===!0)for(;n.length>0;)n.pop();n.push(a),m&&a.force!==!0||this._create()},_init:function(){this.$layerEl&&this.$layerEl.style.opacity&&(this.$layerEl.style.opacity=""),this.$wrapEl||(this.$wrapEl=h({tag:"div."+this.options.baseClassName+"-base"+(this.options.additionalBaseClass?this.options.additionalBaseClass:""),css:{top:0,left:0,right:0,bottom:0,position:"fixed",textAlign:"center",overflowX:"auto",overflowY:"auto",outline:0,whiteSpace:"nowrap",zIndex:this.options.zIndex},children:{css:{height:"100%",display:"inline-block",verticalAlign:"middle"}}}),i(this.$wrapEl,this._getOverlay()),i(this.$wrapEl,this._getLayer()))},_getOverlay:function(){return this.$overlayEl||(this.$overlayEl=h({tag:"#popupS-overlay."+this.options.baseClassName+"-overlay"+(this.options.additionalOverlayClass?this.options.additionalOverlayClass:""),css:{top:0,right:0,bottom:0,left:0,position:"fixed",overflowX:"hidden",userSelect:"none",webkitUserSelect:"none",MozUserSelect:"none"}})),this.$overlayEl.setAttribute("unselectable","on"),this.$overlayEl},_getLayer:function(){return this.$layerEl||(this.$layerEl=h({css:{display:"inline-block",position:"relative",textAlign:"left",whiteSpace:"normal",verticalAlign:"middle",maxWidth:"100%",overflowX:"hidden",transform:"translate3d(0,0,0)"},children:{tag:"."+this.options.baseClassName+"-layer"+(this.options.additionalPopupClass?this.options.additionalPopupClass:"")}})),this.$layerEl},_resetLayer:function(){this.$layerEl.childNodes[0].innerHTML=""},_create:function(){var a=this,c=n[0],d=c.mode;m=!0,"modal-ajax"!=d?this._createPopup(c):this._loadContents(c);var e=function(b){b.stopPropagation(),_unbind(a.$layerEl,q.type,e)};q.supported&&b(a.$layerEl,q.type,e)},_createPopup:function(a){var b,c,d,f=a.mode,g=a.title,k=a.content,l=a.className?"."+a.className:"",m=k instanceof Object?!0:!1;this.callbacks={onOpen:a.onOpen,onSubmit:a.onSubmit,onClose:a.onClose},b={tag:"button#popupS-button-ok."+this.options.baseClassName+"-button-ok"+(this.options.additionalButtonOkClass?this.options.additionalButtonOkClass:""),text:this.options.labelOk},c={tag:"button#popupS-button-cancel."+this.options.baseClassName+"-button-ok"+(this.options.additionalButtonCancelClass?this.options.additionalButtonCancelClass:""),text:this.options.labelCancel},d=[{html:k},"modal"!=f&&"modal-ajax"!=f&&"prompt"==f&&{tag:"form."+this.options.baseClassName+"-form"+(this.options.additionalFormClass?this.options.additionalFormClass:""),children:[a.placeholder&&{tag:"label",htmlFor:"popupS-input",text:a.placeholder},{tag:"input#popupS-input",type:"text"}]},"modal"!=f&&"modal-ajax"!=f&&{tag:"nav."+this.options.baseClassName+"-buttons"+(this.options.additionalButtonHolderClass?this.options.additionalButtonHolderClass:""),children:"prompt"==f||"confirm"==f?this.options.flagButtonReverse?[b,c]:[c,b]:[b]}],k=h({children:[{tag:"a#popupS-resetFocusBack."+this.options.baseClassName+"-resetFocus",href:"#",text:"Reset Focus"},this.options.flagShowCloseBtn&&{tag:"span#popupS-close."+this.options.baseClassName+"-close"+(this.options.additionalCloseBtnClass?this.options.additionalCloseBtnClass:""),html:this.options.closeBtn},g&&{tag:"h5."+this.options.baseClassName+"-title"+l,text:g},{tag:"."+this.options.baseClassName+"-content"+l,children:m&&k||d},{tag:"a#popupS-resetFocus."+this.options.baseClassName+"-resetFocus",href:"#",text:"Reset Focus"}]}),this._resetLayer(),i(this.$layerEl.childNodes[0],k),this._appendPopup(),this.$contentEl=this.$layerEl.getElementsByClassName(this.options.baseClassName+"-content")[0],this.$btnReset=document.getElementById("popupS-resetFocus"),this.$btnResetBack=document.getElementById("popupS-resetFocusBack"),e(this.$btnReset,"focus",this._resetEvent),e(this.$btnResetBack,"focus",this._resetEvent),j(this.$layerEl),this.$btnOK=document.getElementById("popupS-button-ok")||void 0,this.$btnCancel=document.getElementById("popupS-button-cancel")||void 0,this.$input=document.getElementById("popupS-input")||void 0,"undefined"!=typeof this.$btnOK&&e(this.$btnOK,"click",this._okEvent),"undefined"!=typeof this.$btnCancel&&e(this.$btnCancel,"click",this._cancelEvent),this.options.flagShowCloseBtn&&e(document.getElementById("popupS-close"),"click",this._cancelEvent),this.options.flagCloseByOverlay&&e(this.$overlayEl,"click",this._cancelEvent),this.options.flagCloseByEsc&&e(document.body,"keyup",this._keyEvent),"function"==typeof this.callbacks.onOpen&&this.callbacks.onOpen.call(this)},_appendPopup:function(){this.$targetEl=this.options.appendLocation,i(this.$targetEl,this.$wrapEl),this.$targetEl===(document.body||document.documentElement)&&this.options.flagBodyScroll===!1&&g(this.$targetEl,{overflow:"hidden"}),window.getComputedStyle&&window.getComputedStyle(this.$wrapEl,null).height;var a=function(a){return new RegExp("(|\\s+)"+a+"(\\s+|$)")};a(" "+this.options.baseClassName+"-open").test(this.$wrapEl.className)||(this.$wrapEl.className+=" "+this.options.baseClassName+"-open"),a(" "+this.options.baseClassName+"-open").test(this.$layerEl.childNodes[0].className)||(this.$layerEl.childNodes[0].className+=" "+this.options.baseClassName+"-open")},_hide:function(){var a=this;if(n.splice(0,1),n.length>0)this._create();else{m=!1;var b=function(){l(a.$wrapEl),a.$targetEl===(document.body||document.documentElement)&&a.options.flagBodyScroll===!1&&(a.$targetEl.style.removeProperty?a.$targetEl.style.removeProperty("overflow"):a.$targetEl.style.removeAttribute("overflow"))},c=function(d){d.stopPropagation(),f(a.$wrapEl,q.type,c),b()},d=function(b){b.stopPropagation(),f(a.$layerEl,q.type,c)};this.$wrapEl.className=this.$wrapEl.className.replace(" "+this.options.baseClassName+"-open",""),q.supported?e(a.$wrapEl,q.type,c):b(),this.$layerEl.childNodes[0].className=this.$layerEl.childNodes[0].className.replace(" "+this.options.baseClassName+"-open",""),q.supported&&e(a.$layerEl,q.type,d)}},_loading:function(a){this.$loadingEl=h({tag:"div."+this.options.baseClassName+"-loading."+this.options.loader}),a?(this._resetLayer(),g(this.$layerEl.childNodes[0],{height:"60px",width:"60px",borderRadius:"30px"}),i(this.$layerEl.childNodes[0],this.$loadingEl),this._appendPopup()):g(this.$layerEl.childNodes[0],{height:null,width:null,borderRadius:null})},_loadContents:function(a){var b=a.ajax.url,c="undefined"!=typeof a.ajax.str?a.ajax.str:"",d="undefined"!=typeof a.ajax.post?a.ajax.post:!0,e=this;if(b.match(o)){var f=h({children:{tag:"img",src:b}});this._loading(!0),this._preLoadImage(f,function(){e._loading(!1),a.content=f,e._createPopup(a)})}else this._ajax(b,c,d,function(b){var c=h({html:this});e._preLoadImage(c,function(){e._loading(!1),a.content=c,e._createPopup(a)})},function(){e._loading(!0)})},_preLoadImage:function(a,b){for(var c,d=k(a,"img"),g=d.length,h=g;g--;)c=d[g],c.complete?h--:(e(c,"load",i),e(c,"error",i));!h&&i();var i=function(){if(--h<=0){for(g=d.length;g--;)c=d[g],f(c,"load",i),f(c,"error",i);b()}}},_ajax:function(a,b,c,d,e){var f;if(window.XMLHttpRequest)f=new XMLHttpRequest;else if(ActiveXObject("Microsoft.XMLHTTP"))f=new ActiveXObject("Microsoft.XMLHTTP");else{if(!ActiveXObject("Msxml2.XMLHTTP"))return alert("Error: Your browser does not support AJAX."),!1;f=new ActiveXObject("Msxml2.XMLHTTP")}return f.onreadystatechange=function(){4==f.readyState&&200==f.status&&d&&d.call(f.responseText)},c===!1?(f.open("GET",a+b,!0),f.send(null)):(f.open("POST",a,!0),f.setRequestHeader("Content-type","application/x-www-form-urlencoded"),f.send(b)),e&&e.call(),f},_okEvent:function(a){"undefined"!=typeof a.preventDefault&&a.preventDefault(),"function"==typeof this.callbacks.onSubmit&&("undefined"!=typeof this.$input?this.callbacks.onSubmit.call(this,this.$input.value):this.callbacks.onSubmit.call(this)),this._commonEvent()},_cancelEvent:function(a){"undefined"!=typeof a.preventDefault&&a.preventDefault(),"function"==typeof this.callbacks.onClose&&this.callbacks.onClose.call(this),this._commonEvent()},_commonEvent:function(){"undefined"!=typeof this.$btnOK&&f(this.$btnOK,"click",this._okEvent),"undefined"!=typeof this.$btnCancel&&f(this.$btnCancel,"click",this._cancelEvent),this.options.flagShowCloseBtn&&f(document.getElementById("popupS-close"),"click",this._cancelEvent),this.options.flagCloseByOverlay&&f(this.$overlayEl,"click",this._cancelEvent),this.options.flagCloseByEsc&&f(document.body,"keyup",this._keyEvent),this._hide()},_resetEvent:function(a){j(this.$layerEl)},_keyEvent:function(a){var b=a.keyCode;"undefined"!=typeof this.$input&&13===b&&this._okEvent(a),27===b&&this._cancelEvent(a)}};var r=/^(\w+)?(#[\w_-]+)?((?:\.[\w_-]+)*)/i,s=new a;return s.window=function(a){this._open(a)},s.alert=function(a){a=d(a,{mode:"alert"}),this._open(a)},s.confirm=function(a){a=d(a,{mode:"confirm"}),this._open(a)},s.prompt=function(a){a=d(a,{mode:"prompt"}),this._open(a)},s.modal=function(a){a=d(a,{mode:"modal"}),this._open(a)},s.ajax=function(a){a=d(a,{mode:"modal-ajax"}),this._open(a)},s});

@@ -40,3 +40,4 @@ 'use strict';

files: {
'css/<%= pkg.name %>.min.css': ['css/popupS.css']
'css/<%= pkg.name %>.min.css': ['css/popupS.css'],
'assets/main.css': ['assets/src/index.css']
}

@@ -62,3 +63,4 @@ }

clean: [
'css/popupS.min.css'
'css/popupS.min.css',
'assets/main.css'
]

@@ -65,0 +67,0 @@

{
"name": "popups",
"version": "1.1.2",
"version": "1.1.3",
"description": "Native Javascript Modal/Popup system. With react support!",

@@ -5,0 +5,0 @@ "main": "dist/popupS.js",

@@ -101,2 +101,4 @@ module.exports = {

verticalAlign: 'middle',
maxWidth: '100%',
overflowX: 'hidden',
transform: 'translate3d(0,0,0)'

@@ -103,0 +105,0 @@ },

Sorry, the diff of this file is not supported yet

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