teaser separator
document.addEventListener('DOMContentLoaded', function() {
if (window.location.pathname === '/staff-403cd73') {
// Function to insert a heading after a given teaser element.
function insertHeading(teaserElement, headingText) {
var newHeading = document.createElement('h2');
newHeading.textContent = headingText;
// Styling for clean spacing
newHeading.style.cssText = `
display: block;
width: 100%;
text-align: left;
margin: 40px 0 20px;
margin-left: 15px;
padding: 0;
font-size: 28px;
line-height: 1.4;
font-weight: 600;
clear: both;
`;
// Insert the heading after the teaser element
teaserElement.parentNode.insertBefore(newHeading, teaserElement.nextSibling);
console.log("Inserted heading: " + headingText);
}
// Function to try to insert a heading after an element containing specified text.
function processTeaser(targetText, headingText) {
var teaser = Array.from(document.querySelectorAll('.teaser, .poc-instance, article'))
.find(el => el.textContent.includes(targetText));
if (teaser) {
insertHeading(teaser, headingText);
} else {
// Retry after 1 second if not found initially.
setTimeout(function() {
var retryTeaser = Array.from(document.querySelectorAll('.teaser, .poc-instance, article'))
.find(el => el.textContent.includes(targetText));
if (retryTeaser) {
insertHeading(retryTeaser, headingText);
}
}, 1000);
}
}
// Process teasers with their corresponding headings
processTeaser('Danielle James', 'Aquatic Invasive Species Program');
processTeaser('Sara Matthews', 'Fire Adapted Communities Program');
processTeaser('Cheyanne Neuffer', 'Forestry Program');
processTeaser('Cara Moore', 'Restoration and Land Management Program');
processTeaser('David Murray', 'Stormwater Program');
}
});