-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathf_000010
More file actions
230 lines (224 loc) · 33.1 KB
/
f_000010
File metadata and controls
230 lines (224 loc) · 33.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
!function(t,e){"use strict";var i="addEventListener",o="getElementsByClassName",n="createElement",s="classList",d="appendChild",l="dataset",a="embed-lightbox-iframe",h="embed-lightbox-is-loaded",r="embed-lightbox-is-opened",c="embed-lightbox-is-showing",m=function(t,i,n){var s=n||{};this.trigger=t,this.elemRef=i,this.rate=s.rate||500,this.el=e[o](a)[0]||"",this.body=this.el?this.el[o]("embed-lightbox-body")[0]:"",this.content=this.el?this.el[o]("embed-lightbox-content")[0]:"",this.href=t[l].src||"",this.paddingBottom=t[l].paddingBottom||"",this.onOpened=s.onOpened,this.onIframeLoaded=s.onIframeLoaded,this.onLoaded=s.onLoaded,this.onCreated=s.onCreated,this.init()};m.prototype.init=function(){var t=this;this.el||this.create();var e,o,n,s,d,l,a=(e=function(e){e.preventDefault(),t.open()},o=this.rate,function(){d=this,s=[].slice.call(arguments,0),l=new Date;var t=function(){var i=new Date-l;i<o?n=setTimeout(t,o-i):(n=null,e.apply(d,s))};n||(n=setTimeout(t,o))});this.trigger[i]("click",a)},m.prototype.create=function(){var t=this,o=e[n]("div");this.el=e[n]("div"),this.content=e[n]("div"),this.body=e[n]("div"),this.el[s].add(a),o[s].add("embed-lightbox-backdrop"),this.content[s].add("embed-lightbox-content"),this.body[s].add("embed-lightbox-body"),this.el[d](o),this.content[d](this.body),this.contentHolder=e[n]("div"),this.contentHolder[s].add("embed-lightbox-content-holder"),this.contentHolder[d](this.content),this.el[d](this.contentHolder),e.body[d](this.el),o[i]("click",function(){t.close()});var l=function(){t.isOpen()||(t.el[s].remove(c),t.body.innerHTML="")};this.el[i]("transitionend",l,!1),this.el[i]("webkitTransitionEnd",l,!1),this.el[i]("mozTransitionEnd",l,!1),this.el[i]("msTransitionEnd",l,!1),this.callCallback(this.onCreated,this)},m.prototype.loadIframe=function(){var t,i,o=this;this.iframeId=a+"-"+this.elemRef,this.body.innerHTML='<iframe src="'+this.href+'" name="'+this.iframeId+'" id="'+this.iframeId+'" onload="this.style.opacity=1;" style="opacity:0;border:none;" scrolling="no" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen="true" height="166" frameborder="no"></iframe>',t=this.iframeId,i=this.body,e.getElementById(t).onload=function(){this.style.opacity=1,i[s].add(h),o.callCallback(o.onIframeLoaded,o),o.callCallback(o.onLoaded,o)}},m.prototype.open=function(){this.loadIframe(),this.paddingBottom?this.content.style.paddingBottom=this.paddingBottom:this.content.removeAttribute("style"),this.el[s].add(c),this.el[s].add(r),this.callCallback(this.onOpened,this)},m.prototype.close=function(){this.el[s].remove(r),this.body[s].remove(h)},m.prototype.isOpen=function(){return this.el[s].contains(r)},m.prototype.callCallback=function(t,e){"function"==typeof t&&t.bind(this)(e)},t.EmbedSocialIframeLightbox=m}("undefined"!=typeof window?window:this,document);
(function(root,factory){if(typeof define==='function'&&define.amd){define([],factory(root))}else if(typeof exports==='object'){module.exports=factory(root)}else{root.embedsocialPopup=factory(root)}})(typeof global!=='undefined'?global:window||this.window||this.global,function(root){'use strict';var $embedsocialPopup={},PLUGIN_NAME='embedsocialPopup',BODY=document.querySelector('body'),ISMOBILE=(/Mobi/.test(navigator.userAgent))?!0:!1,ISCHROME=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),ISFIREFOX=typeof InstallTrigger!=='undefined',ACCEPTSTOUCH='ontouchstart' in document.documentElement,POSITIONS=['bottomRight','bottomLeft','bottomCenter','topRight','topLeft','topCenter','center'],THEMES={info:{color:'blue',icon:'ico-info'},success:{color:'green',icon:'ico-success'},warning:{color:'orange',icon:'ico-warning'},error:{color:'red',icon:'ico-error'},question:{color:'yellow',icon:'ico-question'}},MOBILEWIDTH=568,CONFIG={};var defaults={id:null,class:'',title:'',titleColor:'',titleSize:'',titleLineHeight:'',message:'',messageColor:'',messageSize:'',messageLineHeight:'',backgroundColor:'',theme:'light',color:'',icon:'',iconText:'',iconColor:'',image:'',imageWidth:50,maxWidth:null,zindex:null,layout:1,balloon:!1,close:!0,closeOnEscape:!1,closeOnClick:!1,rtl:!1,position:'bottomRight',target:'',targetFirst:!0,toastOnce:!1,timeout:5000,animateInside:!0,drag:!0,pauseOnHover:!0,resetOnHover:!1,progressBar:!0,progressBarColor:'',progressBarEasing:'linear',overlay:!1,overlayClose:!1,overlayColor:'rgba(0, 0, 0, 0.6)',transitionIn:'fadeInUp',transitionOut:'fadeOut',transitionInMobile:'fadeInUp',transitionOutMobile:'fadeOutDown',buttons:{},inputs:{},TIME:{},onOpening:function(){},onOpened:function(){},onClosing:function(){},onClosed:function(){}};if(!('remove' in Element.prototype)){Element.prototype.remove=function(){if(this.parentNode){this.parentNode.removeChild(this)}}}
if(typeof window.CustomEvent!=='function'){var CustomEventPolyfill=function(event,params){params=params||{bubbles:!1,cancelable:!1,detail:undefined};var evt=document.createEvent('CustomEvent');evt.initCustomEvent(event,params.bubbles,params.cancelable,params.detail);return evt};CustomEventPolyfill.prototype=window.Event.prototype;window.CustomEvent=CustomEventPolyfill}
var forEach=function(collection,callback,scope){if(Object.prototype.toString.call(collection)==='[object Object]'){for(var prop in collection){if(Object.prototype.hasOwnProperty.call(collection,prop)){callback.call(scope,collection[prop],prop,collection)}}}else{if(collection){for(var i=0,len=collection.length;i<len;i++){callback.call(scope,collection[i],i,collection)}}}};var extend=function(defaults,options){var extended={};forEach(defaults,function(value,prop){extended[prop]=defaults[prop]});forEach(options,function(value,prop){extended[prop]=options[prop]});return extended};var createFragElem=function(htmlStr){var frag=document.createDocumentFragment(),temp=document.createElement('div');temp.innerHTML=htmlStr;while(temp.firstChild){frag.appendChild(temp.firstChild)}
return frag};var isColor=function(color){if(color.substring(0,1)=='#'||color.substring(0,3)=='rgb'||color.substring(0,3)=='hsl'){return!0}else{return!1}};var isBase64=function(str){try{return btoa(atob(str))==str}catch(err){return!1}};var drag=function(){return{move:function(toast,instance,settings,xpos){var opacity,opacityRange=0.3,distance=180;if(xpos!==0){toast.classList.add(PLUGIN_NAME+'-dragged');toast.style.transform='translateX('+xpos+'px)';if(xpos>0){opacity=(distance-xpos)/distance;if(opacity<opacityRange){instance.hide(extend(settings,{transitionOut:'fadeOutRight',transitionOutMobile:'fadeOutRight'}),toast,'drag')}}else{opacity=(distance+xpos)/distance;if(opacity<opacityRange){instance.hide(extend(settings,{transitionOut:'fadeOutLeft',transitionOutMobile:'fadeOutLeft'}),toast,'drag')}}
toast.style.opacity=opacity;if(opacity<opacityRange){if(ISCHROME||ISFIREFOX)
toast.style.left=xpos+'px';toast.parentNode.style.opacity=opacityRange;this.stopMoving(toast,null)}}},startMoving:function(toast,instance,settings,e){e=e||window.event;var posX=((ACCEPTSTOUCH)?e.touches[0].clientX:e.clientX),toastLeft=toast.style.transform.replace('px)','');toastLeft=toastLeft.replace('translateX(','');var offsetX=posX-toastLeft;toast.classList.remove(settings.transitionIn);toast.classList.remove(settings.transitionInMobile);toast.style.transition='';if(ACCEPTSTOUCH){document.ontouchmove=function(e){e.preventDefault();e=e||window.event;var posX=e.touches[0].clientX,finalX=posX-offsetX;drag.move(toast,instance,settings,finalX)}}else{document.onmousemove=function(e){e.preventDefault();e=e||window.event;var posX=e.clientX,finalX=posX-offsetX;drag.move(toast,instance,settings,finalX)}}},stopMoving:function(toast,e){if(ACCEPTSTOUCH){document.ontouchmove=function(){}}else{document.onmousemove=function(){}}
toast.style.opacity='';toast.style.transform='';if(toast.classList.contains(PLUGIN_NAME+'-dragged')){toast.classList.remove(PLUGIN_NAME+'-dragged');toast.style.transition='transform 0.4s ease, opacity 0.4s ease';setTimeout(function(){toast.style.transition=''},400)}}}}();$embedsocialPopup.destroy=function(){forEach(document.querySelectorAll('.'+PLUGIN_NAME+'-wrapper'),function(element,index){element.remove()});forEach(document.querySelectorAll('.'+PLUGIN_NAME),function(element,index){element.remove()});document.removeEventListener(PLUGIN_NAME+'-opened',{},!1);document.removeEventListener(PLUGIN_NAME+'-opening',{},!1);document.removeEventListener(PLUGIN_NAME+'-closing',{},!1);document.removeEventListener(PLUGIN_NAME+'-closed',{},!1);document.removeEventListener('keyup',{},!1);CONFIG={}};$embedsocialPopup.settings=function(options){$embedsocialPopup.destroy();CONFIG=options;defaults=extend(defaults,options||{})};forEach(THEMES,function(theme,name){$embedsocialPopup[name]=function(options){var settings=extend(CONFIG,options||{});settings=extend(theme,settings||{});this.show(settings)}});$embedsocialPopup.progress=function(options,$toast,callback){var that=this,settings=extend(defaults,options||{}),$elem=$toast.querySelector('.'+PLUGIN_NAME+'-progressbar div');return{start:function(){if(typeof settings.TIME.REMAINING=='undefined'){$toast.classList.remove(PLUGIN_NAME+'-reseted');if($elem!==null){$elem.style.transition='width '+settings.timeout+'ms '+settings.progressBarEasing;$elem.style.width='0%'}
settings.TIME.START=new Date().getTime();settings.TIME.END=settings.TIME.START+settings.timeout;settings.TIME.TIMER=setTimeout(function(){clearTimeout(settings.TIME.TIMER);if(!$toast.classList.contains(PLUGIN_NAME+'-closing')){that.hide(settings,$toast,'timeout');if(typeof callback==='function'){callback.apply(that)}}},settings.timeout)}},pause:function(){if(!$toast.classList.contains(PLUGIN_NAME+'-paused')&&!$toast.classList.contains(PLUGIN_NAME+'-reseted')){$toast.classList.add(PLUGIN_NAME+'-paused');settings.TIME.REMAINING=settings.TIME.END-new Date().getTime();clearTimeout(settings.TIME.TIMER);if($elem!==null){var computedStyle=window.getComputedStyle($elem),propertyWidth=computedStyle.getPropertyValue('width');$elem.style.transition='none';$elem.style.width=propertyWidth}
if(typeof callback==='function'){setTimeout(function(){callback.apply(that)},10)}}},resume:function(){if(typeof settings.TIME.REMAINING!=='undefined'){$toast.classList.remove(PLUGIN_NAME+'-paused');if($elem!==null){$elem.style.transition='width '+settings.TIME.REMAINING+'ms '+settings.progressBarEasing;$elem.style.width='0%'}
settings.TIME.END=new Date().getTime()+settings.TIME.REMAINING;settings.TIME.TIMER=setTimeout(function(){clearTimeout(settings.TIME.TIMER);if(!$toast.classList.contains(PLUGIN_NAME+'-closing')){that.hide(settings,$toast,'timeout');if(typeof callback==='function'){callback.apply(that)}}},settings.TIME.REMAINING)}else{this.start()}},reset:function(){clearTimeout(settings.TIME.TIMER);delete settings.TIME.REMAINING;$toast.classList.add(PLUGIN_NAME+'-reseted');$toast.classList.remove(PLUGIN_NAME+'-paused');if($elem!==null){$elem.style.transition='none';$elem.style.width='100%'}
if(typeof callback==='function'){setTimeout(function(){callback.apply(that)},10)}}}};$embedsocialPopup.hide=function(options,$toast,closedBy){var settings=extend(defaults,options||{});closedBy=closedBy||null;if(typeof $toast!='object'){$toast=document.querySelector($toast)}
delete settings.TIME.REMAINING;$toast.classList.add(PLUGIN_NAME+'-closing');settings.closedBy=closedBy;settings.REF=$toast.getAttribute('data-embedsocialPopup-ref');(function(){var $overlay=document.querySelector('.'+PLUGIN_NAME+'-overlay');if($overlay!==null){var refs=$overlay.getAttribute('data-embedsocialPopup-ref');refs=refs.split(',');var index=refs.indexOf(settings.REF);if(index!==-1){refs.splice(index,1)}
$overlay.setAttribute('data-embedsocialPopup-ref',refs.join());if(refs.length===0){$overlay.classList.remove('fadeIn');$overlay.classList.add('fadeOut');setTimeout(function(){$overlay.remove()},700)}}})();if(settings.transitionIn||settings.transitionInMobile){$toast.classList.remove(settings.transitionIn);$toast.classList.remove(settings.transitionInMobile)}
if(ISMOBILE||window.innerWidth<=MOBILEWIDTH){if(settings.transitionOutMobile)
$toast.classList.add(settings.transitionOutMobile)}else{if(settings.transitionOut)
$toast.classList.add(settings.transitionOut)}
var H=$toast.parentNode.offsetHeight;$toast.parentNode.style.height=H+'px';$toast.style.pointerEvents='none';if(!ISMOBILE||window.innerWidth>MOBILEWIDTH){$toast.parentNode.style.transitionDelay='0.2s'}
try{settings.closedBy=closedBy;var event=new CustomEvent(PLUGIN_NAME+'-closing',{detail:settings,bubbles:!0,cancelable:!0});document.dispatchEvent(event)}catch(ex){console.warn(ex)}
setTimeout(function(){$toast.parentNode.style.height='0px';$toast.parentNode.style.overflow='';setTimeout(function(){$toast.parentNode.remove();try{settings.closedBy=closedBy;var event=new CustomEvent(PLUGIN_NAME+'-closed',{detail:settings,bubbles:!0,cancelable:!0});document.dispatchEvent(event)}catch(ex){console.warn(ex)}
if(typeof settings.onClosed!=='undefined'){settings.onClosed.apply(null,[settings,$toast,closedBy])}},1000)},200);if(typeof settings.onClosing!=='undefined'){settings.onClosing.apply(null,[settings,$toast,closedBy])}};$embedsocialPopup.show=function(options){var that=this;var settings=extend(CONFIG,options||{});settings=extend(defaults,settings);if(settings.toastOnce&&settings.id&&document.querySelectorAll('.'+PLUGIN_NAME+'#'+settings.id).length>0){return!1}
settings.REF=new Date().getTime()+Math.floor((Math.random()*10000000)+1);var $DOM={body:document.querySelector('body'),overlay:document.createElement('div'),toast:document.createElement('div'),toastBody:document.createElement('div'),toastTexts:document.createElement('div'),toastCapsule:document.createElement('div'),icon:document.createElement('i'),cover:document.createElement('div'),buttons:document.createElement('div'),inputs:document.createElement('div'),wrapper:null};$DOM.toast.setAttribute('data-embedsocialPopup-ref',settings.REF);$DOM.toast.appendChild($DOM.toastBody);$DOM.toastCapsule.appendChild($DOM.toast);(function(){$DOM.toast.classList.add(PLUGIN_NAME);$DOM.toast.classList.add(PLUGIN_NAME+'-opening');$DOM.toastCapsule.classList.add(PLUGIN_NAME+'-capsule');$DOM.toastBody.classList.add(PLUGIN_NAME+'-body');$DOM.toastTexts.classList.add(PLUGIN_NAME+'-texts');if(ISMOBILE||window.innerWidth<=MOBILEWIDTH){if(settings.transitionInMobile)
$DOM.toast.classList.add(settings.transitionInMobile)}else{if(settings.transitionIn)
$DOM.toast.classList.add(settings.transitionIn)}
if(settings.class){var classes=settings.class.split(' ');forEach(classes,function(value,index){$DOM.toast.classList.add(value)})}
if(settings.id){$DOM.toast.id=settings.id}
if(settings.rtl){$DOM.toast.classList.add(PLUGIN_NAME+'-rtl');$DOM.toast.setAttribute('dir','rtl')}
if(settings.layout>1){$DOM.toast.classList.add(PLUGIN_NAME+'-layout'+settings.layout)}
if(settings.balloon){$DOM.toast.classList.add(PLUGIN_NAME+'-balloon')}
if(settings.maxWidth){if(!isNaN(settings.maxWidth)){$DOM.toast.style.maxWidth=settings.maxWidth+'px'}else{$DOM.toast.style.maxWidth=settings.maxWidth}}
if(settings.theme!==''||settings.theme!=='light'){$DOM.toast.classList.add(PLUGIN_NAME+'-theme-'+settings.theme)}
if(settings.color){if(isColor(settings.color)){$DOM.toast.style.background=settings.color}else{$DOM.toast.classList.add(PLUGIN_NAME+'-color-'+settings.color)}}
if(settings.backgroundColor){$DOM.toast.style.background=settings.backgroundColor;if(settings.balloon){$DOM.toast.style.borderColor=settings.backgroundColor}}})();(function(){if(settings.image){$DOM.cover.classList.add(PLUGIN_NAME+'-cover');$DOM.cover.style.width=settings.imageWidth+'px';if(isBase64(settings.image.replace(/ /g,''))){$DOM.cover.style.backgroundImage='url(data:image/png;base64,'+settings.image.replace(/ /g,'')+')'}else{$DOM.cover.style.backgroundImage='url('+settings.image+')'}
if(settings.rtl){$DOM.toastBody.style.marginRight=(settings.imageWidth+10)+'px'}else{$DOM.toastBody.style.marginLeft=(settings.imageWidth+10)+'px'}
$DOM.toast.appendChild($DOM.cover)}})();(function(){if(settings.close){$DOM.buttonClose=document.createElement('button');$DOM.buttonClose.classList.add(PLUGIN_NAME+'-close');$DOM.buttonClose.addEventListener('click',function(e){var button=e.target;that.hide(settings,$DOM.toast,'button')});$DOM.toast.appendChild($DOM.buttonClose)}else{if(settings.rtl){$DOM.toast.style.paddingLeft='18px'}else{$DOM.toast.style.paddingRight='18px'}}})();(function(){if(settings.progressBar){$DOM.progressBar=document.createElement('div');$DOM.progressBarDiv=document.createElement('div');$DOM.progressBar.classList.add(PLUGIN_NAME+'-progressbar');$DOM.progressBarDiv.style.background=settings.progressBarColor;$DOM.progressBar.appendChild($DOM.progressBarDiv);$DOM.toast.appendChild($DOM.progressBar)}
if(settings.timeout){if(settings.pauseOnHover&&!settings.resetOnHover){$DOM.toast.addEventListener('mouseenter',function(e){that.progress(settings,$DOM.toast).pause()});$DOM.toast.addEventListener('mouseleave',function(e){that.progress(settings,$DOM.toast).resume()})}
if(settings.resetOnHover){$DOM.toast.addEventListener('mouseenter',function(e){that.progress(settings,$DOM.toast).reset()});$DOM.toast.addEventListener('mouseleave',function(e){that.progress(settings,$DOM.toast).start()})}}})();(function(){if(settings.icon){$DOM.icon.setAttribute('class',PLUGIN_NAME+'-icon '+settings.icon);if(settings.iconText){$DOM.icon.appendChild(document.createTextNode(settings.iconText))}
if(settings.rtl){$DOM.toastBody.style.paddingRight='33px'}else{$DOM.toastBody.style.paddingLeft='33px'}
if(settings.iconColor){$DOM.icon.style.color=settings.iconColor}
$DOM.toastBody.appendChild($DOM.icon)}})();(function(){if(settings.title.length>0){$DOM.strong=document.createElement('strong');$DOM.strong.classList.add(PLUGIN_NAME+'-title');$DOM.strong.appendChild(createFragElem(settings.title));$DOM.toastTexts.appendChild($DOM.strong);if(settings.titleColor){$DOM.strong.style.color=settings.titleColor}
if(settings.titleSize){if(!isNaN(settings.titleSize)){$DOM.strong.style.fontSize=settings.titleSize+'px'}else{$DOM.strong.style.fontSize=settings.titleSize}}
if(settings.titleLineHeight){if(!isNaN(settings.titleSize)){$DOM.strong.style.lineHeight=settings.titleLineHeight+'px'}else{$DOM.strong.style.lineHeight=settings.titleLineHeight}}}})();(function(){if(settings.message.length>0){$DOM.p=document.createElement('iframe');$DOM.p.classList.add('embedsocial-iframe-story-popup');$DOM.p.style.width="100%";$DOM.p.style.height="120px";$DOM.p.style.border="0";$DOM.p.setAttribute("scrolling","no");$DOM.p.setAttribute("src",settings.message);$DOM.toastTexts.appendChild($DOM.p);if(settings.messageColor){$DOM.p.style.color=settings.messageColor}
if(settings.messageSize){if(!isNaN(settings.titleSize)){$DOM.p.style.fontSize=settings.messageSize+'px'}else{$DOM.p.style.fontSize=settings.messageSize}}
if(settings.messageLineHeight){if(!isNaN(settings.titleSize)){$DOM.p.style.lineHeight=settings.messageLineHeight+'px'}else{$DOM.p.style.lineHeight=settings.messageLineHeight}}}})();if(settings.title.length>0&&settings.message.length>0){if(settings.rtl){$DOM.strong.style.marginLeft='10px'}else if(settings.layout!==2&&!settings.rtl){$DOM.strong.style.marginRight='10px'}}
$DOM.toastBody.appendChild($DOM.toastTexts);var $inputs;(function(){if(settings.inputs.length>0){$DOM.inputs.classList.add(PLUGIN_NAME+'-inputs');forEach(settings.inputs,function(value,index){$DOM.inputs.appendChild(createFragElem(value[0]));$inputs=$DOM.inputs.childNodes;$inputs[index].classList.add(PLUGIN_NAME+'-inputs-child');if(value[3]){setTimeout(function(){$inputs[index].focus()},300)}
$inputs[index].addEventListener(value[1],function(e){var ts=value[2];return ts(that,$DOM.toast,this,e)})});$DOM.toastBody.appendChild($DOM.inputs)}})();(function(){if(settings.buttons.length>0){$DOM.buttons.classList.add(PLUGIN_NAME+'-buttons');forEach(settings.buttons,function(value,index){$DOM.buttons.appendChild(createFragElem(value[0]));var $btns=$DOM.buttons.childNodes;$btns[index].classList.add(PLUGIN_NAME+'-buttons-child');if(value[2]){setTimeout(function(){$btns[index].focus()},300)}
$btns[index].addEventListener('click',function(e){e.preventDefault();var ts=value[1];return ts(that,$DOM.toast,this,e,$inputs)})})}
$DOM.toastBody.appendChild($DOM.buttons)})();if(settings.message.length>0&&(settings.inputs.length>0||settings.buttons.length>0)){$DOM.p.style.marginBottom='0'}
if(settings.inputs.length>0||settings.buttons.length>0){if(settings.rtl){$DOM.toastTexts.style.marginLeft='10px'}else{$DOM.toastTexts.style.marginRight='10px'}
if(settings.inputs.length>0&&settings.buttons.length>0){if(settings.rtl){$DOM.inputs.style.marginLeft='8px'}else{$DOM.inputs.style.marginRight='8px'}}}(function(){$DOM.toastCapsule.style.visibility='hidden';setTimeout(function(){var H=$DOM.toast.offsetHeight;var style=$DOM.toast.currentStyle||window.getComputedStyle($DOM.toast);var marginTop=style.marginTop;marginTop=marginTop.split('px');marginTop=parseInt(marginTop[0]);var marginBottom=style.marginBottom;marginBottom=marginBottom.split('px');marginBottom=parseInt(marginBottom[0]);$DOM.toastCapsule.style.visibility='';$DOM.toastCapsule.style.height=(H+marginBottom+marginTop)+'px';setTimeout(function(){$DOM.toastCapsule.style.height='auto';if(settings.target){$DOM.toastCapsule.style.overflow='visible'}},500);if(settings.timeout){that.progress(settings,$DOM.toast).start()}},100)})();(function(){var position=settings.position;if(settings.target){$DOM.wrapper=document.querySelector(settings.target);$DOM.wrapper.classList.add(PLUGIN_NAME+'-target');if(settings.targetFirst){$DOM.wrapper.insertBefore($DOM.toastCapsule,$DOM.wrapper.firstChild)}else{$DOM.wrapper.appendChild($DOM.toastCapsule)}}else{if(POSITIONS.indexOf(settings.position)==-1){console.warn('['+PLUGIN_NAME+'] Incorrect position.\nIt can be › '+POSITIONS);return}
if(ISMOBILE||window.innerWidth<=MOBILEWIDTH){if(settings.position=='bottomLeft'||settings.position=='bottomRight'||settings.position=='bottomCenter'){position=PLUGIN_NAME+'-wrapper-bottomCenter'}
else if(settings.position=='topLeft'||settings.position=='topRight'||settings.position=='topCenter'){position=PLUGIN_NAME+'-wrapper-topCenter'}
else{position=PLUGIN_NAME+'-wrapper-center'}}else{position=PLUGIN_NAME+'-wrapper-'+position}
$DOM.wrapper=document.querySelector('.'+PLUGIN_NAME+'-wrapper.'+position);if(!$DOM.wrapper){$DOM.wrapper=document.createElement('div');$DOM.wrapper.classList.add(PLUGIN_NAME+'-wrapper');$DOM.wrapper.classList.add(position);document.body.appendChild($DOM.wrapper)}
if(settings.position=='topLeft'||settings.position=='topCenter'||settings.position=='topRight'){$DOM.wrapper.insertBefore($DOM.toastCapsule,$DOM.wrapper.firstChild)}else{$DOM.wrapper.appendChild($DOM.toastCapsule)}}
if(!isNaN(settings.zindex)){$DOM.wrapper.style.zIndex=settings.zindex}else{console.warn('['+PLUGIN_NAME+'] Invalid zIndex.')}})();(function(){if(settings.overlay){if(document.querySelector('.'+PLUGIN_NAME+'-overlay.fadeIn')!==null){$DOM.overlay=document.querySelector('.'+PLUGIN_NAME+'-overlay');$DOM.overlay.setAttribute('data-embedsocialPopup-ref',$DOM.overlay.getAttribute('data-embedsocialPopup-ref')+','+settings.REF);if(!isNaN(settings.zindex)&&settings.zindex!==null){$DOM.overlay.style.zIndex=settings.zindex-1}}else{$DOM.overlay.classList.add(PLUGIN_NAME+'-overlay');$DOM.overlay.classList.add('fadeIn');$DOM.overlay.style.background=settings.overlayColor;$DOM.overlay.setAttribute('data-embedsocialPopup-ref',settings.REF);if(!isNaN(settings.zindex)&&settings.zindex!==null){$DOM.overlay.style.zIndex=settings.zindex-1}
document.querySelector('body').appendChild($DOM.overlay)}
if(settings.overlayClose){$DOM.overlay.removeEventListener('click',{});$DOM.overlay.addEventListener('click',function(e){that.hide(settings,$DOM.toast,'overlay')})}else{$DOM.overlay.removeEventListener('click',{})}}})();(function(){if(settings.animateInside){$DOM.toast.classList.add(PLUGIN_NAME+'-animateInside');var animationTimes=[200,100,300];if(settings.transitionIn=='bounceInLeft'||settings.transitionIn=='bounceInRight'){animationTimes=[400,200,400]}
if(settings.title.length>0){setTimeout(function(){$DOM.strong.classList.add('slideIn')},animationTimes[0])}
if(settings.message.length>0){setTimeout(function(){$DOM.p.classList.add('slideIn')},animationTimes[1])}
if(settings.icon){setTimeout(function(){$DOM.icon.classList.add('revealIn')},animationTimes[2])}
var counter=150;if(settings.buttons.length>0&&$DOM.buttons){setTimeout(function(){forEach($DOM.buttons.childNodes,function(element,index){setTimeout(function(){element.classList.add('revealIn')},counter);counter=counter+150})},settings.inputs.length>0?150:0)}
if(settings.inputs.length>0&&$DOM.inputs){counter=150;forEach($DOM.inputs.childNodes,function(element,index){setTimeout(function(){element.classList.add('revealIn')},counter);counter=counter+150})}}})();settings.onOpening.apply(null,[settings,$DOM.toast]);try{var event=new CustomEvent(PLUGIN_NAME+'-opening',{detail:settings,bubbles:!0,cancelable:!0});document.dispatchEvent(event)}catch(ex){console.warn(ex)}
setTimeout(function(){$DOM.toast.classList.remove(PLUGIN_NAME+'-opening');$DOM.toast.classList.add(PLUGIN_NAME+'-opened');try{var event=new CustomEvent(PLUGIN_NAME+'-opened',{detail:settings,bubbles:!0,cancelable:!0});document.dispatchEvent(event)}catch(ex){console.warn(ex)}
settings.onOpened.apply(null,[settings,$DOM.toast])},1000);if(settings.drag){if(ACCEPTSTOUCH){$DOM.toast.addEventListener('touchstart',function(e){drag.startMoving(this,that,settings,e)},!1);$DOM.toast.addEventListener('touchend',function(e){drag.stopMoving(this,e)},!1)}else{$DOM.toast.addEventListener('mousedown',function(e){e.preventDefault();drag.startMoving(this,that,settings,e)},!1);$DOM.toast.addEventListener('mouseup',function(e){e.preventDefault();drag.stopMoving(this,e)},!1)}}
if(settings.closeOnEscape){document.addEventListener('keyup',function(evt){evt=evt||window.event;if(evt.keyCode==27){that.hide(settings,$DOM.toast,'esc')}})}
if(settings.closeOnClick){$DOM.toast.addEventListener('click',function(evt){that.hide(settings,$DOM.toast,'toast')})}
that.toast=$DOM.toast};return $embedsocialPopup});
if (!document.getElementById("EmbedSocialIFrame")) {
var jsEmbed = document.createElement("script");
jsEmbed.id = "EmbedSocialIFrame", jsEmbed.src = "https://embedsocial.com/js/iframe.js", document.getElementsByTagName("body")[0].appendChild(jsEmbed)
}
if (!document.getElementById("EmbedSocialPopupCSS")) {
var cssEmbed = document.createElement("link");
cssEmbed.id = "EmbedSocialPopupCSS", cssEmbed.rel = "stylesheet", cssEmbed.href = "https://embedsocial.com/cdn/popup.min.css";
document.getElementsByTagName("head")[0].appendChild(cssEmbed);
}
EMBEDSOCIALREVIEWSCOLLECT = {
getEmbedData: function(sourceId, collectDiv) {
var iframes = collectDiv.getElementsByTagName('iframe');
if (iframes.length <= 0) {
var ifrm = document.createElement("iframe");
var srcIfrm = "https://embedsocial.com/collect/reviews_collect/"+ sourceId;
ifrm.setAttribute("src", srcIfrm);
ifrm.setAttribute("class", "embedsocial-collect-data embed-collect-iframe-" + sourceId);
//ifrm.setAttribute("id", 'embedCollectIFrame_' + sourceId);
ifrm.setAttribute("id", 'embedCollectIFrame_' + sourceId + Math.random().toString(36).substring(7));
ifrm.style.width = "0";
ifrm.style.height = "0";
ifrm.style.border = "0";
ifrm.setAttribute("scrolling", "no");
collectDiv.appendChild(ifrm);
EMBEDSOCIALREVIEWSCOLLECT.initResizeFrame();
}
},
initResizeFrame: function() {
if(document.getElementById("EmbedSocialIFrame") && "function" === typeof iFrameResize) {
iFrameResize ({
messageCallback : function(messageData){
if (messageData.message.action == "create_popup") {
EMBEDSOCIALREVIEWSCOLLECT.createPopupBox(messageData.message);
}
if (messageData.message.action == "create_button") {
var ifrmCollect = document.getElementsByClassName("embed-collect-iframe-" + messageData.message.sourceId);
for (i = 0; i < ifrmCollect.length; i++) {
ifrmCollect[i].style.height = messageData.message.height + "px";
ifrmCollect[i].style.width = messageData.message.width + "px";
}
}
if (messageData.message.action == "create_lightbox") {
EMBEDSOCIALREVIEWSCOLLECT.createLightBox(messageData.message);
}
},
sizeHeight: false,
sizeWidth: false
}, '.embedsocial-collect-data');
} else {
setTimeout(EMBEDSOCIALREVIEWSCOLLECT.initResizeFrame, 200);
}
},
createPopupBox: function(data) {
embedsocialPopup.destroy();
[].forEach.call(document.querySelectorAll('.embedsocialPopup-capsule'), function (el) {
el.style.visibility = 'hidden';
});
embedsocialPopup.show({
message: data.sourceSrc,
timeout: data.timeoutHide,
position: data.position,
drag: false,
onOpened: function () {
EMBEDSOCIALREVIEWSCOLLECT.initPopupIframe();
},
});
},
initPopupIframe: function() {
if(document.getElementById("EmbedSocialIFrame") && "function" === typeof iFrameResize) {
iFrameResize ({
messageCallback : function(messageData){
if (messageData.message.action == "create_lightbox") {
EMBEDSOCIALREVIEWSCOLLECT.createLightBox(messageData.message);
}
},
sizeHeight: false,
sizeWidth: false
}, '.embedsocial-iframe-story-popup');
} else {
setTimeout(EMBEDSOCIALREVIEWSCOLLECT.initPopupIframe, 200);
}
},
initResizeLightbox: function(sourceId) {
if(document.getElementById("EmbedSocialIFrame") && "function" === typeof iFrameResize) {
iFrameResize ({
messageCallback : function(messageData){
if (messageData.message.action == "close_lightbox") {
EMBEDSOCIALREVIEWSCOLLECT.closeLightBox();
}
},
sizeHeight: false,
sizeWidth: false
}, '#embed-lightbox-iframe-' + sourceId);
} else {
setTimeout(function(){EMBEDSOCIALREVIEWSCOLLECT.initResizeLightbox(sourceId)}, 200);
}
},
createLightBox: function(data) {
if (!document.getElementById("embed-lightbox-" + data.sourceId)) {
var divLightbox = document.createElement("a");
divLightbox.setAttribute("class", "embedsocial-iframe-lightbox-link");
divLightbox.setAttribute("id", "embed-lightbox-" + data.sourceId);
divLightbox.setAttribute("data-padding-bottom", "56%");
divLightbox.setAttribute("data-src", "https://embedsocial.com/collect/embed/"+ data.sourceId);
document.body.appendChild(divLightbox);
} else {
divLightbox = document.getElementById("embed-lightbox-" + data.sourceId);
divLightbox.setAttribute("data-src", "https://embedsocial.com/collect/embed/"+ data.sourceId);
divLightbox.innerHTML = '';
}
[].forEach.call(document.getElementsByClassName("embedsocial-iframe-lightbox-link"), function(el) {
el.lightbox = new EmbedSocialIframeLightbox(el, data.sourceId, {
onLoaded: function(iframe) {
EMBEDSOCIALREVIEWSCOLLECT.initResizeLightbox(data.sourceId);
function lightBoxIframeResize() {
var windowHeight = window.innerHeight || document.documentElement.clientHeight;
var el = document.getElementById('embed-lightbox-iframe-' + data.sourceId);
if (windowHeight > 1800) {
windowHeight = 1800;
}
el.style.height = parseInt(windowHeight * 0.90) + 'px';
};
lightBoxIframeResize();
window.addEventListener('resize', lightBoxIframeResize);
}
});
});
EMBEDSOCIALREVIEWSCOLLECT.openLightBox(data.sourceId);
},
openLightBox : function(sourceId) {
document.getElementById("embed-lightbox-" + sourceId).click();
document.getElementsByClassName('embed-lightbox-body')[0].addEventListener("click", function(event) {
var targetElement = event.target || event.srcElement;
if (targetElement.classList.contains('embed-lightbox-is-loaded')) {
EMBEDSOCIALREVIEWSCOLLECT.closeLightBox();
}
});
},
closeLightBox : function() {
document.getElementsByClassName("embed-lightbox-backdrop")[0].click();
}
}
var embedsocialCollectButtons = document.getElementsByClassName("embedsocial-collect");
var embedsocialCollectSourcesIds = [];
for (i = 0; i < embedsocialCollectButtons.length; i++) {
var embedsocialCollectSourceId = embedsocialCollectButtons[i].getAttribute("data-ref");
EMBEDSOCIALREVIEWSCOLLECT.getEmbedData(embedsocialCollectSourceId, embedsocialCollectButtons[i]);
}
setInterval(function() {
var embedsocialCollectButtons = document.getElementsByClassName("embedsocial-collect");
var embedsocialCollectSourcesIds = [];
for (i = 0; i < embedsocialCollectButtons.length; i++) {
var embedsocialCollectSourceId = embedsocialCollectButtons[i].getAttribute("data-ref");
EMBEDSOCIALREVIEWSCOLLECT.getEmbedData(embedsocialCollectSourceId, embedsocialCollectButtons[i]);
}
}, 1500);