turbolinks opcional
This commit is contained in:
parent
147af78352
commit
ae133915c8
1 changed files with 9 additions and 1 deletions
|
@ -1,7 +1,15 @@
|
|||
---
|
||||
---
|
||||
|
||||
document.addEventListener('{%- if site.turbolinks.enabled -%}turbolinks:load{%- else -%}DOMContentLoaded{%- endif -%}', () => {
|
||||
const loadEvent = () => {
|
||||
try {
|
||||
if (Turbolinks) return 'turbolinks:load'
|
||||
} catch {
|
||||
return 'DOMContentLoaded'
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener(loadEvent(), () => {
|
||||
document.querySelectorAll('.share').forEach(share => {
|
||||
share.addEventListener('click', event => {
|
||||
if (!Navigator.share) return;
|
||||
|
|
Loading…
Reference in a new issue