@pushword/js-helper 0.0.129 → 0.0.130

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.129",
3
+ "version": "0.0.130",
4
4
  "description": "Pushword front end helpers. ",
5
5
  "author": "Robin@PiedWeb <contact@piedweb.com>",
6
6
  "license": "MIT",
package/src/app.css CHANGED
@@ -15,6 +15,7 @@ Tailwind content sources for all packages
15
15
  @source "./../../../../vendor/pushword/**/templates/";
16
16
  @source "./../../**/templates/";
17
17
  @source "./../../**/src/templates/";
18
+ @source "./../../**/content/**/*.md";
18
19
  @source "./../../conversation/src/templates/";
19
20
  @source "./../../../../templates";
20
21
  @source "./../../../../var/TailwindGeneratorCache/*";
package/src/clickable.js CHANGED
@@ -1,21 +1,35 @@
1
1
  import { uncloakLinks } from './helpers'
2
2
 
3
3
  /**
4
- * transform an element containing a link (a href) in a clickable element
4
+ * transform an element containing a link (a href) or button in a clickable element
5
5
  *
6
6
  * @param {Object} element
7
7
  */
8
8
  export async function clickable(element) {
9
- if (!element.querySelector('a') && !element.querySelector('span[data-rot]')) return false
10
- if (element.querySelector('span[data-rot]')) await uncloakLinks('data-rot', false)
11
- var link = element.querySelectorAll('a')[0]
12
- if (window.location.pathname.replace(/^\//, '') == link.pathname.replace(/^\//, '') && window.location.hostname == link.hostname) {
13
- if (typeof smoothScroll === 'function') {
14
- smoothScroll(link)
9
+ var link = element.querySelector('a')
10
+
11
+ if (!link && element.querySelector('span[data-rot]')) {
12
+ await uncloakLinks('data-rot', false)
13
+ link = element.querySelector('a')
14
+ }
15
+
16
+ if (link) {
17
+ if (window.location.pathname.replace(/^\//, '') == link.pathname.replace(/^\//, '') && window.location.hostname == link.hostname) {
18
+ if (typeof smoothScroll === 'function') {
19
+ smoothScroll(link)
20
+ }
21
+ return false
15
22
  }
23
+ window.location = link.getAttribute('href') === null ? '' : link.getAttribute('href')
16
24
  return false
17
25
  }
18
- window.location = link.getAttribute('href') === null ? '' : link.getAttribute('href')
26
+
27
+ var button = element.querySelector('button')
28
+ if (button) {
29
+ button.click()
30
+ return false
31
+ }
32
+
19
33
  return false
20
34
  }
21
35