Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Drashti Modasara authored and Drashti Modasara committed Dec 1, 2023
1 parent f83230c commit 1245b57
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion creativecloud/features/genfill/genfill-interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function addEnticement(container, enticement, mode) {
}

async function removePTags(media, vi) {
const heading = media.closest('.foreground').querySelector('h2');
const heading = media.closest('.foreground').querySelector('h1, h2, h3, h4, h5, h6');
const hText = heading.id
.split('-').map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join('');
const miloLibs = getLibs();
Expand Down
38 changes: 22 additions & 16 deletions creativecloud/scripts/scripts.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable no-fallthrough */
/* eslint-disable no-case-declarations */
/*
* Copyright 2023 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -130,23 +132,27 @@ const eagerLoad = (img) => {

(async function loadLCPImage() {
const firstDiv = document.querySelector('body > main > div:nth-child(1) > div');
if (firstDiv?.classList.contains('marquee')) {
firstDiv.querySelectorAll('img').forEach(eagerLoad);
} else if (firstDiv?.classList.contains('changebg')) {
firstDiv.querySelector(':scope > div:nth-child(1)').querySelectorAll('img').forEach(eagerLoad);
import(`${CONFIG.codeRoot}/deps/interactive-marquee-changebg/changeBgMarquee.js`);
} else if (firstDiv?.classList.contains('interactive-marquee')) {
firstDiv.querySelector(':scope > div:nth-child(1)').querySelectorAll('img').forEach(eagerLoad);
if (firstDiv?.classList.contains('firefly')) {
firstDiv.querySelector(':scope > div:nth-child(2)').querySelectorAll('img').forEach(async (img) => eagerLoad(img));
} else if (firstDiv?.classList.contains('genfill')) {
switch (true) {
case firstDiv?.classList.contains('changebg'):
firstDiv.querySelector(':scope > div:nth-child(1)').querySelectorAll('img').forEach(eagerLoad);
import(`${CONFIG.codeRoot}/deps/interactive-marquee-changebg/changeBgMarquee.js`);
break;
case firstDiv?.classList.contains('marquee'):
firstDiv.querySelectorAll('img').forEach(eagerLoad);
break;
case firstDiv?.classList.contains('interactive-marquee'):
firstDiv.querySelector(':scope > div:nth-child(1)').querySelectorAll('img').forEach(eagerLoad);
case firstDiv?.classList.contains('firefly'):
const lcpImg = firstDiv.querySelector(':scope > div:nth-child(2)').querySelector('img');
if (lcpImg) eagerLoad(lcpImg);
break;
case firstDiv?.classList.contains('genfill'):
const viewports = firstDiv.querySelector(':scope > div:nth-child(2)').querySelectorAll('div:not(:first-child)');
viewports.forEach((vp) => {
eagerLoad(vp.querySelector('img'));
});
}
} else {
eagerLoad(document.querySelector('img'));
viewports.forEach((vp) => eagerLoad(vp.querySelector('img')));
break;
default:
eagerLoad(document.querySelector('img'));
break;
}
}());

Expand Down

0 comments on commit 1245b57

Please sign in to comment.