More citation work. I hate JS.
This commit is contained in:
@ -236,19 +236,25 @@ while ($row = $series->fetchArray()) {
|
||||
<div class="row gx-4 gx-lg-5 align-items-top">
|
||||
<div class="col-md-6">
|
||||
<h3 class="fw-bolder"><u>Citations</u></h3><br />
|
||||
<p class="metadata" id="chicago"><?php echo $row_author_sort.' <em>'.$row_title.'.</em> '.$row_publisher.', '.$row_pubdate.'.' ?></p>
|
||||
<button onclick="copyContent()">Copy Chicago citation</button>
|
||||
<p class="metadata" id="chicago"><?php echo $row_author_sort.'. <em>'.$row_title.'.</em> '.$row_publisher.', '.$row_pubdate.'.' ?></p>
|
||||
<button onclick="copyToClip(document.getElementById('chicaco').innerHTML)">
|
||||
Copy Chicago citation
|
||||
</button>
|
||||
<script>
|
||||
let text = document.getElementById('chicago').innerHTML;
|
||||
const copyContent = async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
console.log('Content copied to clipboard');
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err);
|
||||
}
|
||||
function copyToClip(str) {
|
||||
function listener(e) {
|
||||
e.clipboardData.setData("text/html", str);
|
||||
e.clipboardData.setData("text/plain", str);
|
||||
e.preventDefault();
|
||||
}
|
||||
document.addEventListener("copy", listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy", listener);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h3 class="fw-bolder"><u>Metadata</u></h3>
|
||||
|
Reference in New Issue
Block a user