teams-web-send
Version:
Post messages to Microsoft Teams directly from the browser!
3 lines (2 loc) • 1.04 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.bootstrap=function(e){var t,n,r,a,o=e||document.body,s=(n=(t=window.navigator.userAgent).indexOf("MSIE "),r=t.indexOf("Trident"),a=t.indexOf("Edge"),n>0||r>0||a>0),d=document.createElement("form");d.style.display="none",d.className="mstws-send-form",d.method="POST",d.enctype="text/plain",d.target="mstws-send-frame";var c=document.createElement("input");c.type="text",c.value='"}';var i,l=document.createElement("iframe");return l.tabIndex=-1,l.name="mstws-send-frame",l.addEventListener("load",(function(){i&&(i(),i=null)})),d.appendChild(c),d.appendChild(l),o.appendChild(d),function(e,t){return new Promise((function(n,r){try{d.action=e;var a=function(e){return e.substring(0,e.lastIndexOf("}")).concat(',"trash": "')}(t);s&&(a=a.replace(/'/g,"\\'").replace(/"/g,"'").replace(/\s\s+/g,""),c.value="'}"),c.name=a,d.submit()}catch(e){console.error(e),r(new Error("Incorrectly formatted message."))}i=n}))}};
//# sourceMappingURL=tws.cjs.production.min.js.map