From 68f59aca89137e01a7e31467c4cebef5961d650e Mon Sep 17 00:00:00 2001 From: James Tsay Date: Thu, 31 Oct 2024 08:37:35 -0700 Subject: [PATCH 1/3] Workarond a Safari bug --- acrobat/blocks/prompt-card/prompt-card.js | 27 ++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/acrobat/blocks/prompt-card/prompt-card.js b/acrobat/blocks/prompt-card/prompt-card.js index 12aa59e5..c36dda3c 100644 --- a/acrobat/blocks/prompt-card/prompt-card.js +++ b/acrobat/blocks/prompt-card/prompt-card.js @@ -3,8 +3,8 @@ import { setLibs } from '../../scripts/utils.js'; const miloLibs = setLibs('/libs'); -const { createTag } = await import(`${miloLibs}/utils/utils.js`); -const { processTrackingLabels } = await import(`${miloLibs}/martech/attributes.js`); +let createTag; +let processTrackingLabels; const classToastShow = 'prompt-toast--show'; const getPlaceHolder = (x) => (window.mph?.[x] || x); @@ -29,7 +29,8 @@ function copyPrompt(cfg) { setTimeout(() => toast.classList.remove(classToastShow), 5000); } -async function createBlock(element, cfg) { +function createBlock(el, cfg) { + const element = el || createTag('div', { class: 'prompt-card' }); cfg.icon = cfg.icon || '/acrobat/img/icons/aichat.svg'; cfg.button = cfg.button || getPlaceHolder('Copy'); cfg.toast = cfg.toast || getPlaceHolder('Copied to clipboard'); @@ -70,14 +71,15 @@ async function createBlock(element, cfg) { copyPrompt(cfg); } }); + + return element; } -async function createBlocks(element, blockArray, templateCfg) { +function createBlocks(element, blockArray, templateCfg) { const { parentNode } = element; - for (const [i, cfg] of blockArray.entries()) { - const blockEl = createTag('div', { class: 'prompt-card' }); - if (templateCfg?.rows && i > 0) blockEl.classList.add('hidden'); - await createBlock(blockEl, { ...templateCfg, ...cfg }); + for (const [idx, cfg] of blockArray.entries()) { + const blockEl = createBlock(null, { ...templateCfg, ...cfg }); + if (templateCfg?.rows && idx > 0) blockEl.classList.add('hidden'); parentNode.insertBefore(blockEl, element.previousSibling); } element.remove(); @@ -133,7 +135,7 @@ async function processGroup(element, cfg, startIndex) { (x) => keys.reduce((a, k) => a && cfg[k] === x[k], true), ); } - await createBlocks(element, blockArray, cfg); + createBlocks(element, blockArray, cfg); } function readKeyValueSet(element) { @@ -146,6 +148,11 @@ function readKeyValueSet(element) { } export default async function init(element) { + const { createTag: createTagfn } = await import(`${miloLibs}/utils/utils.js`); + const { processTrackingLabels: processTrackingLabelsfn } = await import(`${miloLibs}/martech/attributes.js`); + createTag = createTagfn; + processTrackingLabels = processTrackingLabelsfn; + if (element.classList.contains('template') && element.classList.contains('group')) { const cfg = readKeyValueSet(element); await processGroup(element, cfg, Object.keys(cfg).length + 1); @@ -172,5 +179,5 @@ export default async function init(element) { cfg = { ...window.promptCardTemplate, ...cfg }; - await createBlock(element, cfg); + createBlock(element, cfg); } From 2fa336b945ce448c1cec160aa4968759ed4d0f46 Mon Sep 17 00:00:00 2001 From: James Tsay Date: Thu, 31 Oct 2024 15:34:55 -0700 Subject: [PATCH 2/3] Add hero-marquee --- acrobat/scripts/scripts.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/acrobat/scripts/scripts.js b/acrobat/scripts/scripts.js index 34b752cf..cede46ba 100644 --- a/acrobat/scripts/scripts.js +++ b/acrobat/scripts/scripts.js @@ -354,11 +354,12 @@ replaceDotMedia(document); // Default to loading the first image as eager. (async function loadLCPImage() { - const marquee = document.querySelector('.marquee'); // first marquee only + const blocks = '.marquee,.hero-marquee'; + const marquee = document.querySelector(blocks); // first marquee only if (marquee) { const index = window.browser.isMobile ? 1 : 3; - const selectorBG = `.marquee > div:nth-child(1) > div:nth-of-type(${index}) img`; - const selectorFG = '.marquee > div:nth-child(2) img'; + const selectorBG = `${blocks} > div:nth-child(1) > div:nth-of-type(${index}) img`; + const selectorFG = `${blocks} > div:nth-child(2) img`; marquee.querySelector(selectorBG)?.setAttribute('loading', 'eager'); marquee.querySelector(selectorFG)?.setAttribute('loading', 'eager'); } From 9db54f9474c90ded90721e5fc4e43dbee9b15fa1 Mon Sep 17 00:00:00 2001 From: Joaquin Rivero Date: Fri, 1 Nov 2024 13:14:19 +0800 Subject: [PATCH 3/3] Red nav logo fix --- acrobat/styles/styles.css | 6 ------ 1 file changed, 6 deletions(-) diff --git a/acrobat/styles/styles.css b/acrobat/styles/styles.css index 8da955dd..ded8c54b 100644 --- a/acrobat/styles/styles.css +++ b/acrobat/styles/styles.css @@ -136,12 +136,6 @@ div [class *= PdfnowLifecycle__dropzone2___] { padding: 0; } -.feds-topnav .feds-brand-image img { - aspect-ratio: 1/1; - width: 100%; - object-fit: contain; -} - .how-to .how-to-image img { aspect-ratio: 5/3; width: 100%;