if (window.location.hostname === "www.eposcard.co.jp") { const rssUrlinfo = "https://www.eposcard.co.jp/articles/rss?exclude_body=1&size=4"; fetch(rssUrlinfo) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.text(); }) .then(str => (new window.DOMParser()).parseFromString(str, "text/xml")) .then(xml => { const items = xml.getElementsByTagName("item"); const fragment = document.createDocumentFragment(); for (let i = 0; i < items.length; i++) { const title = items[i].getElementsByTagName("title")[0].textContent; const pubDate = items[i].getElementsByTagName("pubDate")[0].textContent; const category = items[i].getElementsByTagName("category")[0].textContent; const link = items[i].getElementsByTagName("link")[0].textContent; const date = new Date(pubDate); const formattedDate = `${date.getFullYear()}/${(date.getMonth() + 1).toString().padStart(2, '0')}/${date.getDate().toString().padStart(2, '0')}`; const article = document.createElement("div"); article.className = "articleCasette"; const a = document.createElement("a"); a.href = link; const cell1 = document.createElement("div"); cell1.className = "cell"; const catLabel = document.createElement("span"); catLabel.className = "catLabel"; catLabel.textContent = category; cell1.appendChild(catLabel); const cell2 = document.createElement("div"); cell2.className = "cell"; const timeElem = document.createElement("time"); timeElem.setAttribute("datetime", formattedDate); timeElem.textContent = formattedDate; cell2.appendChild(timeElem); const cell3 = document.createElement("div"); cell3.className = "cell"; cell3.textContent = title; a.appendChild(cell1); a.appendChild(cell2); a.appendChild(cell3); article.appendChild(a); fragment.appendChild(article); } if (items.length > 0) { document.getElementById("articlesinfoContainer").appendChild(fragment); } }) .catch(error => { console.error('Fetch error:', error); }); }