Skip to content

Commit

Permalink
Refactor font loading JS
Browse files Browse the repository at this point in the history
Fixes font loading issues.
  • Loading branch information
kslambert authored Nov 2, 2022
1 parent d7379a9 commit ddae2b0
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions content.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* This runs after a web page loads */
function addStylesheetURL(url) {
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = url;
document.getElementsByTagName('head')[0].appendChild(link);
}

addStylesheetURL("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600;700&family=Press+Start+2P&display=swap");
var getHeader = document.getElementsByTagName('head').item(0);
var linkStyle = document.createElement("link");
var url = "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600;700&family=Press+Start+2P&display=swap";
linkStyle.href = url;
linkStyle.rel = 'stylesheet';
linkStyle.type = "text/css";
getHeader.appendChild(linkStyle);

0 comments on commit ddae2b0

Please sign in to comment.