@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 +1 -1
- package/src/app.css +1 -0
- package/src/clickable.js +22 -8
package/package.json
CHANGED
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
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
|
|