';
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);
}
});
});
The warming of the surface of the Pacific Ocean could harm plankton and have catastrophic consequences for species that depend on them, a University of British Columbia researcher predicted nearly 15 years ago, reports Carlito Pablo in the Georgia Straight. With the still unexplained collapse of the Fraser River sockeye runs this summer, temperature changes in the ocean and rivers could play a part in smaller sizes and numbers of fish, report two other studies by the same researcher and colleagues.
With four of the five species of salmon in British Columbia suffering from low populations, fishermen are turning their attention to pink salmon, largely ignored by the industry because of their small size, reports Mark Hume in the Globe and Mail. The fact that the pinks slipped by while fishermen focused on chinook, sockeye, chum and coho may account for their populations being more stable than those of the other species. That could change if sport and subsistence fishermen rely on pinks to fulfill their catches if the other runs don't rebound.
? Emily Linroth