-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathembedded.js
More file actions
1 lines (1 loc) · 881 Bytes
/
embedded.js
File metadata and controls
1 lines (1 loc) · 881 Bytes
1
function Clicksign(u){"use strict";var n,i,c="https://app.clicksign.com",s=window.location.protocol+"//"+window.location.host,r={},l=function(t){var e="/sign/"+u,f="?embedded=true&origin="+this.origin,h=this.endpoint+e+f;return i=document.getElementById(t),n=document.createElement("iframe"),n.setAttribute("src",h),n.setAttribute("style","width: 100%; height: 100%;"),n.setAttribute("allow","camera;geolocation;fullscreen;gyroscope;accelerometer;magnetometer"),window.addEventListener("message",a),i.appendChild(n)},m=function(t){return t.name||t},d=function(t,e){return r[t]||(r[t]=[]),r[t].push(e)},o=function(t){(r[m(t)]||[]).forEach(function(e){e(t.data)})},a=function(t){o(t.data)},g=function(){return n&&(i.removeChild(n),i=null,n=null,window.removeEventListener("message",a)),!0};return{endpoint:c,origin:s,mount:l,unmount:g,on:d,trigger:o}}globalThis.Clicksign=Clicksign;