';
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);
}
});
});
"Right now, there's nothing I'd like more than a cool fresh glass of recycled San Diego sewer water," writes Jonathan Parkinson in High Country News. He's writing about a San Diego project to study "toilet-to-tap," purification of sewage to the point where you can drink it. Despite almost getting off track, the project is back on, and Parkinson, obviously, can't wait. Here's why: "Sewage purification is cheaper than desalination... sewage purification requires less energy, since the pressure needed in the reverse osmosis step is considerably less than that for ocean desalination. It's easier on the environment than desalination, because not only does it avoid the problem of inadvertently killing fish and fish larvae in the intake, but it also reduces the amount of treated effluent discharged into the ocean or nearby rivers. In fact, there are all kinds of reasons to love indirect potable reuse: It's cleaner, it's greener and other counties do it, too."
Make mine with a slice of lemon.