Skip to content

Commit

Permalink
Fix some of the CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
raxod502 committed Dec 5, 2022
1 parent 6704403 commit 50b5aa3
Showing 1 changed file with 33 additions and 18 deletions.
51 changes: 33 additions & 18 deletions extension/content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -782,12 +782,44 @@ const showOverlay = ({ updateSyncState }) => {
// object, kind of like a simple version of React
const createContents = (state) => {
log(`Overlay: rendering with state ${JSON.stringify(state)}`);
const overlay = document.createElement("div");
overlay.style = createStyleString(
Object.assign(
{},
{
position: "fixed",
width: "200px",
height: "100px",
background: "lightgray",
right: "0",
top: "0",
"z-index": "10000",
margin: "10px",
padding: "10px",
// Some of these are defaults but we need to make sure they
// don't get overridden by some dumb global CSS on some
// company's weird streaming site.
"font-size": "10px",
"font-family": "Roboto, Arial, sans-serif",
color: "black",
"line-height": "12px",
"box-sizing": "unset",
},
state.overlayExpanded ? {} : { visibility: "hidden" }
)
);
const header = document.createElement("b");
header.innerText = "Hypercast status";
const websocketState = document.createElement("p");
websocketState.innerText = `Websocket: ${state.websocketState}`;
websocketState.style = createStyleString({
margin: "0",
});
const videoState = document.createElement("p");
videoState.innerText = `Video instrumentation: ${state.videoState}`;
videoState.style = createStyleString({
margin: "0",
});
const collapseToggle = document.createElement("button");
collapseToggle.style = createStyleString(
Object.assign(
Expand All @@ -802,6 +834,7 @@ const showOverlay = ({ updateSyncState }) => {
margin: "10px",
padding: "0",
border: "0",
"font-size": "13px",
},
state.overlayExpanded ? {} : { "background-color": "transparent" }
)
Expand Down Expand Up @@ -865,24 +898,6 @@ const showOverlay = ({ updateSyncState }) => {
skewElts.push(skewToggle, skewLabel);
}
// Put components together.
const overlay = document.createElement("div");
overlay.style = createStyleString(
Object.assign(
{},
{
position: "fixed",
width: "200px",
height: "100px",
background: "lightgray",
right: "0",
top: "0",
"z-index": "10000",
margin: "10px",
padding: "10px",
},
state.overlayExpanded ? {} : { visibility: "hidden" }
)
);
overlay.replaceChildren(
header,
websocketState,
Expand Down

0 comments on commit 50b5aa3

Please sign in to comment.