Skip to content

Commit

Permalink
removed checkForHiddenLink function
Browse files Browse the repository at this point in the history
  • Loading branch information
mirafedas committed Mar 12, 2024
1 parent 2feac2b commit dea9408
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
10 changes: 1 addition & 9 deletions libs/blocks/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,10 @@ export function getHashParams(hashStr) {
}, {});
}

export function checkForHiddenLink(el) {
if (el?.dataset.modalHash.includes('#hide')) {
el.classList.add('hide-block');
el.dataset.modalHash = el.dataset.modalHash.replace('#hide', '');
}
}

export function delayedModal(el) {
const { hash, delay } = getHashParams(el?.dataset.modalHash);
if (!delay || !hash) return false;
el.classList.add('hide-block');
const modalOpenEvent = new Event(`${hash}:modalOpen`);
const pagesModalWasShownOn = window.sessionStorage.getItem(`shown:${hash}`);
el.dataset.modalHash = hash;
Expand All @@ -262,8 +256,6 @@ export function delayedModal(el) {

// Deep link-based
export default function init(el) {
checkForHiddenLink(el);

if (delayedModal(el)) return null;

if (window.location.hash === el.dataset.modalHash) {
Expand Down
12 changes: 0 additions & 12 deletions libs/features/personalization/personalization.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,6 @@ export const preloadManifests = ({ targetManifests = [], persManifests = [] }) =

export const getFileName = (path) => path?.split('/').pop();

export const isDelayedModal = (url) => {
const delayedModalRegExp = /\/.*?#.*?:delay=[1-9][0-9]*/; // matches 'anytext/#anytext:delay=anynumbers(followed by any text)
let isDM = false;
try {
isDM = delayedModalRegExp.test(url);
} catch {
// ignore
}
return isDM;
};

const createFrag = (el, url, manifestId) => {
let href = url;
try {
Expand All @@ -124,7 +113,6 @@ const createFrag = (el, url, manifestId) => {
} catch {
// ignore
}
href = `${href}${isDelayedModal(url) ? '#hide' : ''}`;
const a = createTag('a', { href }, url);
if (manifestId) a.dataset.manifestId = manifestId;
let frag = createTag('p', undefined, a);
Expand Down

0 comments on commit dea9408

Please sign in to comment.