From a352a9f3813915e4794f20cbb1ccc3f0513706f8 Mon Sep 17 00:00:00 2001 From: vinaykumargujja Date: Mon, 23 Oct 2023 11:20:12 +0530 Subject: [PATCH 1/6] images with and without hyperlink --- blocks/imageshyperlink/imageshyperlink.css | 0 blocks/imageshyperlink/imageshyperlink.js | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 blocks/imageshyperlink/imageshyperlink.css create mode 100644 blocks/imageshyperlink/imageshyperlink.js diff --git a/blocks/imageshyperlink/imageshyperlink.css b/blocks/imageshyperlink/imageshyperlink.css new file mode 100644 index 00000000..e69de29b diff --git a/blocks/imageshyperlink/imageshyperlink.js b/blocks/imageshyperlink/imageshyperlink.js new file mode 100644 index 00000000..347a6714 --- /dev/null +++ b/blocks/imageshyperlink/imageshyperlink.js @@ -0,0 +1,21 @@ +import { readBlockConfig } from '../../scripts/aem.js'; +/** + * loads and decorates the footer + * @param {Element} block The footer block element + */ +export default async function decorate(block) { + const anchorEl = document.createElement("a"); + let refAnchorEl = block.querySelector("a"); + let pic = block.querySelector("picture"); + if (refAnchorEl) { + refAnchorEl.hasAttribute("href") && anchorEl.setAttribute("href", refAnchorEl.getAttribute("href")); + refAnchorEl.getAttribute("title") && anchorEl.setAttribute("title", refAnchorEl.getAttribute("title")); + refAnchorEl.getAttribute("alt") && anchorEl.setAttribute("alt", refAnchorEl.getAttribute("alt")); + anchorEl.appendChild(pic); + block.textContent = ""; + block.append(anchorEl); + } else { + block.textContent = ""; + block.append(pic); + } +} \ No newline at end of file From 634b36ba22d877768af6e20e38beaaebf844f68c Mon Sep 17 00:00:00 2001 From: vinaykumargujja Date: Mon, 23 Oct 2023 13:08:41 +0530 Subject: [PATCH 2/6] cleared lint issues imageshyperlink1 --- blocks/imageshyperlink/imageshyperlink.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/blocks/imageshyperlink/imageshyperlink.js b/blocks/imageshyperlink/imageshyperlink.js index 347a6714..61fae6f8 100644 --- a/blocks/imageshyperlink/imageshyperlink.js +++ b/blocks/imageshyperlink/imageshyperlink.js @@ -1,21 +1,20 @@ -import { readBlockConfig } from '../../scripts/aem.js'; /** * loads and decorates the footer * @param {Element} block The footer block element */ export default async function decorate(block) { - const anchorEl = document.createElement("a"); - let refAnchorEl = block.querySelector("a"); - let pic = block.querySelector("picture"); + const anchorEl = document.createElement('a'); + const refAnchorEl = block.querySelector('a'); + const pic = block.querySelector('picture'); if (refAnchorEl) { - refAnchorEl.hasAttribute("href") && anchorEl.setAttribute("href", refAnchorEl.getAttribute("href")); - refAnchorEl.getAttribute("title") && anchorEl.setAttribute("title", refAnchorEl.getAttribute("title")); - refAnchorEl.getAttribute("alt") && anchorEl.setAttribute("alt", refAnchorEl.getAttribute("alt")); + refAnchorEl.hasAttribute('href') && anchorEl.setAttribute('href', refAnchorEl.getAttribute('href')); + refAnchorEl.getAttribute('title') && anchorEl.setAttribute('title', refAnchorEl.getAttribute('title')); + refAnchorEl.getAttribute('alt') && anchorEl.setAttribute('alt', refAnchorEl.getAttribute('alt')); anchorEl.appendChild(pic); - block.textContent = ""; + block.textContent = ''; block.append(anchorEl); } else { - block.textContent = ""; + block.textContent = ''; block.append(pic); } -} \ No newline at end of file +} From a33d9d57abe5511842767709990d2e4cd059e6dd Mon Sep 17 00:00:00 2001 From: vinaykumargujja Date: Mon, 23 Oct 2023 13:36:34 +0530 Subject: [PATCH 3/6] cleared lint issues imageshyperlink2 --- blocks/imageshyperlink/imageshyperlink.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/blocks/imageshyperlink/imageshyperlink.js b/blocks/imageshyperlink/imageshyperlink.js index 61fae6f8..730dcac2 100644 --- a/blocks/imageshyperlink/imageshyperlink.js +++ b/blocks/imageshyperlink/imageshyperlink.js @@ -7,9 +7,9 @@ export default async function decorate(block) { const refAnchorEl = block.querySelector('a'); const pic = block.querySelector('picture'); if (refAnchorEl) { - refAnchorEl.hasAttribute('href') && anchorEl.setAttribute('href', refAnchorEl.getAttribute('href')); - refAnchorEl.getAttribute('title') && anchorEl.setAttribute('title', refAnchorEl.getAttribute('title')); - refAnchorEl.getAttribute('alt') && anchorEl.setAttribute('alt', refAnchorEl.getAttribute('alt')); + if(refAnchorEl.hasAttribute('href')) anchorEl.setAttribute('href', refAnchorEl.getAttribute('href')); + if(refAnchorEl.hasAttribute('title')) anchorEl.setAttribute('title', refAnchorEl.getAttribute('title')); + if(refAnchorEl.hasAttribute('alt')) anchorEl.setAttribute('alt', refAnchorEl.getAttribute('alt')); anchorEl.appendChild(pic); block.textContent = ''; block.append(anchorEl); From 36c5642b03efafd99ecb2cd4f80a49717ada7c8b Mon Sep 17 00:00:00 2001 From: vinaykumargujja Date: Mon, 23 Oct 2023 13:42:55 +0530 Subject: [PATCH 4/6] cleared lint issues imageshyperlink3 --- blocks/imageshyperlink/imageshyperlink.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/blocks/imageshyperlink/imageshyperlink.js b/blocks/imageshyperlink/imageshyperlink.js index 730dcac2..0bc06fdd 100644 --- a/blocks/imageshyperlink/imageshyperlink.js +++ b/blocks/imageshyperlink/imageshyperlink.js @@ -7,9 +7,15 @@ export default async function decorate(block) { const refAnchorEl = block.querySelector('a'); const pic = block.querySelector('picture'); if (refAnchorEl) { - if(refAnchorEl.hasAttribute('href')) anchorEl.setAttribute('href', refAnchorEl.getAttribute('href')); - if(refAnchorEl.hasAttribute('title')) anchorEl.setAttribute('title', refAnchorEl.getAttribute('title')); - if(refAnchorEl.hasAttribute('alt')) anchorEl.setAttribute('alt', refAnchorEl.getAttribute('alt')); + if (refAnchorEl.hasAttribute('href')) { + anchorEl.setAttribute('href', refAnchorEl.getAttribute('href')); + } + if (refAnchorEl.hasAttribute('title')) { + anchorEl.setAttribute('title', refAnchorEl.getAttribute('title')); + } + if (refAnchorEl.hasAttribute('alt')) { + anchorEl.setAttribute('alt', refAnchorEl.getAttribute('alt')); + } anchorEl.appendChild(pic); block.textContent = ''; block.append(anchorEl); From 8d6d1e6fe7bdb5dbf615709ee494feeab6d55197 Mon Sep 17 00:00:00 2001 From: vinaykumargujja Date: Mon, 23 Oct 2023 13:46:53 +0530 Subject: [PATCH 5/6] cleared lint issues imageshyperlink4 --- blocks/imageshyperlink/imageshyperlink.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blocks/imageshyperlink/imageshyperlink.js b/blocks/imageshyperlink/imageshyperlink.js index 0bc06fdd..2a0aacf0 100644 --- a/blocks/imageshyperlink/imageshyperlink.js +++ b/blocks/imageshyperlink/imageshyperlink.js @@ -12,7 +12,7 @@ export default async function decorate(block) { } if (refAnchorEl.hasAttribute('title')) { anchorEl.setAttribute('title', refAnchorEl.getAttribute('title')); - } + } if (refAnchorEl.hasAttribute('alt')) { anchorEl.setAttribute('alt', refAnchorEl.getAttribute('alt')); } From 989242f125eaf8da917e198bc759374a5db6bd22 Mon Sep 17 00:00:00 2001 From: TeshuKatepalli Date: Wed, 25 Oct 2023 08:39:32 +0530 Subject: [PATCH 6/6] Fixed lint issues --- blocks/imageshyperlink/imageshyperlink.css | 1 + 1 file changed, 1 insertion(+) diff --git a/blocks/imageshyperlink/imageshyperlink.css b/blocks/imageshyperlink/imageshyperlink.css index e69de29b..779a9a88 100644 --- a/blocks/imageshyperlink/imageshyperlink.css +++ b/blocks/imageshyperlink/imageshyperlink.css @@ -0,0 +1 @@ +/* image hyderplink css */