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

@abtasty/modal

Package Overview
Dependencies
Maintainers
17
Versions
201
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abtasty/modal - npm Package Compare versions

Comparing version 2.5.14 to 2.5.15-0

2

dist/main.js

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

!function(){"use strict";function t(){V&&(document.querySelector("body").style.overflowY=V),H.style.display="none","video"===m&&(H.innerHTML=""),void 0!==Q&&ABTastyEvent(Q+" "+m+" modal closed",null,TEST_ID)}function a(){return H.querySelector(J)&&H.querySelector(G)?(H.querySelector(J).addEventListener("click",t),H.querySelector(G).addEventListener("click",t),0):setTimeout(a,50)}function e(t,a){return t.matches?t.matches(a):t.msMatchesSelector(a)}function o(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a={layout:S,type:m,borderRadius:p,borderRadiusImage:_,borderWidth:f,borderColor:g,button:h,buttonBackgroundColor:v,buttonLink:x,buttonText:w,buttonTextColor:k,backgroundColor:"imageOnly"!==S?b:"initial",overlayOpacity:u,backgroundImage:c,image:N,width:M,videoLink:L,customWidth:B,animation:y,title:E,closeButtonPosition:I,backgroundCloseButtonColor:T,modalContent:O||t.outerHTML};if(H.className="abtasty-modal abtasty-modal--"+m,H.dataset.testId=TEST_ID,H.innerHTML=l(a),document.body.appendChild(H),K=H.querySelector(".abtasty-modal__area"),C){H.querySelector(G+" .close-x").style.stroke=C}}function i(){var t=(window.innerWidth>630?.5*window.innerWidth:window.innerWidth-40)/16*9;return Math.round(t)}function n(){var t="abtasty-widget-video-"+Date.now(),a=document.createElement("iframe");a.setAttribute("id",t);var e=function(t){var a=t.indexOf("youtu")>-1,e=t.indexOf("vimeo")>-1,o=void 0;a?(o="//www.youtube.com/embed/"+t.match(/^.*(youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#&?]*).*/)[2]+"?rel=0",q&&(o+="&autoplay=1")):e&&(o="//player.vimeo.com/video/"+t.match(/.*(www\.)?vimeo.com\/(\d+)($|\/)/)[2]);return o}(L),n=i();a.style.height=n+"px","no-title"===S&&(a.style.border=f+"px solid "+g+"!important",a.style.borderRadius=p+"px!important"),a.src=e,a.frameBorder=0,a.allowfullscreen=!0,o(a),K.style.height=n+"px",window.addEventListener("resize",function(){var t=document.querySelector("abtasty-modal iframe"),a=i();t.style.height=a+"px",K.style.height=a+"px"})}function r(){if(function(){var t=Number(W),a=localStorage.getItem(U);return!(a&&-1!==t&&!j&&!F)||(0===t?!sessionStorage.getItem(U):a<$-24*t*60*60*1e3)}()){if("video"===m)n(),a();else if("image"===m&&"fit"===M){var t=new Image;t.src=N,t.className="abtasty-modal__media",t.onload=function(){o(this),K.style.width=this.width+"px",K.style.height=this.height+"px",a()}}else o(),a();H.style.display="block",function(){var t=document.querySelector("body");V=window.getComputedStyle(t).overflowY,t.style.overflowY="hidden"}(),void 0!==Q&&ABTastyEvent(Q+" "+m+" modal displayed",null,TEST_ID),j||(localStorage.setItem(U,$),sessionStorage.setItem(U,$))}}!function(t,a){if("undefined"==typeof document)return a;t=t||"";var e=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",e.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}("abtasty-modal{display:none;position:fixed;top:0;left:0;width:100%;height:100%;z-index:2147483145}abtasty-modal:not(.abtasty-modal--video){overflow-y:auto}abtasty-modal__underlay{width:100%;height:100%;position:fixed;top:0;left:0;background-color:rgba(0,0,0,.5);cursor:pointer}.abtasty-modal__area{top:0;left:0;right:0;width:auto;margin:10px!important;z-index:100;position:relative;float:none}.abtasty-modal__area-layout--imageOnly{max-width:80%}.abtasty-modal__area-layout--imageOnly img{border-style:solid;-webkit-box-sizing:border-box;box-sizing:border-box;max-width:100%;opacity:1}.abtasty-modal__area-type--video.abtasty-modal__area-layout--no-title .abtasty-modal__content{padding:5px;border-radius:0!important;border-width:0!important;background-color:transparent!important;background-image:none!important}.abtasty-modal__area-type--video.abtasty-modal__area-layout--bottom .abtasty-modal__content{padding:25px 20px 20px}.abtasty-modal .abtasty-modal__content{border-color:#f6f6f6;border-style:solid;padding:20px}.abtasty-modal__area-type--image,.abtasty-modal__area-type--no-title,.abtasty-modal__area-type--simple,.abtasty-modal__area-type--video{margin:0 auto 20px!important;top:10vh;border:none;background:none}.abtasty-modal__area-type--video.abtasty-modal__area-layout--bottom .abtasty-modal__close--inside{top:2px}.abtasty-modal__area-type--video.abtasty-modal__area-layout--top .abtasty-modal__close--inside{right:15px;top:20px}.abtasty-modal__area-type--image .abtasty-modal__close,.abtasty-modal__area-type--simple .abtasty-modal__close{right:10px;top:15px}.abtasty-modal__close{position:absolute;right:5px;top:0;font-size:20px;font-weight:300;background:transparent;border:0;color:#222;font-family:Helvetica Neue,Helvetica,Arial,sans-serif!important;line-height:24px!important;margin-right:5px;cursor:pointer;width:20px;height:20px;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-modal__close svg{display:block}.abtasty-modal__close svg .close-x{stroke:#5c5c5c;fill:transparent;stroke-linecap:round;stroke-width:3}.abtasty-modal__area-type--video.abtasty-modal__area-layout--no-title .abtasty-modal__close--inside{top:-6px;right:-15px;background:#fff;border-radius:20px;width:20px;height:20px}.abtasty-modal__area-type--image .abtasty-modal__close--outside,.abtasty-modal__area-type--simple .abtasty-modal__close--outside,.abtasty-modal__close--outside,.abtasty-modal__close .abtasty-modal__close--outside{top:-25px;right:-25px;width:20px;height:20px}.abtasty-modal__close--outside{background:#fff;border-radius:20px}.abtasty-modal__media,.abtasty-modal__media-link{max-width:100%;display:block}.abtasty-modal__text{padding:20px;font-family:Open Sans,sans-serif!important;color:#000;overflow:auto}.abtasty-modal__title{width:auto;font-size:20px!important;font-weight:500;line-height:1.1;margin-bottom:10px}.abtasty-modal__text p{margin:0 0 10px!important;font-size:15px;font-weight:300;word-wrap:break-word}.abtasty-modal__button{width:100%;text-align:center;margin-top:20px}.abtasty-modal__button a{padding:10px 20px;border-radius:10px;display:inline-block;font-weight:700}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--center .abtasty-modal__title{text-align:center}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--center .abtasty-modal__innertext{text-align:center;white-space:pre-wrap}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--left .abtasty-modal__title{width:50%;float:left;text-align:center;vertical-align:middle}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--left .abtasty-modal__innertext{width:50%;float:left}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--right .abtasty-modal__title{width:50%;float:left;text-align:center;vertical-align:middle}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--right .abtasty-modal__innertext{width:50%;float:left}.abtasty-modal__area-type--image .abtasty-modal__image img{max-height:400px;max-width:100%;display:inline;opacity:1}.abtasty-modal__area-type--image.abtasty-modal__area-layout--left .abtasty-modal__image{width:50%;display:inline-block;height:auto;vertical-align:middle;text-align:center}.abtasty-modal__area-type--image.abtasty-modal__area-layout--left .abtasty-modal__text{text-align:left;width:50%;display:inline-block;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-modal__area-type--image.abtasty-modal__area-layout--right .abtasty-modal__image{width:50%;display:inline-block;height:auto;vertical-align:middle;text-align:center}.abtasty-modal__area-type--image.abtasty-modal__area-layout--right .abtasty-modal__text{text-align:left;width:50%;display:inline-block;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-modal__area-type--image.abtasty-modal__area-layout--top .abtasty-modal__image{width:100%;text-align:center}.abtasty-modal__area-type--image.abtasty-modal__area-layout--top .abtasty-modal__text{width:100%;padding:20px 0}.abtasty-modal__area-type--image.abtasty-modal__area-layout--top .abtasty-modal__image img{max-height:300px;opacity:1}.abtasty-modal__area-type--image.abtasty-modal__area-layout--bottom .abtasty-modal__image{width:100%;text-align:center}.abtasty-modal__area-type--image.abtasty-modal__area-layout--bottom .abtasty-modal__text{width:100%;padding:20px 0}.abtasty-modal__area-type--video{text-align:center;width:100%}.abtasty-modal__area-type--video iframe{width:100%}@media (min-width:630px){abtasty-modal:not(.abtasty-modal--video) .abtasty-modal__area-width--medium{width:600px;margin:0 auto 20px!important}.abtasty-modal--video{width:50%;left:25%}}@media (min-width:330px){abtasty-modal:not(.abtasty-modal--video) .abtasty-modal__area-width--small{width:300px;margin:0 auto 20px!important}}@media (min-width:930px){abtasty-modal:not(.abtasty-modal--video) .abtasty-modal__area-width--large{width:900px;margin:0 auto 20px!important}}.abtasty-animation-fadeIn{-webkit-animation-name:abTastyfadeIn;animation-name:abTastyfadeIn}.abtasty-animation-fadeIn,.abtasty-animation-fadeOut{-webkit-animation-duration:.5s;animation-duration:.5s}.abtasty-animation-fadeOut{-webkit-animation-name:abTastyfadeOut;animation-name:abTastyfadeOut}.abtasty-animation-slideIn{-webkit-animation-name:abTastyslideInDown;animation-name:abTastyslideInDown;-webkit-animation-duration:.5s;animation-duration:.5s}.abtasty-animation-slideOut{-webkit-animation-name:abTastyslideOutUp;animation-name:abTastyslideOutUp;-webkit-animation-duration:.5s;animation-duration:.5s}@-webkit-keyframes abTastyfadeIn{0%{opacity:0}to{opacity:1}}@keyframes abTastyfadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes abTastyfadeOut{0%{opacity:1}to{opacity:0}}@keyframes abTastyfadeOut{0%{opacity:1}to{opacity:0}}@-webkit-keyframes abTastyslideInDown{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes abTastyslideInDown{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes abTastyslideOutUp{0%{-webkit-transform:translateY(0);transform:translateY(0)}to{-webkit-transform:translateY(-100%);transform:translateY(-100%)}}@keyframes abTastyslideOutUp{0%{-webkit-transform:translateY(0);transform:translateY(0)}to{-webkit-transform:translateY(-100%);transform:translateY(-100%)}}",void 0);var d=function(t){function a(t,e){if(1===arguments.length){for(var i=t[0],n=1;n<t.length;n++)i=a(i,t[n]);return i}for(var r in e)if("class"===r){var d=t[r]||[];t[r]=(Array.isArray(d)?d:[d]).concat(e[r]||[])}else if("style"===r){d=o(t[r]);var l=o(e[r]);t[r]=d+l}else t[r]=e[r];return t}function e(t,a){return Array.isArray(t)?function(t,a){for(var o,i="",r="",d=Array.isArray(a),l=0;l<t.length;l++)(o=e(t[l]))&&(d&&a[l]&&(o=n(o)),i=i+r+o,r=" ");return i}(t,a):t&&"object"==typeof t?function(t){var a="",e="";for(var o in t)o&&t[o]&&d.call(t,o)&&(a=a+e+o,e=" ");return a}(t):t||""}function o(t){if(!t)return"";if("object"==typeof t){var a="";for(var e in t)d.call(t,e)&&(a=a+e+":"+t[e]+";");return a}return";"!==(t+="")[t.length-1]?t+";":t}function i(t,a,e,o){return!1!==a&&null!=a&&(a||"class"!==t&&"style"!==t)?!0===a?" "+(o?t:t+'="'+t+'"'):("function"==typeof a.toJSON&&(a=a.toJSON()),"string"==typeof a||(a=JSON.stringify(a),e||-1===a.indexOf('"'))?(e&&(a=n(a))," "+t+'="'+a+'"'):" "+t+"='"+a.replace(/'/g,"&#39;")+"'"):""}function n(t){var a=""+t,e=l.exec(a);if(!e)return t;var o,i,n,r="";for(o=e.index,i=0;o<a.length;o++){switch(a.charCodeAt(o)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 60:n="&lt;";break;case 62:n="&gt;";break;default:continue}i!==o&&(r+=a.substring(i,o)),i=o+1,r+=n}return i!==o?r+a.substring(i,o):r}function r(t,a,e,o){if(!(t instanceof Error))throw t;if(!("undefined"==typeof window&&a||o))throw t.message+=" on line "+e,t;try{o=o||require("fs").readFileSync(a,"utf8")}catch(a){r(t,null,e)}var i=3,n=o.split("\n"),d=Math.max(e-i,0),l=Math.min(n.length,e+i);i=n.slice(d,l).map(function(t,a){var o=a+d+1;return(o==e?" > ":" ")+o+"| "+t}).join("\n");throw t.path=a,t.message=(a||"Pug")+":"+e+"\n"+i+"\n\n"+t.message,t}var d=Object.prototype.hasOwnProperty;t.merge=a,t.classes=e,t.style=o,t.attr=i,t.attrs=function(t,a){var n="";for(var r in t)if(d.call(t,r)){var l=t[r];if("class"===r){n=i(r,l=e(l),!1,a)+n;continue}"style"===r&&(l=o(l)),n+=i(r,l,!1,a)}return n};var l=/["&<>]/;return t.escape=n,t.rethrow=r,t}({}),l=function(t){var a,e="",o={};try{var i={},n=t||{};(function(t,i,n,r,l,s,m,y,b,u,c,p,_,f,g,h,v,x,w,k,T,C){o.button=a=function(){this&&this.block,this&&this.attributes;e=(e=(e+='<div class="abtasty-modal__button">')+"<a"+(d.attr("href",c,!0,!0)+d.attr("style",d.style({"background-color":u+"!important",color:_+"!important"}),!0,!0))+">")+d.escape(null==(a=p)?"":a)+"</a></div>"},o.title=a=function(){this&&this.block,this&&this.attributes;e=(e+='<h2 class="abtasty-modal__title" style="text-align:center;">')+(null==(a=k)?"":a)+"</h2>"},o.imageOnly=a=function(){this&&this.block,this&&this.attributes;e=e+"<img"+(d.attr("src",h,!0,!0)+d.attr("style",d.style({"border-radius":s+"px!important","border-width":y+"px!important","border-color":l+"!important"}),!0,!0))+">"},o.imageWithText=a=function(){this&&this.block,this&&this.attributes;e+='<div class="abtasty-modal__image">',h&&(e=e+"<img"+(d.attr("src",h,!0,!0)+d.attr("style",d.style({"border-radius":m+"px!important"}),!0,!0))+">"),e+="</div>"},o.content=a=function(){this&&this.block,this&&this.attributes;e+='<div class="abtasty-modal__innertext">',e=(e+="<p>")+(null==(a=x)?"":a)+"</p></div>"},o.closeButton=a=function(){this&&this.block,this&&this.attributes;e=e+"<div"+d.attr("class",d.classes(["abtasty-modal__close",f?"abtasty-modal__close--"+f:""],[!1,!0]),!1,!0)+" data-abtasty-actionnable"+d.attr("style",d.style("outside"===f?{"background-color":i}:""),!0,!0)+">",e+='<svg viewbox="0 0 40 40">',e+='<path class="close-x" d="M 10,10 L 30,30 M 30,10 L 10,30"></path></svg></div>'},o.contentWrapper=a=function(){var t=this&&this.block;this&&this.attributes;e=e+'<div class="abtasty-modal__content"'+d.attr("style",d.style({"border-radius":s+"px!important","border-width":y+"px!important","border-color":l+"!important","background-color":n+"!important","background-image":'url("'+r+'")!important'}),!0,!0)+">",t&&t&&t(),e+="</div>"},o.modalWrapper=a=function(){var a=this&&this.block;this&&this.attributes;e=(e=e+"<abtasty-modal__underlay"+d.attr("style",d.style({"background-color":"rgba(0, 0, 0, "+w/100+")"}),!0,!0)+"></abtasty-modal__underlay>")+"<div"+(d.attr("class",d.classes(["abtasty-animation-"+t+" abtasty-modal__area abtasty-modal__area-width--"+C+" abtasty-modal__area-type--"+T+" abtasty-modal__area-layout--"+v],[!0]),!1,!0)+d.attr("style",d.style({width:"custom"===C&&g+"%","margin-left":"custom"===C&&(100-g)/2+"% !important"}),!0,!0))+">",a&&a&&a(),e+="</div>"},o.modalWrapper.call({block:function(){o.closeButton(),"image"===T&&"imageOnly"===v?(o.imageOnly(),b&&o.button()):o.contentWrapper.call({block:function(){"simple"===T?(e+='<div class="abtasty-modal__text">',"center"===v||"left"===v?(o.title(),o.content(),e+='<div style="clear:both;"></div>'):(o.content(),o.title(),e+='<div style="clear:both;"></div>'),e+="</div>",b&&o.button()):"image"===T?("top"!==v&&"left"!==v||o.imageWithText(),e+='<div class="abtasty-modal__text">',o.title(),o.content(),b&&o.button(),e+="</div>","right"!==v&&"bottom"!==v||o.imageWithText(),e+='<div style="clear:both;"></div>'):"video"===T&&("top"===v&&o.title(),e+=null==(a=x)?"":a,"bottom"===v&&o.title(),b&&o.button())}})}})}).call(this,"animation"in n?n.animation:"undefined"!=typeof animation?animation:void 0,"backgroundCloseButtonColor"in n?n.backgroundCloseButtonColor:"undefined"!=typeof backgroundCloseButtonColor?backgroundCloseButtonColor:void 0,"backgroundColor"in n?n.backgroundColor:"undefined"!=typeof backgroundColor?backgroundColor:void 0,"backgroundImage"in n?n.backgroundImage:"undefined"!=typeof backgroundImage?backgroundImage:void 0,"borderColor"in n?n.borderColor:"undefined"!=typeof borderColor?borderColor:void 0,"borderRadius"in n?n.borderRadius:"undefined"!=typeof borderRadius?borderRadius:void 0,"borderRadiusImage"in n?n.borderRadiusImage:"undefined"!=typeof borderRadiusImage?borderRadiusImage:void 0,"borderWidth"in n?n.borderWidth:"undefined"!=typeof borderWidth?borderWidth:void 0,"button"in n?n.button:"undefined"!=typeof button?button:void 0,"buttonBackgroundColor"in n?n.buttonBackgroundColor:"undefined"!=typeof buttonBackgroundColor?buttonBackgroundColor:void 0,"buttonLink"in n?n.buttonLink:"undefined"!=typeof buttonLink?buttonLink:void 0,"buttonText"in n?n.buttonText:"undefined"!=typeof buttonText?buttonText:void 0,"buttonTextColor"in n?n.buttonTextColor:"undefined"!=typeof buttonTextColor?buttonTextColor:void 0,"closeButtonPosition"in n?n.closeButtonPosition:"undefined"!=typeof closeButtonPosition?closeButtonPosition:void 0,"customWidth"in n?n.customWidth:"undefined"!=typeof customWidth?customWidth:void 0,"image"in n?n.image:"undefined"!=typeof image?image:void 0,"layout"in n?n.layout:"undefined"!=typeof layout?layout:void 0,"modalContent"in n?n.modalContent:"undefined"!=typeof modalContent?modalContent:void 0,"overlayOpacity"in n?n.overlayOpacity:"undefined"!=typeof overlayOpacity?overlayOpacity:void 0,"title"in n?n.title:"undefined"!=typeof title?title:void 0,"type"in n?n.type:"undefined"!=typeof type?type:void 0,"width"in n?n.width:"undefined"!=typeof width?width:void 0)}catch(t){d.rethrow(t,void 0,void 0,i[void 0])}return e},s=DATA,m=s.type,y=s.animation,b=s.backgroundColor,u=s.overlayOpacity,c=s.backgroundImage,p=s.borderRadius,_=s.borderRadiusImage,f=s.borderWidth,g=s.borderColor,h=s.button,v=s.buttonBackgroundColor,x=s.buttonLink,w=s.buttonText,k=s.buttonTextColor,T=s.backgroundCloseButtonColor,C=s.closeButtonColor,I=s.closeButtonPosition,O=s.content,B=s.customWidth,E=s.title,S=s.layout,L=s.videoLink,W=s.recurrence,A=s.triggerEvent,Y=s.triggerEventDelay,D=s.clickEventSelector,z=s.widthImageWithText,R=s.widthImageOnly,q=s.autoPlay,M="imageOnly"===S?R:z,N=DATA.image||"https://gitlab.com/abtasty/public/storage/raw/master/image-placeholder.png",P=void 0,H=document.createElement("abtasty-modal"),U="AB Tasty Modal "+m+" "+TEST_ID,j=void 0!==window.ABTastyEditor,F=!!sessionStorage.getItem("ABTastyPreview"),J="abtasty-modal__underlay",G=".abtasty-modal__close",$=Date.now(),K=void 0,Q=PLUGIN_ID,V=void 0;!function(t){"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}(function(){var t=window.top.ABTastyWidgetForm||!1;if(j&&t)r();else if("click"===A)!function(t,a,o){document.body.addEventListener("click",function(i){var n=i.target;if(!o||!e(n,o))for(;n;){if(n!==document&&e(n,t)){a();break}n=n.parentNode}})}(D,r,J+", "+G);else switch(A){case"pageLoad":r();break;case"exitIntent":!function(t){var a=DATA.exitEventDelay,e=parseFloat(a)||0,o=void 0,i=0;document.addEventListener("mousemove",function(t){i=t.clientY}),document.body.addEventListener("mouseleave",function a(n){n.clientY<=50&&(i=0,clearInterval(o),o=setTimeout(function(){0===i&&(t(),document.body.removeEventListener("mouseleave",a))},1e3*e))},!1)}(r);break;case"reengage":!function(t){var a=DATA.reengageEventDelay,e=["mousemove","keydown","scroll"],o=void 0;e.forEach(function(i){document.addEventListener(i,function i(){clearTimeout(o),o=setTimeout(function(){t(),e.forEach(function(t){return document.removeEventListener(t,i)})},1e3*a)},!1)})}(r);break;case"timer":clearTimeout(P),P=setTimeout(r,1e3*Y)}})}();
!function(){"use strict";function t(){V&&(document.querySelector("body").style.overflowY=V),H.style.display="none","video"===m&&(H.innerHTML=""),void 0!==Q&&ABTastyEvent(Q+" "+m+" modal closed",null,TEST_ID)}function a(){return H.querySelector(J)&&H.querySelector(G)?(H.querySelector(J).addEventListener("click",t),H.querySelector(G).addEventListener("click",t),0):setTimeout(a,50)}function e(t,a){return t.matches?t.matches(a):t.msMatchesSelector(a)}function o(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a={layout:S,type:m,borderRadius:p,borderRadiusImage:_,borderWidth:f,borderColor:g,button:h,buttonBackgroundColor:v,buttonLink:x,buttonText:w,buttonTextColor:k,backgroundColor:"imageOnly"!==S?b:"initial",overlayOpacity:u,backgroundImage:c,image:N,width:M,videoLink:L,customWidth:B,animation:y,title:E,closeButtonPosition:I,backgroundCloseButtonColor:T,modalContent:O||t.outerHTML};if(H.className="abtasty-modal abtasty-modal--"+m,H.dataset.testId=TEST_ID,H.innerHTML=l(a),document.body.appendChild(H),K=H.querySelector(".abtasty-modal__area"),C){H.querySelector(G+" .close-x").style.stroke=C}}function i(){var t=(window.innerWidth>630?.5*window.innerWidth:window.innerWidth-40)/16*9;return Math.round(t)}function n(){var t="abtasty-widget-video-"+Date.now(),a=document.createElement("iframe");a.setAttribute("id",t);var e=function(t){var a=t.indexOf("youtu")>-1,e=t.indexOf("vimeo")>-1,o=void 0;a?(o="//www.youtube.com/embed/"+t.match(/^.*(youtu.be\/|v\/|e\/|u\/\w+\/|embed\/|v=)([^#&?]*).*/)[2]+"?rel=0",q&&(o+="&autoplay=1")):e&&(o="//player.vimeo.com/video/"+t.match(/.*(www\.)?vimeo.com\/(\d+)($|\/)/)[2]);return o}(L),n=i();a.style.height=n+"px","no-title"===S&&(a.style.border=f+"px solid "+g+"!important",a.style.borderRadius=p+"px!important"),a.src=e,a.frameBorder=0,a.allowfullscreen=!0,o(a),K.style.height=n+"px",window.addEventListener("resize",function(){var t=document.querySelector("abtasty-modal iframe"),a=i();t.style.height=a+"px",K.style.height=a+"px"})}function r(){if(function(){var t=Number(W),a=localStorage.getItem(U);return!(a&&-1!==t&&!j&&!F)||(0===t?!sessionStorage.getItem(U):a<$-24*t*60*60*1e3)}()){if("video"===m)n(),a();else if("image"===m&&"fit"===M){var t=new Image;t.src=N,t.className="abtasty-modal__media",t.onload=function(){o(this),K.style.width=this.width+"px",K.style.height=this.height+"px",a()}}else o(),a();H.style.display="block",function(){var t=document.querySelector("body");V=window.getComputedStyle(t).overflowY,t.style.overflowY="hidden"}(),void 0!==Q&&ABTastyEvent(Q+" "+m+" modal displayed",null,TEST_ID),j||(localStorage.setItem(U,$),sessionStorage.setItem(U,$))}}!function(t,a){if("undefined"==typeof document)return a;t=t||"";var e=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",e.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}("abtasty-modal{display:none;position:fixed;top:0;left:0;width:100%;height:100%;z-index:2147483145}abtasty-modal:not(.abtasty-modal--video){overflow-y:auto}abtasty-modal__underlay{width:100%;height:100%;position:fixed;top:0;left:0;background-color:rgba(0,0,0,.5);cursor:pointer}.abtasty-modal__area{top:0;left:0;right:0;width:auto;margin:10px!important;z-index:100;position:relative;float:none}.abtasty-modal__area-layout--imageOnly{max-width:80%}.abtasty-modal__area-layout--imageOnly img{border-style:solid;-webkit-box-sizing:border-box;box-sizing:border-box;max-width:100%;opacity:1}.abtasty-modal__area-type--video.abtasty-modal__area-layout--no-title .abtasty-modal__content{padding:5px;border-radius:0!important;border-width:0!important;background-color:transparent!important;background-image:none!important}.abtasty-modal__area-type--video.abtasty-modal__area-layout--bottom .abtasty-modal__content{padding:25px 20px 20px}.abtasty-modal .abtasty-modal__content{border-color:#f6f6f6;border-style:solid;padding:20px}.abtasty-modal__area-type--image,.abtasty-modal__area-type--no-title,.abtasty-modal__area-type--simple,.abtasty-modal__area-type--video{margin:0 auto 20px!important;top:10vh;border:none;background:none}.abtasty-modal__area-type--video.abtasty-modal__area-layout--bottom .abtasty-modal__close--inside{top:2px}.abtasty-modal__area-type--video.abtasty-modal__area-layout--top .abtasty-modal__close--inside{right:15px;top:20px}.abtasty-modal__area-type--image .abtasty-modal__close,.abtasty-modal__area-type--simple .abtasty-modal__close{right:10px;top:15px}.abtasty-modal__close{position:absolute;right:5px;top:0;font-size:20px;font-weight:300;background:transparent;border:0;color:#222;font-family:Helvetica Neue,Helvetica,Arial,sans-serif!important;line-height:24px!important;margin-right:5px;cursor:pointer;width:20px;height:20px;padding:0;-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-modal__close svg{display:block}.abtasty-modal__close svg .close-x{stroke:#5c5c5c;fill:transparent;stroke-linecap:round;stroke-width:3}.abtasty-modal__area-type--video.abtasty-modal__area-layout--no-title .abtasty-modal__close--inside{top:-6px;right:-15px;background:#fff;border-radius:20px;width:20px;height:20px}.abtasty-modal__area-type--image .abtasty-modal__close--outside,.abtasty-modal__area-type--simple .abtasty-modal__close--outside,.abtasty-modal__close--outside,.abtasty-modal__close .abtasty-modal__close--outside{top:-25px;right:-25px;width:20px;height:20px}.abtasty-modal__close--outside{background:#fff;border-radius:20px}.abtasty-modal__media,.abtasty-modal__media-link{max-width:100%;display:block}.abtasty-modal__text{padding:20px;font-family:Open Sans,sans-serif!important;color:#000;overflow:auto}.abtasty-modal__title{width:auto;font-size:20px!important;font-weight:500;line-height:1.1;margin-bottom:10px}.abtasty-modal__text p{margin:0 0 10px!important;font-size:15px;font-weight:300;word-wrap:break-word}.abtasty-modal__button{width:100%;text-align:center;margin-top:20px}.abtasty-modal__button a{padding:10px 20px;border-radius:10px;display:inline-block;font-weight:700}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--center .abtasty-modal__title{text-align:center}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--center .abtasty-modal__innertext{text-align:center;white-space:pre-wrap}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--left .abtasty-modal__title{width:50%;float:left;text-align:center;vertical-align:middle}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--left .abtasty-modal__innertext{width:50%;float:left}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--right .abtasty-modal__title{width:50%;float:left;text-align:center;vertical-align:middle}.abtasty-modal__area-type--simple.abtasty-modal__area-layout--right .abtasty-modal__innertext{width:50%;float:left}.abtasty-modal__area-type--image .abtasty-modal__image img{max-height:400px;max-width:100%;display:inline;opacity:1}.abtasty-modal__area-type--image.abtasty-modal__area-layout--left .abtasty-modal__image{width:50%;display:inline-block;height:auto;vertical-align:middle;text-align:center}.abtasty-modal__area-type--image.abtasty-modal__area-layout--left .abtasty-modal__text{text-align:left;width:50%;display:inline-block;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-modal__area-type--image.abtasty-modal__area-layout--right .abtasty-modal__image{width:50%;display:inline-block;height:auto;vertical-align:middle;text-align:center}.abtasty-modal__area-type--image.abtasty-modal__area-layout--right .abtasty-modal__text{text-align:left;width:50%;display:inline-block;vertical-align:middle;-webkit-box-sizing:border-box;box-sizing:border-box}.abtasty-modal__area-type--image.abtasty-modal__area-layout--top .abtasty-modal__image{width:100%;text-align:center}.abtasty-modal__area-type--image.abtasty-modal__area-layout--top .abtasty-modal__text{width:100%;padding:20px 0}.abtasty-modal__area-type--image.abtasty-modal__area-layout--top .abtasty-modal__image img{max-height:300px;opacity:1}.abtasty-modal__area-type--image.abtasty-modal__area-layout--bottom .abtasty-modal__image{width:100%;text-align:center}.abtasty-modal__area-type--image.abtasty-modal__area-layout--bottom .abtasty-modal__text{width:100%;padding:20px 0}.abtasty-modal__area-type--video{text-align:center;width:100%}.abtasty-modal__area-type--video iframe{width:100%}@media (min-width:630px){abtasty-modal:not(.abtasty-modal--video) .abtasty-modal__area-width--medium{width:600px;margin:0 auto 20px!important}.abtasty-modal--video{width:50%;left:25%}}@media (min-width:330px){abtasty-modal:not(.abtasty-modal--video) .abtasty-modal__area-width--small{width:300px;margin:0 auto 20px!important}}@media (min-width:930px){abtasty-modal:not(.abtasty-modal--video) .abtasty-modal__area-width--large{width:900px;margin:0 auto 20px!important}}.abtasty-animation-fadeIn{-webkit-animation-name:abTastyfadeIn;animation-name:abTastyfadeIn}.abtasty-animation-fadeIn,.abtasty-animation-fadeOut{-webkit-animation-duration:.5s;animation-duration:.5s}.abtasty-animation-fadeOut{-webkit-animation-name:abTastyfadeOut;animation-name:abTastyfadeOut}.abtasty-animation-slideIn{-webkit-animation-name:abTastyslideInDown;animation-name:abTastyslideInDown;-webkit-animation-duration:.5s;animation-duration:.5s}.abtasty-animation-slideOut{-webkit-animation-name:abTastyslideOutUp;animation-name:abTastyslideOutUp;-webkit-animation-duration:.5s;animation-duration:.5s}@-webkit-keyframes abTastyfadeIn{0%{opacity:0}to{opacity:1}}@keyframes abTastyfadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes abTastyfadeOut{0%{opacity:1}to{opacity:0}}@keyframes abTastyfadeOut{0%{opacity:1}to{opacity:0}}@-webkit-keyframes abTastyslideInDown{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes abTastyslideInDown{0%{-webkit-transform:translateY(-100%);transform:translateY(-100%)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes abTastyslideOutUp{0%{-webkit-transform:translateY(0);transform:translateY(0)}to{-webkit-transform:translateY(-100%);transform:translateY(-100%)}}@keyframes abTastyslideOutUp{0%{-webkit-transform:translateY(0);transform:translateY(0)}to{-webkit-transform:translateY(-100%);transform:translateY(-100%)}}",void 0);var d=function(t){function a(t,e){if(1===arguments.length){for(var i=t[0],n=1;n<t.length;n++)i=a(i,t[n]);return i}for(var r in e)if("class"===r){var d=t[r]||[];t[r]=(Array.isArray(d)?d:[d]).concat(e[r]||[])}else if("style"===r){d=o(t[r]);var l=o(e[r]);t[r]=d+l}else t[r]=e[r];return t}function e(t,a){return Array.isArray(t)?function(t,a){for(var o,i="",r="",d=Array.isArray(a),l=0;l<t.length;l++)(o=e(t[l]))&&(d&&a[l]&&(o=n(o)),i=i+r+o,r=" ");return i}(t,a):t&&"object"==typeof t?function(t){var a="",e="";for(var o in t)o&&t[o]&&d.call(t,o)&&(a=a+e+o,e=" ");return a}(t):t||""}function o(t){if(!t)return"";if("object"==typeof t){var a="";for(var e in t)d.call(t,e)&&(a=a+e+":"+t[e]+";");return a}return";"!==(t+="")[t.length-1]?t+";":t}function i(t,a,e,o){return!1!==a&&null!=a&&(a||"class"!==t&&"style"!==t)?!0===a?" "+(o?t:t+'="'+t+'"'):("function"==typeof a.toJSON&&(a=a.toJSON()),"string"==typeof a||(a=JSON.stringify(a),e||-1===a.indexOf('"'))?(e&&(a=n(a))," "+t+'="'+a+'"'):" "+t+"='"+a.replace(/'/g,"&#39;")+"'"):""}function n(t){var a=""+t,e=l.exec(a);if(!e)return t;var o,i,n,r="";for(o=e.index,i=0;o<a.length;o++){switch(a.charCodeAt(o)){case 34:n="&quot;";break;case 38:n="&amp;";break;case 60:n="&lt;";break;case 62:n="&gt;";break;default:continue}i!==o&&(r+=a.substring(i,o)),i=o+1,r+=n}return i!==o?r+a.substring(i,o):r}function r(t,a,e,o){if(!(t instanceof Error))throw t;if(!("undefined"==typeof window&&a||o))throw t.message+=" on line "+e,t;try{o=o||require("fs").readFileSync(a,"utf8")}catch(a){r(t,null,e)}var i=3,n=o.split("\n"),d=Math.max(e-i,0),l=Math.min(n.length,e+i);i=n.slice(d,l).map(function(t,a){var o=a+d+1;return(o==e?" > ":" ")+o+"| "+t}).join("\n");throw t.path=a,t.message=(a||"Pug")+":"+e+"\n"+i+"\n\n"+t.message,t}var d=Object.prototype.hasOwnProperty;t.merge=a,t.classes=e,t.style=o,t.attr=i,t.attrs=function(t,a){var n="";for(var r in t)if(d.call(t,r)){var l=t[r];if("class"===r){n=i(r,l=e(l),!1,a)+n;continue}"style"===r&&(l=o(l)),n+=i(r,l,!1,a)}return n};var l=/["&<>]/;return t.escape=n,t.rethrow=r,t}({}),l=function(t){var a,e="",o={};try{var i={},n=t||{};(function(t,i,n,r,l,s,m,y,b,u,c,p,_,f,g,h,v,x,w,k,T,C){o.button=a=function(){this&&this.block,this&&this.attributes;e=(e=(e+='<div class="abtasty-modal__button">')+"<a"+(d.attr("href",c,!0,!0)+d.attr("style",d.style({"background-color":u+"!important",color:_+"!important"}),!0,!0))+">")+d.escape(null==(a=p)?"":a)+"</a></div>"},o.title=a=function(){this&&this.block,this&&this.attributes;e=(e+='<h2 class="abtasty-modal__title" style="text-align:center;">')+(null==(a=k)?"":a)+"</h2>"},o.imageOnly=a=function(){this&&this.block,this&&this.attributes;e=e+"<img"+(d.attr("src",h,!0,!0)+d.attr("style",d.style({"border-radius":s+"px!important","border-width":y+"px!important","border-color":l+"!important"}),!0,!0))+">"},o.imageWithText=a=function(){this&&this.block,this&&this.attributes;e+='<div class="abtasty-modal__image">',h&&(e=e+"<img"+(d.attr("src",h,!0,!0)+d.attr("style",d.style({"border-radius":m+"px!important"}),!0,!0))+">"),e+="</div>"},o.content=a=function(){this&&this.block,this&&this.attributes;e+='<div class="abtasty-modal__innertext">',e=(e+="<p>")+(null==(a=x)?"":a)+"</p></div>"},o.closeButton=a=function(){this&&this.block,this&&this.attributes;e=e+"<div"+d.attr("class",d.classes(["abtasty-modal__close",f?"abtasty-modal__close--"+f:""],[!1,!0]),!1,!0)+" data-abtasty-actionnable"+d.attr("style",d.style("outside"===f?{"background-color":i}:""),!0,!0)+">",e+='<svg viewbox="0 0 40 40">',e+='<path class="close-x" d="M 10,10 L 30,30 M 30,10 L 10,30"></path></svg></div>'},o.contentWrapper=a=function(){var t=this&&this.block;this&&this.attributes;e=e+'<div class="abtasty-modal__content"'+d.attr("style",d.style({"border-radius":s+"px!important","border-width":y+"px!important","border-color":l+"!important","background-color":n+"!important","background-image":'url("'+r+'")!important'}),!0,!0)+">",t&&t&&t(),e+="</div>"},o.modalWrapper=a=function(){var a=this&&this.block;this&&this.attributes;e=(e=e+"<abtasty-modal__underlay"+d.attr("style",d.style({"background-color":"rgba(0, 0, 0, "+w/100+")"}),!0,!0)+"></abtasty-modal__underlay>")+"<div"+(d.attr("class",d.classes(["abtasty-animation-"+t+" abtasty-modal__area abtasty-modal__area-width--"+C+" abtasty-modal__area-type--"+T+" abtasty-modal__area-layout--"+v],[!0]),!1,!0)+d.attr("style",d.style({width:"custom"===C&&g+"%","margin-left":"custom"===C&&(100-g)/2+"% !important"}),!0,!0))+">",a&&a&&a(),e+="</div>"},o.modalWrapper.call({block:function(){o.closeButton(),"image"===T&&"imageOnly"===v?(o.imageOnly(),b&&o.button()):o.contentWrapper.call({block:function(){"simple"===T?(e+='<div class="abtasty-modal__text">',"center"===v||"left"===v?(o.title(),o.content(),e+='<div style="clear:both;"></div>'):(o.content(),o.title(),e+='<div style="clear:both;"></div>'),e+="</div>",b&&o.button()):"image"===T?("top"!==v&&"left"!==v||o.imageWithText(),e+='<div class="abtasty-modal__text">',o.title(),o.content(),b&&o.button(),e+="</div>","right"!==v&&"bottom"!==v||o.imageWithText(),e+='<div style="clear:both;"></div>'):"video"===T&&("top"===v&&o.title(),e+=null==(a=x)?"":a,"bottom"===v&&o.title(),b&&o.button())}})}})}).call(this,"animation"in n?n.animation:"undefined"!=typeof animation?animation:void 0,"backgroundCloseButtonColor"in n?n.backgroundCloseButtonColor:"undefined"!=typeof backgroundCloseButtonColor?backgroundCloseButtonColor:void 0,"backgroundColor"in n?n.backgroundColor:"undefined"!=typeof backgroundColor?backgroundColor:void 0,"backgroundImage"in n?n.backgroundImage:"undefined"!=typeof backgroundImage?backgroundImage:void 0,"borderColor"in n?n.borderColor:"undefined"!=typeof borderColor?borderColor:void 0,"borderRadius"in n?n.borderRadius:"undefined"!=typeof borderRadius?borderRadius:void 0,"borderRadiusImage"in n?n.borderRadiusImage:"undefined"!=typeof borderRadiusImage?borderRadiusImage:void 0,"borderWidth"in n?n.borderWidth:"undefined"!=typeof borderWidth?borderWidth:void 0,"button"in n?n.button:"undefined"!=typeof button?button:void 0,"buttonBackgroundColor"in n?n.buttonBackgroundColor:"undefined"!=typeof buttonBackgroundColor?buttonBackgroundColor:void 0,"buttonLink"in n?n.buttonLink:"undefined"!=typeof buttonLink?buttonLink:void 0,"buttonText"in n?n.buttonText:"undefined"!=typeof buttonText?buttonText:void 0,"buttonTextColor"in n?n.buttonTextColor:"undefined"!=typeof buttonTextColor?buttonTextColor:void 0,"closeButtonPosition"in n?n.closeButtonPosition:"undefined"!=typeof closeButtonPosition?closeButtonPosition:void 0,"customWidth"in n?n.customWidth:"undefined"!=typeof customWidth?customWidth:void 0,"image"in n?n.image:"undefined"!=typeof image?image:void 0,"layout"in n?n.layout:"undefined"!=typeof layout?layout:void 0,"modalContent"in n?n.modalContent:"undefined"!=typeof modalContent?modalContent:void 0,"overlayOpacity"in n?n.overlayOpacity:"undefined"!=typeof overlayOpacity?overlayOpacity:void 0,"title"in n?n.title:"undefined"!=typeof title?title:void 0,"type"in n?n.type:"undefined"!=typeof type?type:void 0,"width"in n?n.width:"undefined"!=typeof width?width:void 0)}catch(t){d.rethrow(t,void 0,void 0,i[void 0])}return e},s=DATA,m=s.type,y=s.animation,b=s.backgroundColor,u=s.overlayOpacity,c=s.backgroundImage,p=s.borderRadius,_=s.borderRadiusImage,f=s.borderWidth,g=s.borderColor,h=s.button,v=s.buttonBackgroundColor,x=s.buttonLink,w=s.buttonText,k=s.buttonTextColor,T=s.backgroundCloseButtonColor,C=s.closeButtonColor,I=s.closeButtonPosition,O=s.content,B=s.customWidth,E=s.title,S=s.layout,L=s.videoLink,W=s.recurrence,A=s.triggerEvent,Y=s.triggerEventDelay,D=s.clickEventSelector,z=s.widthImageWithText,R=s.widthImageOnly,q=s.autoPlay,M="imageOnly"===S?R:z,N=DATA.image||"https://widgets-images.abtasty.com/image-placeholder.png",P=void 0,H=document.createElement("abtasty-modal"),U="AB Tasty Modal "+m+" "+TEST_ID,j=void 0!==window.ABTastyEditor,F=!!sessionStorage.getItem("ABTastyPreview"),J="abtasty-modal__underlay",G=".abtasty-modal__close",$=Date.now(),K=void 0,Q=PLUGIN_ID,V=void 0;!function(t){"loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t)}(function(){var t=window.top.ABTastyWidgetForm||!1;if(j&&t)r();else if("click"===A)!function(t,a,o){document.body.addEventListener("click",function(i){var n=i.target;if(!o||!e(n,o))for(;n;){if(n!==document&&e(n,t)){a();break}n=n.parentNode}})}(D,r,J+", "+G);else switch(A){case"pageLoad":r();break;case"exitIntent":!function(t){var a=DATA.exitEventDelay,e=parseFloat(a)||0,o=void 0,i=0;document.addEventListener("mousemove",function(t){i=t.clientY}),document.body.addEventListener("mouseleave",function a(n){n.clientY<=50&&(i=0,clearInterval(o),o=setTimeout(function(){0===i&&(t(),document.body.removeEventListener("mouseleave",a))},1e3*e))},!1)}(r);break;case"reengage":!function(t){var a=DATA.reengageEventDelay,e=["mousemove","keydown","scroll"],o=void 0;e.forEach(function(i){document.addEventListener(i,function i(){clearTimeout(o),o=setTimeout(function(){t(),e.forEach(function(t){return document.removeEventListener(t,i)})},1e3*a)},!1)})}(r);break;case"timer":clearTimeout(P),P=setTimeout(r,1e3*Y)}})}();
{
"name": "@abtasty/modal",
"description": "Widget for AB Tasty",
"version": "2.5.14",
"version": "2.5.15-0",
"icon": "icon.png",

@@ -6,0 +6,0 @@ "form": "dist/form.js",

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