Update fontScript/index.js
This commit is contained in:
parent
acd33ee096
commit
39954c0579
|
@ -1,9 +1,20 @@
|
|||
(async () => {
|
||||
const website = window.location.origin; // Get the current website's base URL (or switch to "https://website.tld/")
|
||||
const pathToCss = "path/to/css"; // Replace with the relative path to the CSS file
|
||||
const cssUrl = `${website}/${pathToCss}`; // Combine base URL and CSS path
|
||||
// Use window.location.origin or fallback to "https://website.tld"
|
||||
const website = window.location.origin || "https://website.tld";
|
||||
|
||||
try {
|
||||
// Find the first <link> tag with an href ending in ".css"
|
||||
const linkElement = Array.from(document.querySelectorAll('link'))
|
||||
.find(link => link.href.endsWith('.css')); // Adjust condition if needed
|
||||
|
||||
if (!linkElement) {
|
||||
console.log("No CSS file found on the page.");
|
||||
return;
|
||||
}
|
||||
|
||||
const cssUrl = linkElement.href; // Get the full URL of the CSS file
|
||||
console.log(`Fetching CSS from: ${cssUrl}`);
|
||||
|
||||
// Fetch the CSS file
|
||||
const response = await fetch(cssUrl);
|
||||
const cssText = await response.text();
|
||||
|
|
Loading…
Reference in a new issue