jekyll-theme-centos 2.52.0.beta.60 → 2.52.0.beta.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,8 +11,6 @@ class CopyButtonHandler {
11
11
  this.checkmarkViewbox = config.checkmarkViewbox || '0 0 448 512'
12
12
  this.successMessage = config.successMessage || 'Copied!'
13
13
  this.originalIcon = this._captureIcon()
14
-
15
- button.addEventListener('click', (e) => this.handleClick(e))
16
14
  }
17
15
 
18
16
  _captureIcon () {
@@ -126,12 +124,22 @@ document.addEventListener('DOMContentLoaded', function () {
126
124
  if (scriptElement.dataset.successMessage) config.successMessage = scriptElement.dataset.successMessage
127
125
  }
128
126
 
129
- document.querySelectorAll('.copy-btn').forEach(button => {
130
- try {
131
- new CopyButtonHandler(button, config)
132
- } catch (err) {
133
- console.error('Failed to initialize copy button:', button, 'Error:', err)
127
+ const handlers = new WeakMap()
128
+
129
+ document.addEventListener('click', function (e) {
130
+ const button = e.target.closest('.copy-btn')
131
+ if (!button) return
132
+
133
+ if (!handlers.has(button)) {
134
+ try {
135
+ handlers.set(button, new CopyButtonHandler(button, config))
136
+ } catch (err) {
137
+ console.error('Failed to initialize copy button:', button, 'Error:', err)
138
+ return
139
+ }
134
140
  }
141
+
142
+ handlers.get(button).handleClick(e)
135
143
  })
136
144
  })
137
145
  })()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-centos
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.52.0.beta.60
4
+ version: 2.52.0.beta.61
5
5
  platform: ruby
6
6
  authors:
7
7
  - ReleaseBot