// v0.0.6 2021-09-27 10:00:00
;(function () {
const dataEventKey = "einscricaoEvent" // data-einscricao-event
const openedClassName = "ei-widget"
const widgetId = "ei-widget"
const widgetCloseId = "ei-widget-close"
const iframeId = "ei-widget-iframe"
const BASE_URL = "https://fluxo.einscricao.app/"
let lastScrollY = 0
const html = `
`
if (document.readyState != "loading") {
DOMContentLoaded()
} else {
document.addEventListener("DOMContentLoaded", DOMContentLoaded, false)
}
document.addEventListener("click", globalClickHandler, false)
document.addEventListener("touchend", globalClickHandler, false)
// close with ESC Key
document.addEventListener("keyup", function (evt) {
if (evt.keyCode === 27) {
close()
}
})
log("script loaded")
function log(a, b = "") {
console.log("[ei-widget]", a, b)
}
function DOMContentLoaded() {
appendCss()
createContainer()
}
function createContainer() {
const container = document.createElement("div")
container.id = widgetId
container.innerHTML = html
document.body.appendChild(container)
log("created container", container)
}
function appendCss() {
const head = document.getElementsByTagName("head")[0]
const style = document.createElement("link")
style.type = "text/css"
style.rel = "stylesheet"
style.href = buildStyleUrl()
head.append(style)
log("appended style", style)
}
function buildUrl(
baseUrl,
event,
apiUrl,
recordScreen,
msApiUrl,
receiptUrl,
apiParticipantsUrl
) {
return `${baseUrl}/?event_id=${event}&apiUrl=${apiUrl}&msApiUrl=${msApiUrl}&LOG=${recordScreen}&receiptUrl=${receiptUrl}&apiParticipantsUrl=${apiParticipantsUrl}`
}
function buildStyleUrl() {
const script = document.querySelector('script[type="module"]')
if (!script) return log("