Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-135751 faas loading #171

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { setLibs } from './utils.js';

const LIBS = '/libs';
const STYLES = ['/styles/styles.css', '/styles/faas.css'];
const STYLES = ['/styles/styles.css'];
const CONFIG = {
imsClientId: 'bacom',
local: {
Expand Down Expand Up @@ -147,6 +147,13 @@ const eagerLoad = (img) => {
img?.setAttribute('fetchpriority', 'high');
};

const loadStyle = (path) => {
const link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('href', path);
document.head.appendChild(link);
};

(async function loadLCPImage() {
const marquee = document.querySelector('.marquee');
if (!marquee) {
Expand Down Expand Up @@ -174,12 +181,7 @@ const miloLibs = setLibs(LIBS);
if (STYLES) {
paths.push(...(Array.isArray(STYLES) ? STYLES : [STYLES]));
}
paths.forEach((path) => {
const link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('href', path);
document.head.appendChild(link);
});
paths.forEach(loadStyle);
}());

(async function loadPage() {
Expand All @@ -201,4 +203,7 @@ const miloLibs = setLibs(LIBS);
const { default: registerAAUniversity } = await import('./aa-university.js');
window.addEventListener('mktoSubmit', registerAAUniversity);
}
if (document.querySelector('.faas')) {
loadStyle('/styles/faas.css');
}
}());
Loading