|
13 | 13 | .copy-btn {margin-bottom: 0.3rem; padding: 0.3rem 0.7rem; font-size: 0.7rem; cursor: pointer;} |
14 | 14 | </style> |
15 | 15 | <script> |
16 | | -document.querySelectorAll('.copy-btn').forEach(function(button) { |
17 | | - button.addEventListener('click', function() { |
18 | | - // Find the next sibling <pre> and its <code> child |
19 | | - const pre = button.nextElementSibling; |
20 | | - if (pre && pre.tagName.toLowerCase() === 'pre') { |
21 | | - const code = pre.querySelector('code'); |
22 | | - if (code) { |
23 | | - navigator.clipboard.writeText(code.innerText).then(function() { |
24 | | - button.textContent = 'Copied!'; |
25 | | - setTimeout(() => button.textContent = 'Copy', 1500); |
26 | | - }, function() { |
27 | | - button.textContent = 'Error'; |
28 | | - }); |
| 16 | + // Attach copy functionality to each button |
| 17 | + document.querySelectorAll(".copy-btn").forEach((button) => { |
| 18 | + button.addEventListener("click", () => { |
| 19 | + // Find the <pre class="cdblk"> immediately after this button |
| 20 | + const pre = button.nextElementSibling; |
| 21 | + if (pre && pre.classList.contains("cdblk")) { |
| 22 | + const codeEl = pre.querySelector("code"); |
| 23 | + if (codeEl) { |
| 24 | + const text = codeEl.innerText.trim(); |
| 25 | + navigator.clipboard.writeText(text).then(() => { |
| 26 | + // Optional feedback |
| 27 | + button.textContent = "Copied!"; |
| 28 | + setTimeout(() => (button.textContent = "Copy"), 1500); |
| 29 | + }).catch(err => { |
| 30 | + console.error("Failed to copy: ", err); |
| 31 | + }); |
| 32 | + } |
29 | 33 | } |
30 | | - } |
| 34 | + }); |
31 | 35 | }); |
32 | | -}); |
33 | 36 | </script> |
34 | 37 | </head> |
35 | 38 | <body> |
|
58 | 61 | <article aria-labelledby="art1Title"> |
59 | 62 | <h2 id="art1Title">Websites</h2> |
60 | 63 | <p class="intro">TBD</p> |
61 | | -<button class="copy-btn" aria-label="Copy code">Copy Prompt</button> |
62 | | -<pre><code> |
| 64 | +<button class="copy-btn">Copy Prompt</button> |
| 65 | +<pre class="cdblk"><code> |
63 | 66 | I am a web designer applying Microsoft Inclusive Design methods, specifically the principle of "recognize exclusion", to identify potential barriers in a website I'm designing. |
64 | 67 |
|
65 | 68 | **Goal:** Generate a list of at least 24 potential exclusions that users with disabilities or assistive technology mismatches might encounter when interacting with my website. |
@@ -90,8 +93,8 @@ <h2 id="art1Title">Websites</h2> |
90 | 93 | <article aria-labelledby="art2Title"> |
91 | 94 | <h2 id="art2Title">Apps</h2> |
92 | 95 | <p class="intro">tbd</p> |
93 | | -<button class="copy-btn" aria-label="Copy code">Copy Prompt</button> |
94 | | -<pre><code> |
| 96 | +<button class="copy-btn">Copy Prompt</button> |
| 97 | +<pre class="cdblk"><code> |
95 | 98 | I am an app designer applying Microsoft Inclusive Design methods, specifically the principle of "recognize exclusion", to identify potential barriers in a mobile app I'm designing. |
96 | 99 |
|
97 | 100 | **Goal:** Generate a list of at least 24 potential exclusions that users with disabilities or assistive technology mismatches might encounter when interacting with my mobile app. |
@@ -122,8 +125,8 @@ <h2 id="art2Title">Apps</h2> |
122 | 125 | <article aria-labelledby="art3Title"> |
123 | 126 | <h2 id="art3Title">Game</h2> |
124 | 127 | <p class="intro">TBD</p> |
125 | | -<button class="copy-btn" aria-label="Copy code">Copy Prompt</button> |
126 | | -<pre><code> |
| 128 | +<button class="copy-btn">Copy Prompt</button> |
| 129 | +<pre class="cdblk"><code> |
127 | 130 | I am a game designer applying Microsoft Inclusive Design methods, specifically the principle of "recognize exclusion", to identify potential barriers in a game I'm designing. |
128 | 131 |
|
129 | 132 | **Goal:** Generate a list of at least 24 potential exclusions that users with disabilities or assistive technology mismatches might encounter when interacting with my game. |
|
0 commit comments