setup for fediverse script changed
All checks were successful
/ weblog.lol (push) Successful in 12s

This commit is contained in:
Gordon Pedersen 2024-05-11 09:01:03 +10:00
parent 535e9451a8
commit 3005376521
4 changed files with 21 additions and 19 deletions

View file

@ -25,7 +25,10 @@
</aside>
<i data-emoji="{emoji}"></i>
{body}
<aside class="post-info"><a class="status_url" href="{status_url}"><i class="omg-icon omg-prami"></i> via status.lol</a><a class="external_url" href="{external_url}"><i class="omg-icon omg-fediverse"></i> Reply on the Fediverse</a></aside>
<aside class="post-info">
<a class="status_url" href="{status_url}"><i class="omg-icon omg-prami"></i> via status.lol</a>
<a class="external_url" href="{external_url}"><i class="omg-icon omg-fediverse"></i> Interact on the Fediverse</a>
</aside>
<aside class="post-tags">
{tags}
</aside>
@ -44,18 +47,13 @@
</footer>
<script src="https://cdn.jsdelivr.net/npm/luxon/build/global/luxon.min.js" crossorigin="anonymous"></script>
<script src="/share.js"></script>
<script src="/fediverse.js"></script>
<script>
document.querySelectorAll('time:not(.dt-start):not(.dt-end)').forEach(time => {
const datetime = luxon.DateTime.fromISO(time.getAttribute('datetime'))
time.innerText = datetime.toRelative()
});
document.querySelectorAll("a.external_url:not([href='{external_url}'])").forEach(el => {
el.addEventListener('click', e => {
e.preventDefault()
share(el.href)
})
})
fediverse()
</script>
</body>

View file

@ -1,8 +1,8 @@
/*/
Type: file
Content-Type: application/javascript
Title: Share script
Location: /share.js
Title: Fediverse script
Location: /fediverse.js
/**/
const SUBSCRIBE_LINK_REL = 'http://ostatus.org/schema/1.0/subscribe'
@ -39,4 +39,13 @@ function share(uri, handle) {
throw 'Please enter your fediverse address in @user@domain.social format'
}
}
}
function fediverse() {
document.querySelectorAll("a.external_url:not([href='{external_url}'])").forEach(el => {
el.addEventListener('click', e => {
e.preventDefault()
share(el.href)
})
})
}

View file

@ -36,18 +36,13 @@ Title: Landing Page Template
</footer>
<script src="https://cdn.jsdelivr.net/npm/luxon/build/global/luxon.min.js" crossorigin="anonymous"></script>
<script src="/share.js"></script>
<script src="/fediverse.js"></script>
<script>
document.querySelectorAll('time:not(.dt-start):not(.dt-end)').forEach(time => {
const datetime = luxon.DateTime.fromISO(time.getAttribute('datetime'))
time.innerText = datetime.toRelative()
});
document.querySelectorAll("a.external_url:not([href='{external_url}'])").forEach(el => {
el.addEventListener('click', e => {
e.preventDefault()
share(el.href)
})
})
})
fediverse()
</script>
</body>

View file

@ -9,7 +9,7 @@ Title: Post Template
{body}
<aside class="post-info">
<a class="status_url" href="{status_url}"><i class="omg-icon omg-prami"></i> via status.lol</a>
<a class="external_url" href="{external_url}"><i class="omg-icon omg-fediverse"></i> Reply on the Fediverse</a>
<a class="external_url" href="{external_url}"><i class="omg-icon omg-fediverse"></i> Interact on the Fediverse</a>
</aside>
<aside class="post-tags">
{tags}