in src/assets/js/main.js [673:732]
function handleFeedXml(doc) {
var $xml = $(doc);
var i = settings.num;
$xml.find('item').each(function () {
if (i--) {
var $this = $(this),
item = {
title: $this.find('title').text(),
description: $this.find('description').text(),
pubDate: $this.find('pubDate').text(),
};
var newDate = new Date(item.pubDate);
var d = newDate.getDate();
var m = newDate.getMonth();
m += 1; // JavaScript months are 0-11
var y = newDate.getFullYear();
var formattedDate = y + '/' + pad(m, 2) + '/' + pad(d, 2);
var $cell = $(settings.container);
var $cell_content = $cell.find('.block-link');
$cell_content
.append($('<h4>').text(item.title))
.append($('<p class="meta-date">').text(formattedDate))
.append(DOMPurify.sanitize(item.description));
var $link = $cell.find('p a:last-child');
var link_label = $link.html();
var link_url = $link.attr('href');
$link.remove();
$cell_content.append(
$(
'<p><span class="block-link-inline">' + link_label + '</span></p>'
)
);
$cell.attr('href', link_url);
$container.append($cell);
} else {
return false;
}
});
$container.slick({
mobileFirst: true,
dots: true,
arrows: false,
centerMode: true,
centerPadding: '16px',
slidesToShow: 1,
responsive: [
{
breakpoint: 640,
settings: 'unslick',
},
],
});
}