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"; import "./parent-style.css";
let isIframeLoaded = false; let isIframeLoaded = false;
const parentRootHost = (document.querySelector("#chatterbox-script") as HTMLScriptElement).src; const parentHostRoot = (document.querySelector("#chatterbox-script") as HTMLScriptElement).src;
const parentRootHostURL = new URL(parentRootHost); const parentHosRootURL = new URL(parentHostRoot);
const rootHost = `${parentRootHostURL.protocol}${parentRootHostURL.host}`; const hostRoot = `${parentHosRootURL.protocol}${parentHosRootURL.host}`;
const sizeCollection = { const sizeCollection = {
"desktop": { "desktop": {
...@@ -46,8 +46,7 @@ function renderStartButton() { ...@@ -46,8 +46,7 @@ function renderStartButton() {
function loadCSS() { function loadCSS() {
const linkElement = document.createElement("link") as HTMLLinkElement; const linkElement = document.createElement("link") as HTMLLinkElement;
linkElement.rel = "stylesheet"; linkElement.rel = "stylesheet";
const urlFixed = new URL("CSS_FILE_NAME", parentRootHost); linkElement.href = new URL("CSS_FILE_NAME", parentHostRoot).href;
linkElement.href = urlFixed.href;
document.head.appendChild(linkElement); document.head.appendChild(linkElement);
} }
...@@ -57,7 +56,7 @@ function loadChatterboxIframe() { ...@@ -57,7 +56,7 @@ function loadChatterboxIframe() {
if (!configLocation) { if (!configLocation) {
throw new Error("CONFIG_LOCATION is not set"); 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"; iframe.className = "chatterbox-iframe";
document.body.appendChild(iframe); document.body.appendChild(iframe);
isIframeLoaded = true; 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