|
11 | 11 | <th style="width:80px;">To</th> |
12 | 12 | <td>rcc-support@uq.edu.au</td> |
13 | 13 | <td style="width:70px; text-align:center; vertical-align:middle;"> |
14 | | - <button class="btn btn-sm btn-outline-secondary copy-field-btn" data-copy="rcc-support@uq.edu.au">Copy</button> |
| 14 | + <button class="btn btn-sm btn-outline-secondary" data-copy="rcc-support@uq.edu.au">Copy</button> |
15 | 15 | </td> |
16 | 16 | </tr> |
17 | 17 | <tr> |
18 | 18 | <th>Subject</th> |
19 | 19 | <td><span id="email-subject-{{ .Ordinal }}"></span></td> |
20 | 20 | <td style="width:70px; text-align:center; vertical-align:middle;"> |
21 | | - <button class="btn btn-sm btn-outline-secondary copy-field-btn" id="copy-subject-{{ .Ordinal }}">Copy</button> |
| 21 | + <button class="btn btn-sm btn-outline-secondary" id="copy-subject-{{ .Ordinal }}">Copy</button> |
22 | 22 | </td> |
23 | 23 | </tr> |
24 | 24 | <tr> |
25 | 25 | <th>Body</th> |
26 | 26 | <td><span id="email-body-{{ .Ordinal }}" style="white-space:pre-line;"></span></td> |
27 | 27 | <td style="width:70px; text-align:center; vertical-align:middle;"> |
28 | | - <button class="btn btn-sm btn-outline-secondary copy-field-btn" id="copy-body-{{ .Ordinal }}">Copy</button> |
| 28 | + <button class="btn btn-sm btn-outline-secondary" id="copy-body-{{ .Ordinal }}">Copy</button> |
29 | 29 | </td> |
30 | 30 | </tr> |
31 | 31 | </table> |
32 | | - <a id="email-link-{{ .Ordinal }}" class="btn btn-primary" href="#" role="button"> |
33 | | - Open in Email Client |
34 | | - </a> |
35 | 32 | </div> |
36 | 33 | </div> |
37 | 34 | </div> |
|
43 | 40 | var output = document.getElementById('email-output-' + ord); |
44 | 41 | var subjectEl = document.getElementById('email-subject-' + ord); |
45 | 42 | var bodyEl = document.getElementById('email-body-' + ord); |
46 | | - var link = document.getElementById('email-link-' + ord); |
47 | 43 |
|
48 | 44 | function getSubject() { |
49 | 45 | return 'Request new XNAT project for ' + input.value.trim(); |
|
57 | 53 | if (collection) { |
58 | 54 | subjectEl.textContent = getSubject(); |
59 | 55 | bodyEl.textContent = getBody(); |
60 | | - link.href = 'mailto:rcc-support@uq.edu.au?subject=' + encodeURIComponent(getSubject()) + '&body=' + encodeURIComponent(getBody() + '\n'); |
61 | 56 | output.style.display = 'block'; |
62 | 57 | } else { |
63 | 58 | output.style.display = 'none'; |
64 | 59 | } |
65 | 60 | }); |
66 | 61 |
|
67 | | - function copyAndConfirm(btn, text) { |
68 | | - navigator.clipboard.writeText(text); |
69 | | - } |
70 | | - |
71 | 62 | document.getElementById('copy-subject-' + ord).addEventListener('click', function() { |
72 | | - copyAndConfirm(this, getSubject()); |
| 63 | + navigator.clipboard.writeText(getSubject()); |
73 | 64 | }); |
74 | 65 | document.getElementById('copy-body-' + ord).addEventListener('click', function() { |
75 | | - copyAndConfirm(this, getBody()); |
| 66 | + navigator.clipboard.writeText(getBody()); |
76 | 67 | }); |
77 | | - |
78 | 68 | output.querySelector('[data-copy]').addEventListener('click', function() { |
79 | | - copyAndConfirm(this, this.getAttribute('data-copy')); |
| 69 | + navigator.clipboard.writeText(this.getAttribute('data-copy')); |
80 | 70 | }); |
81 | 71 | })(); |
82 | 72 | </script> |
0 commit comments