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="row gx-4 gx-lg-5 align-items-top">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h3 class="fw-bolder"><u>Citations</u></h3><br />
|
<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>
|
<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>
|
<button onclick="copyToClip(document.getElementById('chicaco').innerHTML)">
|
||||||
|
Copy Chicago citation
|
||||||
|
</button>
|
||||||
<script>
|
<script>
|
||||||
let text = document.getElementById('chicago').innerHTML;
|
function copyToClip(str) {
|
||||||
const copyContent = async () => {
|
function listener(e) {
|
||||||
try {
|
e.clipboardData.setData("text/html", str);
|
||||||
await navigator.clipboard.writeText(text);
|
e.clipboardData.setData("text/plain", str);
|
||||||
console.log('Content copied to clipboard');
|
e.preventDefault();
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to copy: ', err);
|
|
||||||
}
|
}
|
||||||
}
|
document.addEventListener("copy", listener);
|
||||||
|
document.execCommand("copy");
|
||||||
|
document.removeEventListener("copy", listener);
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h3 class="fw-bolder"><u>Metadata</u></h3>
|
<h3 class="fw-bolder"><u>Metadata</u></h3>
|
||||||
|
Reference in New Issue
Block a user