= 700 ? 2 : 1;
let inListAdPos = [0, 3, 6, 9, 12];
let inListAd = [
[4290, 4294],
[4298, 4302],
[4306, 4310],
[4314, 4318],
[4322, 4326]
];
// #86183 1x1 與 最後一則列表廣告 不可連續出現
if (currentPageTotalArticle === 0 && !canShowDesktopOneXOneAd) {
addInListAdByIndex(-1, adOnceQuantity, false);
} else {
for (let i = 0; i < currentPageTotalArticle; i++) {
// 為最末篇文章 & 屬列表廣告該出位置 & 可顯示 1x1 廣告 ->> 不出該層列表廣告
if (i === (currentPageTotalArticle - 1) && inListAdPos.includes(i) && canShowDesktopOneXOneAd) {
break;
}
if (inListAdPos.includes(i)) {
addInListAdByIndex(i, adOnceQuantity, true);
}
}
}
function addInListAdByIndex(index, adOnceQuantity, hasArticle) {
let target;
let innerContent = '';
if (hasArticle) {
target = document.querySelector(`.article-inlist-ad[data-article-index="${index}"]`);
} else {
target = document.createElement("div");
target.className = 'article-inlist-ad';
document.querySelector('#article-box').append(target);
}
inListAd.shift().slice(0, adOnceQuantity).forEach(adNum => {
innerContent += ``;
});
target.innerHTML = innerContent;
}