-
Notifications
You must be signed in to change notification settings - Fork 0
/
viima-feedback-widget-1.1.min.js
1 lines (1 loc) · 3.36 KB
/
viima-feedback-widget-1.1.min.js
1
function initiateViima(e,t,n,d,i,o,a,c,r){function m(){"left"===i&&-1!=document.getElementById("feedback-inner").style.left.indexOf("-")?(document.getElementById("feedback-tab").style.left=s+"px",document.getElementById("feedback-tab").style.bottom=f+"px",document.getElementById("feedback-inner").style.left="0px",document.getElementById("feedback-inner").style.bottom=f+"px",document.body.insertAdjacentHTML("beforeend",'<div id="feedback-backdrop" style="position: fixed; top: 0; bottom: 0; right: 0; left: 0; z-index: 99999; background-color: #000; opacity: 0.7;"></div>')):"right"===i&&-1!=document.getElementById("feedback-inner").style.right.indexOf("-")?(document.getElementById("feedback-tab").style.right=s+"px",document.getElementById("feedback-tab").style.bottom=f+"px",document.getElementById("feedback-inner").style.right="0px",document.getElementById("feedback-inner").style.bottom=f+"px",document.body.insertAdjacentHTML("beforeend",'<div id="feedback-backdrop" style="position: fixed; top: 0; bottom: 0; right: 0; left: 0; z-index: 99999; background-color: #000; opacity: 0.7;cursor: pointer;"></div>')):l()}function l(){"left"===i&&-1==document.getElementById("feedback-inner").style.left.indexOf("-")?(document.getElementById("feedback-tab").style.left="0px",document.getElementById("feedback-inner").style.left="-"+s+"px"):"right"===i&&-1==document.getElementById("feedback-inner").style.right.indexOf("-")&&(document.getElementById("feedback-tab").style.right="0px",document.getElementById("feedback-inner").style.right="-"+s+"px");var e=document.getElementById("feedback-backdrop");document.body.removeChild(e),document.getElementById("feedback-tab").style.bottom=y+"px"}if(e||(e="https://app.viima.com/viima/"),t||(t="https://www.viima.com/wp-content/uploads/2014/08/feedback-tab.png"),"right"!==i&&(i="left"),n||(n=.8),d||(d=.8),o||(o=.4),c||(c=600),window.innerWidth<c)return!1;var b=n*window.innerHeight,s=d*window.innerWidth,f=(1-n)/2*window.innerHeight,y=o*window.innerHeight;document.body.insertAdjacentHTML("beforeend",'<div id="feedback-tab"><img src="'+t+'" alt="Feedback"/><div id="feedback-inner"><iframe src="'+e+'"></iframe></div></div>'),a&&(document.getElementById("feedback-inner").insertAdjacentHTML("afterbegin",'<h3 id="feedback-header" style="color: #eeeeee; text-align: center; cursor: default;">'+a+"</h3>"),document.getElementById("feedback-header").addEventListener("click",function(e){return e.stopPropagation(),!1})),document.getElementById("feedback-tab").style.cssText="position: fixed; bottom: "+y+"px; "+i+": 0; cursor: pointer; -webkit-transition-duration: 0.3s; -moz-transition-duration: 0.3s; -o-transition-duration: 0.3s; transition-duration: 0.3s; z-index: 100000;",document.getElementById("feedback-inner").style.cssText="position: fixed; bottom: "+f+"px; "+i+": -"+s+"px; -webkit-transition-duration: 0.3s; -moz-transition-duration: 0.3s; -o-transition-duration: 0.3s; transition-duration: 0.3s; height: "+b+"px; width: "+s+"px; overflow: hidden; z-index: 100000;",document.getElementById("feedback-inner").getElementsByTagName("iframe")[0].style.cssText="height: 100%; width: 100%; z-index: 100001;",r&&(document.getElementById("feedback-tab").getElementsByTagName("img")[0].style.opacity=r),document.getElementById("feedback-tab").addEventListener("click",m),document.addEventListener("click",function(e){var t=document.getElementById("feedback-backdrop");e.target===t&&l()})}