Skip to content

Commit 9e63091

Browse files
committed
Examples: fix copyCode to use .syntax-block
1 parent 372dcb1 commit 9e63091

164 files changed

Lines changed: 279 additions & 339 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/acceleration-with-vectors.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ <h1>Acceleration With Vectors</h1>
158158
</p>
159159
</footer>
160160
<script>function copyCode() {
161-
navigator.clipboard.writeText(document.getElementById('code-pre').innerText).then(() => {
161+
navigator.clipboard.writeText(document.querySelector('.syntax-block').innerText).then(() => {
162162
const btn = document.querySelector('.copy-btn');
163163
btn.textContent = 'Copied!'; btn.classList.add('copied');
164164
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);

examples/additive-wave.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ <h1>Additive Wave</h1>
219219
</p>
220220
</footer>
221221
<script>function copyCode() {
222-
navigator.clipboard.writeText(document.getElementById('code-pre').innerText).then(() => {
222+
navigator.clipboard.writeText(document.querySelector('.syntax-block').innerText).then(() => {
223223
const btn = document.querySelector('.copy-btn');
224224
btn.textContent = 'Copied!'; btn.classList.add('copied');
225225
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);

examples/alpha-mask.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ <h1>Alpha Mask</h1>
136136
</p>
137137
</footer>
138138
<script>function copyCode() {
139-
navigator.clipboard.writeText(document.getElementById('code-pre').innerText).then(() => {
139+
navigator.clipboard.writeText(document.querySelector('.syntax-block').innerText).then(() => {
140140
const btn = document.querySelector('.copy-btn');
141141
btn.textContent = 'Copied!'; btn.classList.add('copied');
142142
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);

examples/animated-sprite.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ <h1>Animated Sprite</h1>
190190
</p>
191191
</footer>
192192
<script>function copyCode() {
193-
navigator.clipboard.writeText(document.getElementById('code-pre').innerText).then(() => {
193+
navigator.clipboard.writeText(document.querySelector('.syntax-block').innerText).then(() => {
194194
const btn = document.querySelector('.copy-btn');
195195
btn.textContent = 'Copied!'; btn.classList.add('copied');
196196
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);

examples/arctangent.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ <h1>Arctangent</h1>
185185
</p>
186186
</footer>
187187
<script>function copyCode() {
188-
navigator.clipboard.writeText(document.getElementById('code-pre').innerText).then(() => {
188+
navigator.clipboard.writeText(document.querySelector('.syntax-block').innerText).then(() => {
189189
const btn = document.querySelector('.copy-btn');
190190
btn.textContent = 'Copied!'; btn.classList.add('copied');
191191
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);

examples/arm.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ <h1>Arm</h1>
159159
</p>
160160
</footer>
161161
<script>function copyCode() {
162-
navigator.clipboard.writeText(document.getElementById('code-pre').innerText).then(() => {
162+
navigator.clipboard.writeText(document.querySelector('.syntax-block').innerText).then(() => {
163163
const btn = document.querySelector('.copy-btn');
164164
btn.textContent = 'Copied!'; btn.classList.add('copied');
165165
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);

examples/array-2d.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ <h1>Array 2D</h1>
154154
</p>
155155
</footer>
156156
<script>function copyCode() {
157-
navigator.clipboard.writeText(document.getElementById('code-pre').innerText).then(() => {
157+
navigator.clipboard.writeText(document.querySelector('.syntax-block').innerText).then(() => {
158158
const btn = document.querySelector('.copy-btn');
159159
btn.textContent = 'Copied!'; btn.classList.add('copied');
160160
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);

examples/array-objects.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ <h1>Array Objects</h1>
221221
</p>
222222
</footer>
223223
<script>function copyCode() {
224-
navigator.clipboard.writeText(document.getElementById('code-pre').innerText).then(() => {
224+
navigator.clipboard.writeText(document.querySelector('.syntax-block').innerText).then(() => {
225225
const btn = document.querySelector('.copy-btn');
226226
btn.textContent = 'Copied!'; btn.classList.add('copied');
227227
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);

examples/array.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ <h1>Array</h1>
170170
</p>
171171
</footer>
172172
<script>function copyCode() {
173-
navigator.clipboard.writeText(document.getElementById('code-pre').innerText).then(() => {
173+
navigator.clipboard.writeText(document.querySelector('.syntax-block').innerText).then(() => {
174174
const btn = document.querySelector('.copy-btn');
175175
btn.textContent = 'Copied!'; btn.classList.add('copied');
176176
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);

examples/arraylist-of-objects.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ <h1>ArrayList of objects</h1>
192192
</p>
193193
</footer>
194194
<script>function copyCode() {
195-
navigator.clipboard.writeText(document.getElementById('code-pre').innerText).then(() => {
195+
navigator.clipboard.writeText(document.querySelector('.syntax-block').innerText).then(() => {
196196
const btn = document.querySelector('.copy-btn');
197197
btn.textContent = 'Copied!'; btn.classList.add('copied');
198198
setTimeout(() => { btn.textContent = 'Copy'; btn.classList.remove('copied'); }, 2000);

0 commit comments

Comments
 (0)