Skip to content

Commit

Permalink
image with link href removed
Browse files Browse the repository at this point in the history
  • Loading branch information
npy11 authored and npy11 committed Sep 27, 2024
1 parent 7be39f1 commit a47ee25
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions blocks/imgwithlink/imgwithlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export default function decorate(block) {
if (newDiv) {
block.innerHTML = "";
block.appendChild(newDiv);
if (document.querySelectorAll('.download-piramal-wrapper').length > 0) {
var desktopLinks = document.querySelectorAll('.download-piramal-wrapper .image-href-desktop a');
var mobileLinks = document.querySelectorAll('.download-piramal-wrapper .image-href-mobile a');
var anchor_class = desktopLinks.length > 0 ? desktopLinks : mobileLinks;
if (document.querySelectorAll('.download-piramal-wrapper,.contact-us-download-wrapper').length > 0) {
let desktopLinks = document.querySelectorAll('.download-piramal-wrapper .image-href-desktop a, .contact-us-download-wrapper .image-href-desktop a');
let mobileLinks = document.querySelectorAll('.download-piramal-wrapper .image-href-desktop a, .contact-us-download-wrapper .image-href-desktop a');
let anchor_class = desktopLinks.length > 0 ? desktopLinks : mobileLinks;
anchor_class[0].removeAttribute('href');
// document.querySelectorAll('.download-piramal-wrapper .image-href-desktop a')[0].removeAttribute('href');
}
Expand Down Expand Up @@ -52,14 +52,14 @@ function createImageWithLink(block) {
const menu_category = menu_categoryel.innerText.trim();
if (block.closest(".footer") && click_text && menu_category) outboundClick(click_text, menu_category, "footer", targetObject.pageName);
else if (block.closest(".download-piramal-wrapper") && click_text && menu_category) ctaClick(click_text, menu_category, menu_category, targetObject.pageName);
else if(block.closest('.section.career-social-cards')){
let data = {};
let urlText = e.target.closest('a').getAttribute('href').split('/')[2];
const pattern = /^www\.|\.com$/g;
const result = urlText.replace(pattern, '');
data.click_text = result;
data.cta_position = e.target.closest('.section').querySelector('.wrapper-creation-container .default-content-wrapper p').textContent.trim();
ctaClickInteraction(data);
else if (block.closest('.section.career-social-cards')) {
let data = {};
let urlText = e.target.closest('a').getAttribute('href').split('/')[2];
const pattern = /^www\.|\.com$/g;
const result = urlText.replace(pattern, '');
data.click_text = result;
data.cta_position = e.target.closest('.section').querySelector('.wrapper-creation-container .default-content-wrapper p').textContent.trim();
ctaClickInteraction(data);
}
} catch (error) {
console.warn(error);
Expand Down

0 comments on commit a47ee25

Please sign in to comment.