';
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);
}
});
});
How fast can California go green? Struggling to pass a law to require all utilities to get a third of their power from green sources by 2020, lawmakers in Sacramento are hung up on the slow pace utilities have made meeting the existing goal of obtaining 20 percent of their power from green sources by 2010, spelled out in a law passed in 2006, reports the Los Angeles Times. Until they have that figured out, it's difficult to find a way to hit the more ambitious target.
The main argument is over how much of the new green power must be generated within California's borders. Another point of contention is which is more expensive: in-state renewable energy or wind and solar power from facilities elsewhere in the West.
The complex, many-sided negotiations could have a big effect in the decade ahead on consumers' electric bills, the quality of the air they breathe and the effect of global warming on their communities.
With two weeks to go in the legislative session, lawmakers have their work cut out for them. But Democratic lawmakers made the commitment to Gov. Arnold Schwarzenegger, who has been a leader in the fight for green power, arguing that not only does it turn the tide on global warming, but that it provides an economic boon as well.
-- Rita Hibbard