';
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);
}
});
});
Foresters in Western Canada and the United States have begun taking climate control matters into their own hands by relocating certain tree species threatened by global warming to new geographic locations.
Alicia Chang, Science Writer with the Associated Press, takes a thoughtful look at this controversial practice. Critics worry no one should play God with nature and that such re-introduction efforts, however well intended, may upset the natural balance in the new location. But proponents of proactive tree conservation say it would be irresponsible to let whole species die off because of deteriorating ecosystems. So far the approach is being tried with the Western larch, which grows in areas of British Columbia's southern interior, and is now being seeded just below the Arctic Circle. And in a similar effort, scientists are planting seedlings of Sitka spruce and Western red cedar from B.C. coastal rainforests into the dry ponderosa pine forests of Idaho.