';
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);
}
});
});
David R. Baker of the San Francisco Chronicle reports that California businesses such as oil refineries, cement factories and electric utilities could soon begin paying for greenhouse gases they emit.
The proposed fee -- 12 cents per metric ton of carbon dioxide -- is the nation's first state fee for emitting greenhouse gases.
Today members of the California Air Resources Board will discuss the fee, which would fund the creation and enforcement of the state's regulations to fight climate change.
Read the full story at: http://bit.ly/10Ps46
UPDATE:
The California Air Resources Board said it needed more time to work out the details of the new regulations. Read the story here: http://bit.ly/S8Ba7
In other Cali climate change news, Matt Weiser of the Sacramento Bee reports that state officials have rejected a petition to protect the American pika under the state Endangered Species Act.
The rabbit relative scurries among boulders at high elevation in the Sierra Nevada -- and it doesn't like the rising heat. The pika would have been the first animal in the lower 48 to be protected due to climate change; federal studies of whether to protect the pika as an endangered species continue.
Read the full story at http://bit.ly/Qmxh6