/gi, '');
let doc = new DOMParser().parseFromString(modifiedHtml, 'text/html');
return doc.body.textContent || "";
}
function displayComment(comment) {
let commentContainer = document.getElementById('comment-container');
commentContainer.classList.add('fade-out');
setTimeout(() => {
commentContainer.classList.remove('fade-out');
let avatarDiv = document.getElementById('commentAvatar');
let authorDiv = document.getElementById('commentAuthor');
let textDiv = document.getElementById('commentText');
avatarDiv.innerHTML = '';
authorDiv.innerHTML = '';
textDiv.innerHTML = '';
let avatarImg = document.createElement('img');
avatarImg.src = comment.author.avatar.cache;
avatarDiv.appendChild(avatarImg);
authorDiv.innerText = comment.author.name + ' /';
let cleanCommentText = stripHtml(comment.message);
let commentLink = document.createElement('a');
//commentLink.href = comment.thread.link + '#comment-' + comment.id;
commentLink.href = '/comments/latest/';
commentLink.innerHTML = cleanCommentText;
textDiv.appendChild(commentLink);
commentContainer.classList.add('fade-in');
setTimeout(() => {
commentContainer.classList.remove('fade-in');
}, 300);
}, 400);
}
let comments;
let currentIndex = 0;
let commentInterval;
function setupCommentInterval() {
commentInterval = setInterval(() => {
currentIndex = (currentIndex + 1) % comments.length;
displayComment(comments[currentIndex]);
}, 5000);
}
fetch('/snippets/disqus_fetcher.jsp?what=fivelatest')
.then(response => response.json())
.then(data => {
comments = data.response;
displayComment(comments[currentIndex]);
setupCommentInterval();
})
.catch(error => console.error('Error:', error));
document.getElementById('commentPrev').addEventListener('click', () => {
currentIndex = (currentIndex - 1 + comments.length) % comments.length;
displayComment(comments[currentIndex]);
});
document.getElementById('commentNext').addEventListener('click', () => {
currentIndex = (currentIndex + 1) % comments.length;
displayComment(comments[currentIndex]);
});
document.getElementById('comment-container').addEventListener('mouseover', () => {
clearInterval(commentInterval);
});
document.getElementById('comment-container').addEventListener('mouseout', () => {
setupCommentInterval();
});
Ju längre period, desto bättre pris. Du bestämmer!
Du kan alltid betala med Apple Pay, Google Pay, Visa, Mastercard och Amex.
Med engångsköp kan du även använda Swish och Klarna.