';
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 canal collapse that contributed to the deaths of a mother and two children has finally forced Utah legislators to look at regulating the privately owned water system , which has caused dozens of mudslides over its century-old history.
More than 1,000 companies operate tens of thousands of miles of canals, but no state laws dictate how such irrigation ditches should be built, maintained or serviced, write Matthew D. LaPlante and Nate Carlisle of the Salt Lake Tribune. Their persistent, digging on this story has forced lawmakers to respond.
But Sen. Lyle Hillyard, a Republican who represents Logan, where Saturday's deaths occurred, is himself a shareholder in two water companies, and said he was concerned about costs associated with regulation.
"I know personally most of the canal people who run the canals up there and obviously those people are very conscientious and concerned about the safety of their canals, not only because it might hurt people but because people rely on the water." he told the Salt Lake Tribune.