';
document.querySelector('#copytext').value = textContent;
modal.showModal();
});
// Modal close functionality
const modal = document.querySelector('.republish-modal');
const closeBtn = document.querySelector('.republish-modal-close');
// Close button click
closeBtn.addEventListener('click', function() {
modal.close();
});
// Close on backdrop click
modal.addEventListener('click', function(e) {
if (e.target === modal) {
modal.close();
}
});
// Close on ESC key (this is usually built-in, but adding for safety)
modal.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
modal.close();
}
});
// Copy text button functionality
document.querySelector('.copy-text-button').addEventListener('click', async function() {
const textarea = document.querySelector('#copytext');
const text = textarea.value;
try {
// Try modern Clipboard API first
if (navigator.clipboard && window.isSecureContext) {
await navigator.clipboard.writeText(text);
this.textContent = 'Copied!';
} else {
// Fallback for older browsers
textarea.select();
document.execCommand('copy');
this.textContent = 'Copied!';
}
// Reset button text after 2 seconds
setTimeout(() => {
this.textContent = 'Copy text';
}, 2000);
} catch (err) {
console.error('Failed to copy text: ', err);
// Fallback to selection if copying fails
textarea.select();
this.textContent = 'Text selected';
setTimeout(() => {
this.textContent = 'Copy text';
}, 2000);
}
});
});
Wow. After toiling for years to expose the ills of water pollution, it's really exciting to see some of the nation's largest news organizations tackling some of the country's biggest water-contamination problems.
We've previously highlighted the New York Times' excellent piece on widespread industrial non-compliance with the Clean Water Act, which leads in some cases to polluted drinking water.
It's part of the NYT's "Toxic Waters" series. The latest installment devles into one of our favorite topics, stormwater, and particularly the nasty stuff generated at animal feedlots known as CAFOs.
Meanwhile, over at the Associated Press, some poor journalist whose byline was dropped when his story ran in the Charleston Daily Mail has done an admirable job looking into the quality of drinking water in the nation's schools. We helped in a sort of consultant role when the colleagues at the Seattle P-I took this topic on some years ago. We're glad the AP went after the national picture.
-- Robert McClure