(function () { this.nxtinspekt = function () { function a() { this.iK = null; this.cK = null; this.route = ''; } return a.version = 1, a.endpoint = "https://nxtinspekt.com/i", a.setInspectorKey = function (b) { a.route = 'inspector_calendar'; return a.iK = b; }, a.setCompanyKey = function (b) { a.route = 'company_calendar'; return a.cK = b; }, a.renderFrame = function (o) { var key = this.iK; if (!key) { key = this.cK; } this.validateKey(key); var p = {}; if (typeof o === 'undefined') { o = {}; } p.height = o.height || '100%'; p.width = o.width || '100%'; p.element_id = o.element_id || false; p.auto_height = o.auto_height || false; var i = document.createElement('iframe'); i.src = this.endpoint + '/' + this.route + '/' + key; if (!p.auto_height) { i.style.height = p.height; } i.style.width = p.width; i.frameBorder = 0; i.id = this.key; var l; if (p.element_id) { l = document.getElementById(p.element_id); if (p.auto_height && l) { window.addEventListener('message', function (event) { if (event.data.hasOwnProperty("FrameHeight")) { i.style.height = event.data.FrameHeight + 'px'; } }); function setIframeHeight(ifrm) { var height = ifrm.contentWindow.postMessage("FrameHeight", "*"); } i.onload = function () { var height = this.contentWindow.postMessage("FrameHeight", "*"); } window.addEventListener('resize', function () { var height = i.contentWindow.postMessage("FrameHeight", "*"); }); } } if (!l) { l = document.getElementsByTagName('body')[0]; } l.appendChild(i); //l.appendChild(copy); }, a.validateKey = function (k) { if (!k || "string" != typeof k)throw new Error("You did not set a valid key. Call nxtinspekt.setInspectorKey() with your inspector key. For more info, see https://nxtinspekt.com"); if (/\s/g.test(k))throw new Error("Your key is invalid, as it contains whitespace. For more info, see https://nxtinspekt.com"); }, a; }() } ).call(this);