' + r.typeLabel + '' + taglist + '
' + r.shortTitle + '' + (r.contentPreview ? '
' + r.contentPreview + '
' : '') + '
' + r.date + '
';
}
function showAll() {
document.getElementById('primary').dataset.activeSection = "all";
overviews.style.display = 'block';
postResults.innerHTML = '';
window.scrollTo(0, 0);
postResultsTitle.innerHTML = '';
}
function showPostType(slug, name) {
document.getElementById('primary').dataset.activeSection = slug;
overviews.style.display = 'none';
postResults.innerHTML = '';
postResultsTitle.innerText = name;
window.scrollTo(0, 0);
let added = 0;
let resourceCount = resources[slug].length;
let allLoaded = false;
let adding = false;
// add first 8
function addMore() {
adding = true;
for (let i = added; i = prHeight) {
// add next 8
addMore();
}
}
};
}
if (postType) {
showPostType(postType);
}
/* Topic Filters */
const topicButton = document.getElementById('filter-by-topic');
const topicDropdown = document.getElementById('topic-dropdown');
const topicDropdownButtons = document.querySelectorAll('#topic-dropdown input[type="checkbox"]');
const deleteTopicButtons = document.querySelectorAll('.unselect-topic');
console.log(topicDropdownButtons);
topicDropdownButtons.forEach(function(t) {
t.addEventListener('click', function(ev) {
updateTopics();
})
});
deleteTopicButtons.forEach(function(d) {
d.addEventListener('click', function(ev) {
//console.log(ev.target.dataset.topic);
document.querySelector('input[type="checkbox"][value="' + ev.target.dataset.topic + '"]').checked = false;
updateTopics();
});
});
function updateTopics() {
var currentSelected = "";
topicDropdownButtons.forEach(function(t) {
if (t.checked)
currentSelected += t.value + " ";
});
//console.log(currentSelected.slice(0, -1));\
const urlParams = new URLSearchParams(window.location.search);
urlParams.set('topic', currentSelected.slice(0, -1));
window.location.search = urlParams;
}
topicButton.onclick = function() {
topicDropdown.classList.toggle('show');
}
/* Old Select...
const topics = document.getElementById('topic-select');
topics.onchange = function() {
const urlParams = new URLSearchParams(window.location.search);
urlParams.set('topic', this.value);
window.location.search = urlParams;
}
*/
/* Deselect Topic Filter */
/*if (!!document.getElementById('unselect-topic')) {
document.getElementById('unselect-topic').onclick = function() {
//const urlParams = new URLSearchParams(window.location.search);
// urlParams.delete('topic');
//window.location.search = urlParams;
}
}*/
/* Topic Tag Event Listener */
function updateTopicLinks() {
const allTopicLinks = document.querySelectorAll('.term[data-topic]');
allTopicLinks.forEach(function(t) {
t.addEventListener('click', function(ev) {
ev.preventDefault();
const urlParams = new URLSearchParams(window.location.search);
urlParams.set('topic', this.getAttribute('data-topic'));
window.location.search = urlParams;
}, false);
});
}
});