From 3005376521076766ec185ce571ededa2423586ea Mon Sep 17 00:00:00 2001 From: Gordon Pedersen Date: Sat, 11 May 2024 09:01:03 +1000 Subject: [PATCH] setup for fediverse script changed --- configuration/template.html | 14 ++++++-------- .../B0. Template/{share.js.md => fediverse.js.md} | 13 +++++++++++-- weblog/B0. Template/template-landing-page.html.md | 11 +++-------- weblog/B0. Template/template-post.html.md | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) rename weblog/B0. Template/{share.js.md => fediverse.js.md} (84%) diff --git a/configuration/template.html b/configuration/template.html index ae2e74e..c44145f 100644 --- a/configuration/template.html +++ b/configuration/template.html @@ -25,7 +25,10 @@ {body} - + @@ -44,18 +47,13 @@ - + diff --git a/weblog/B0. Template/share.js.md b/weblog/B0. Template/fediverse.js.md similarity index 84% rename from weblog/B0. Template/share.js.md rename to weblog/B0. Template/fediverse.js.md index df3750c..fce0cb7 100644 --- a/weblog/B0. Template/share.js.md +++ b/weblog/B0. Template/fediverse.js.md @@ -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) + }) + }) } \ No newline at end of file diff --git a/weblog/B0. Template/template-landing-page.html.md b/weblog/B0. Template/template-landing-page.html.md index 3fb44b8..d3076a8 100644 --- a/weblog/B0. Template/template-landing-page.html.md +++ b/weblog/B0. Template/template-landing-page.html.md @@ -36,18 +36,13 @@ Title: Landing Page Template - + diff --git a/weblog/B0. Template/template-post.html.md b/weblog/B0. Template/template-post.html.md index 131af05..5d4d1a1 100644 --- a/weblog/B0. Template/template-post.html.md +++ b/weblog/B0. Template/template-post.html.md @@ -9,7 +9,7 @@ Title: Post Template {body}