Skip to content

Commit c5dfe3e

Browse files
committed
switched codeblocks JS asset to DOMContentLoaded event init
Phasing out jQuery
1 parent a261a62 commit c5dfe3e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/assets/javascripts/codeblocks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
$(() => {
1+
document.addEventListener('DOMContentLoaded', () => {
22
const buttonTemplate = `<button class="copy-button button is-muted is-outlined has-margin-2">Copy</button>`;
33

44
$('.post--content pre > code')
55
.parent()
66
.each(function () {
77
const $button = $(buttonTemplate);
88
const $content = $(this).text();
9-
const numLines = $content.trim().split(/\r?\n/).length
9+
const numLines = $content.trim().split(/\r?\n/).length;
1010

1111
if (numLines <= 1) {
1212
$button.addClass('is-small');

0 commit comments

Comments
 (0)