Skip to content

Commit

Permalink
Merge branch 'stage' into mwpw-147142-widget-overlap-mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
TsayAdobe authored May 20, 2024
2 parents 937107b + 0be5ab9 commit 4e92414
Show file tree
Hide file tree
Showing 5 changed files with 540 additions and 244 deletions.
19 changes: 18 additions & 1 deletion acrobat/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const locales = {
se: { ietf: 'sv-SE', tk: 'fpk1pcd.css' },
ch_it: { ietf: 'it-CH', tk: 'bbf5pok.css' },
tr: { ietf: 'tr-TR', tk: 'aaz7dvd.css' },
ae_en: { ietf: 'ar-EN', tk: 'pps7abe.css' },
ae_en: { ietf: 'ar-EN', tk: 'pps7abe.css', dir: 'ltr' },
uk: { ietf: 'en-GB', tk: 'pps7abe.css' },
at: { ietf: 'de-AT', tk: 'vin7zsi.css' },
cz: { ietf: 'cs-CZ', tk: 'aaz7dvd.css' },
Expand Down Expand Up @@ -290,6 +290,23 @@ const CONFIG = {
imsScope: 'AdobeID,openid,gnav,pps.read,firefly_api,additional_info.roles,read_organizations',
};

function replaceDotMedia(area = document) {
// eslint-disable-next-line compat/compat
const currUrl = new URL(window.location);
const pathSeg = currUrl.pathname.split('/').length;
if (pathSeg >= 3) return;
const resetAttributeBase = (tag, attr) => {
area.querySelectorAll(`${tag}[${attr}^="./media_"]`).forEach((el) => {
// eslint-disable-next-line compat/compat
el[attr] = `${new URL(`${CONFIG.contentRoot}${el.getAttribute(attr).substring(1)}`, window.location).href}`;
});
};
resetAttributeBase('img', 'src');
resetAttributeBase('source', 'srcset');
}

replaceDotMedia(document);

// Default to loading the first image as eager.
(async function loadLCPImage() {
const lcpImg = document.querySelector('img');
Expand Down
Loading

0 comments on commit 4e92414

Please sign in to comment.