Skip to content
Snippets Groups Projects
Commit 49d29cdc authored by Midhun Suresh's avatar Midhun Suresh
Browse files

Give sane names to variables

parent 18f6f56a
No related branches found
No related tags found
No related merge requests found
import "./parent-style.css";
let isIframeLoaded = false;
const parentRootHost = (document.querySelector("#chatterbox-script") as HTMLScriptElement).src;
const parentRootHostURL = new URL(parentRootHost);
const rootHost = `${parentRootHostURL.protocol}${parentRootHostURL.host}`;
const parentHostRoot = (document.querySelector("#chatterbox-script") as HTMLScriptElement).src;
const parentHosRootURL = new URL(parentHostRoot);
const hostRoot = `${parentHosRootURL.protocol}${parentHosRootURL.host}`;
const sizeCollection = {
"desktop": {
......@@ -46,8 +46,7 @@ function renderStartButton() {
function loadCSS() {
const linkElement = document.createElement("link") as HTMLLinkElement;
linkElement.rel = "stylesheet";
const urlFixed = new URL("CSS_FILE_NAME", parentRootHost);
linkElement.href = urlFixed.href;
linkElement.href = new URL("CSS_FILE_NAME", parentHostRoot).href;
document.head.appendChild(linkElement);
}
......@@ -57,7 +56,7 @@ function loadChatterboxIframe() {
if (!configLocation) {
throw new Error("CONFIG_LOCATION is not set");
}
iframe.src = new URL("../chatterbox.html?config=" + configLocation, rootHost).href;
iframe.src = new URL("../chatterbox.html?config=" + configLocation, hostRoot).href;
iframe.className = "chatterbox-iframe";
document.body.appendChild(iframe);
isIframeLoaded = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment