';
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);
}
});
});
It took nearly three centuries to happen, but a migrating bird - a Wilson's phalarope -- landed on flowing water Wednesday at the site of what had for 2,600 years been a dried up river delta on the edge of the Great Salt Lake.
Tom Wharton of the Salt Lake Tribune writes that the release of water through new floodgates on the National Audubon Society's 2,738p-acre South Shore Preserve created the new wetlands. The effort required the coming together of diverse interests, including local governments, the Church of Jesus Christ of Latter Day Saints, hunters, landowners, and conservationists. For birders, it was a moment of exhilaration.
The newly flooded area is expected to be a stopping point for millions of shorebirds that migrate through Utah.