diff options
| author | BigCoke233 <hi@guhub.cn> | 2026-01-31 12:14:13 +0800 |
|---|---|---|
| committer | BigCoke233 <hi@guhub.cn> | 2026-01-31 12:14:13 +0800 |
| commit | 6399bc3dd0731e51c768fef34131f546b3f9a47a (patch) | |
| tree | b7104b0d95909d69e973f226fc2034bbca4ffa5e /layouts | |
| parent | 18a6d0b55989910cdefe01e26c8c8f2f5fd68f4f (diff) | |
refactor: bundle fediform.js
Former-commit-id: 2a05c35369a70e5a3df0c08cc1a19ccd0bd02f64
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_partials/posts/fediverse-form.html | 21 | ||||
| -rw-r--r-- | layouts/_partials/scripts.html | 1 |
2 files changed, 1 insertions, 21 deletions
diff --git a/layouts/_partials/posts/fediverse-form.html b/layouts/_partials/posts/fediverse-form.html index f9998d1d..1ddc09a0 100644 --- a/layouts/_partials/posts/fediverse-form.html +++ b/layouts/_partials/posts/fediverse-form.html @@ -1,28 +1,7 @@ {{ if .Params.toot }} - <div class="flex flex-col gap-2"> <h4 class="text-sm font-semibold m-0">{{ T "actionMenu.fediverse" }}</h4> <input type="text" id="fediverse-instance" placeholder="{{ T "actionMenu.fediversePlaceholder" }}" class="text-sm px-2 py-1 border border-neutral-300 dark:border-neutral-600 rounded bg-transparent"> <button onclick="openInFediverse()" class="text-xs px-2 py-1 bg-neutral-200 dark:bg-neutral-600 rounded hover:bg-neutral-300 dark:hover:bg-neutral-500 transition-colors">{{ T "actionMenu.openToot" }}</button> </div> - -<script> -const instanceInput = document.getElementById('fediverse-instance') -const savedInstance = localStorage.getItem("geedeapro.fediInstance") -if (savedInstance) instanceInput.value = savedInstance - -function openInFediverse() { - const instance = instanceInput.value.trim(); - const tootUrl = '{{ .Params.toot }}'; - - let url = tootUrl - if (instance) { - url = 'https://' + instance + '/authorize_interaction?uri=' + encodeURIComponent(tootUrl); - // save instance url to localStorage - localStorage.setItem("geedeapro.fediInstance", instance) - } - window.open(url, '_blank'); -} -</script> - {{ end }} diff --git a/layouts/_partials/scripts.html b/layouts/_partials/scripts.html index 2875f27d..c6f4391d 100644 --- a/layouts/_partials/scripts.html +++ b/layouts/_partials/scripts.html @@ -12,6 +12,7 @@ (resources.Get "js/toc.js") (resources.Get "js/inject-footnotes.js") (resources.Get "js/back2top.js") + (resources.Get "js/fediform.js") }} {{ $articleBundle := $articleJS | resources.Concat "js/article-bundle.js" | minify | fingerprint }} <script src="{{ $articleBundle.RelPermalink }}" integrity="{{ $articleBundle.Data.Integrity }}" defer></script> |
