@pushword/js-helper 0.0.111 → 0.0.113

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushword/js-helper",
3
- "version": "0.0.111",
3
+ "version": "0.0.113",
4
4
  "description": "Pushword front end helpers. ",
5
5
  "author": "Robin@PiedWeb <contact@piedweb.com>",
6
6
  "license": "MIT",
@@ -207,6 +207,7 @@ class ScrollXEnhancer {
207
207
  manageScrollXControllerVisibility(element) {
208
208
  const scrollLeftElement = element.parentNode.querySelector('.scroll-left')
209
209
  const scrollRightElement = element.parentNode.querySelector('.scroll-right')
210
+ if (!scrollLeftElement || !scrollRightElement) return
210
211
  scrollRightElement.classList.remove('opacity-30')
211
212
  scrollLeftElement.classList.remove('opacity-30')
212
213
 
package/src/helpers.js CHANGED
@@ -192,14 +192,14 @@ export function responsiveImage(src) {
192
192
  export function addClassForNormalUser(attribute = 'data-acinb') {
193
193
  var startScrolling = 0
194
194
  function scrollEventAddClassHandler() {
195
- console.log('scroll')
196
195
  if (startScrolling < 5) {
197
196
  startScrolling++
198
197
  }
199
198
  if (startScrolling === 4) {
200
199
  document.removeEventListener('scroll', scrollEventAddClassHandler)
201
200
  ;[].forEach.call(document.querySelectorAll('[' + attribute + ']'), function (element) {
202
- var classToAdd = element.getAttribute(attribute).split(' ')
201
+ var classToAddRaw = element.getAttribute(attribute)
202
+ var classToAdd = classToAddRaw.split(' ')
203
203
  element.removeAttribute(attribute)
204
204
  element.classList.add(...classToAdd)
205
205
  if (classToAdd.includes('block')) {
@@ -216,7 +216,7 @@ export function addClassForNormalUser(attribute = 'data-acinb') {
216
216
  }
217
217
  }
218
218
  }
219
- document.addEventListener('scroll', scrollEventAddClassHandler)
219
+ document.addEventListener('scroll', scrollEventAddClassHandler, { passive: true })
220
220
  }
221
221
  /**
222
222
  * Convert elements wich contain attribute (data-href) in normal link (a href)