Skip to content

Commit

Permalink
style: use shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
StarHeartHunt committed Aug 30, 2023
1 parent e0be800 commit 33f57e9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/entries/DisplayController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ function main(config: DisplayConfig) {
removeDOM(selector);
});

let viewport = document.querySelector("meta[name='viewport']");
if (!viewport) {
viewport = document.createElement("meta");
const createViewport = () => {
const viewport = document.createElement("meta");
viewport.setAttribute("name", "viewport");
document.head.appendChild(viewport);
}
return viewport;
};
const viewport =
document.querySelector("meta[name='viewport']") || createViewport();

let viewportContent = viewport.getAttribute("content");
if (!viewportContent) {
viewportContent =
"initial-scale=1.0, user-scalable=no, minimum-scale=0.25, maximum-scale=5.0, width=device-width";
}
const viewportContent =
viewport.getAttribute("content") ||
"initial-scale=1.0, user-scalable=no, minimum-scale=0.25, maximum-scale=5.0, width=device-width";

viewport.setAttribute(
"content",
Expand Down

0 comments on commit 33f57e9

Please sign in to comment.