Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
wrap linklist generation in condition to prevent script blocking error (
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyundai committed Jun 26, 2023
1 parent 088a3e0 commit c5245c7
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions express/scripts/ckg-link-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,24 +254,26 @@ async function lazyLoadSearchMarqueeLinklist() {

if (searchMarquee) {
const linkListContainer = searchMarquee.querySelector('.carousel-container > .carousel-platform');
const linkListTemplate = linkListContainer.querySelector('p').cloneNode(true);
if (linkListContainer) {
const linkListTemplate = linkListContainer.querySelector('p').cloneNode(true);

const linkListData = [];
const linkListData = [];

if (window.linkLists && window.linkLists.ckgData && getMetadata('short-title')) {
window.linkLists.ckgData.forEach((row) => {
linkListData.push({
childSibling: row['child-siblings'],
ckgID: row.ckgID,
shortTitle: getMetadata('short-title'),
tasks: row.parent, // task on the page
displayValue: row.displayValue,
if (window.linkLists && window.linkLists.ckgData && getMetadata('short-title')) {
window.linkLists.ckgData.forEach((row) => {
linkListData.push({
childSibling: row['child-siblings'],
ckgID: row.ckgID,
shortTitle: getMetadata('short-title'),
tasks: row.parent, // task on the page
displayValue: row.displayValue,
});
});
});
}
}

await updateLinkList(linkListContainer, linkListTemplate, linkListData);
linkListContainer.parentElement.classList.add('appear');
await updateLinkList(linkListContainer, linkListTemplate, linkListData);
linkListContainer.parentElement.classList.add('appear');
}
}
}

Expand Down

0 comments on commit c5245c7

Please sign in to comment.