@pushword/js-helper 0.0.118 → 0.0.120

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.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/src/helpers.js +9 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushword/js-helper",
3
- "version": "0.0.118",
3
+ "version": "0.0.120",
4
4
  "description": "Pushword front end helpers. ",
5
5
  "author": "Robin@PiedWeb <contact@piedweb.com>",
6
6
  "license": "MIT",
@@ -9,9 +9,9 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "140.css": "^1.0.1",
12
- "@babel/core": "^7.23",
12
+ "@babel/core": "^7.24",
13
13
  "@babel/preset-env": "^7.22",
14
- "@symfony/webpack-encore": "^4.6",
14
+ "@symfony/webpack-encore": "^5",
15
15
  "@tailwindcss/aspect-ratio": "^0.4",
16
16
  "@tailwindcss/forms": "^0.5",
17
17
  "@tailwindcss/typography": "^0.5",
@@ -24,12 +24,12 @@
24
24
  "fslightbox": "^3.2.2",
25
25
  "postcss": "^8.4",
26
26
  "postcss-import": "^16",
27
- "postcss-loader": "^7",
27
+ "postcss-loader": "^8",
28
28
  "sass": "^1.68",
29
29
  "sass-loader": "^16",
30
30
  "simple-jekyll-search": "^1.9.1",
31
31
  "tailwindcss": "^3",
32
- "tailwindcss-animated": "^1.1",
32
+ "tailwindcss-animated": "^2",
33
33
  "tailwindcss-hero-patterns": "^0.1",
34
34
  "tailwindcss-multi-column": "^1.0.2",
35
35
  "webpack": "^5.94",
package/src/helpers.js CHANGED
@@ -21,18 +21,18 @@ import 'regenerator-runtime/runtime'
21
21
  *
22
22
  * @param {string} attribute
23
23
  */
24
- export function liveBlock(liveBlockAttribute = 'data-live', liveFormSelector = '.live-form') {
24
+ export function liveBlock(liveBlockAttribute = 'live', liveFormSelector = '.live-form') {
25
25
  var btnToBlock = function (event, btn) {
26
- const liveBlockUrl = btn.getAttribute('src-' + liveBlockAttribute)
26
+ const liveBlockUrl = btn.getAttribute('data-src-' + liveBlockAttribute)
27
27
  if (btn.hasAttribute('data-target') && btn.getAttribute('data-target') == 'parent') {
28
28
  btn = btn.parentElement ?? btn
29
29
  }
30
- btn.setAttribute(liveBlockAttribute, liveBlockUrl)
30
+ btn.setAttribute('data-' + liveBlockAttribute, liveBlockUrl)
31
31
  getLiveBlock(btn)
32
32
  }
33
33
 
34
34
  var getLiveBlock = function (item) {
35
- var url = item.getAttribute(liveBlockAttribute)
35
+ var url = item.getAttribute('data-' + liveBlockAttribute)
36
36
  url = url.startsWith('e:') ? convertShortchutForLink(rot13ToText(url.substring(2))) : url
37
37
  fetch(url, {
38
38
  //headers: { "Content-Type": "application/json", Accept: "text/plain" },
@@ -43,7 +43,7 @@ export function liveBlock(liveBlockAttribute = 'data-live', liveFormSelector = '
43
43
  return response.text()
44
44
  })
45
45
  .then(function (body) {
46
- item.removeAttribute(liveBlockAttribute)
46
+ item.removeAttribute('data-' + liveBlockAttribute)
47
47
  item.outerHTML = body
48
48
  })
49
49
  .then(function () {
@@ -94,12 +94,12 @@ export function liveBlock(liveBlockAttribute = 'data-live', liveFormSelector = '
94
94
  }
95
95
 
96
96
  // Listen data-live
97
- document.querySelectorAll('[' + liveBlockAttribute + ']').forEach((item) => {
97
+ document.querySelectorAll('[' + 'data-' + liveBlockAttribute + ']').forEach((item) => {
98
98
  getLiveBlock(item)
99
99
  })
100
100
 
101
- // Listen button src-data-live
102
- document.querySelectorAll('[src-' + liveBlockAttribute + ']').forEach((item) => {
101
+ // Listen button src-data-live / data-src-live
102
+ document.querySelectorAll('[' + 'data-src-' + liveBlockAttribute + ']').forEach((item) => {
103
103
  item.addEventListener('click', (event) => {
104
104
  if (item.tagName == 'BUTTON') {
105
105
  item.innerHTML = spinner
@@ -124,7 +124,7 @@ export function liveBlock(liveBlockAttribute = 'data-live', liveFormSelector = '
124
124
  * Block to replace Watcher
125
125
  * On $event on element find via $attribute, set attribute's content in element.innerHTML
126
126
  */
127
- export function replaceOn(attribute = 'replaceBy', eventName = 'click') {
127
+ export function replaceOn(attribute = 'data-replaceBy', eventName = 'click') {
128
128
  var loadVideo = function (element) {
129
129
  var content = element.getAttribute(attribute)
130
130
  if (element.classList.contains('hero-banner-overlay-lg') && element.querySelector('picture') && window.innerWidth < 992) {