Skip to content

Commit

Permalink
Merge branch 'main' into dex-20840-vlaicu-implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
iconstantin-bd committed Oct 31, 2024
2 parents cf3a2a6 + f257dce commit 9bfe8ad
Show file tree
Hide file tree
Showing 13 changed files with 294 additions and 83 deletions.
2 changes: 1 addition & 1 deletion _src/blocks/exit-popup/exit-popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ main .exit-popup-container {
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
background-color: rgb(0 0 0 / 70%);
z-index: 9999;
display: none;
}
Expand Down
2 changes: 2 additions & 0 deletions _src/blocks/header/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,8 @@ header.quiz {
}

header.quiz {
height: unset;

.icon {
width: 200px;
height: 64px;
Expand Down
24 changes: 23 additions & 1 deletion _src/blocks/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ import {
adobeMcAppendVisitorId, getDomain, decorateBlockWithRegionId, decorateLinkWithLinkTrackingId,
} from '../../scripts/utils/utils.js';

function makeImagePathsAbsolute(contentDiv, baseUrl) {
contentDiv.querySelectorAll('img').forEach((imgElement) => {
// Update the `src` attribute with an absolute URL
imgElement.src = `${baseUrl}${imgElement.getAttribute('src')}`;

// Function to update relative paths in `srcset` with absolute URLs
function makeSrcsetAbsolute(srcset) {
return srcset.replace(/(?:,|^)\s*(\/[^\s,]+)/g, (match, path) => match.replace(path, `${baseUrl}${path}`));
}

// Update the `srcset` attribute with absolute URLs
if (imgElement.srcset) {
imgElement.srcset = makeSrcsetAbsolute(imgElement.srcset, baseUrl);
}
});
}

function createLoginModal() {
const loginModal = document.querySelector('nav > div:nth-child(4)');
loginModal.classList.add('login-modal');
Expand Down Expand Up @@ -405,14 +422,19 @@ async function runDefaultHeaderLogic(block) {
return;
}
const aemHeaderHtml = await aemHeaderFetch.text();

const nav = document.createElement('div');
const shadowRoot = nav.attachShadow({ mode: 'open' });

const contentDiv = document.createElement('div');
contentDiv.style.display = 'none';

contentDiv.innerHTML = aemHeaderHtml;

// make image paths absolute for non-production environments
if (aemHeaderHostname === 'https://stage.bitdefender.com') {
makeImagePathsAbsolute(contentDiv, aemHeaderHostname);
}

const loadedLinks = [];
contentDiv.querySelectorAll('link').forEach((linkElement) => {
// update the links so that they work on all Franklin domains
Expand Down
Loading

0 comments on commit 9bfe8ad

Please sign in to comment.