Cloned repo from GitHub. ⚠️ This is NOT upstream. Use at your own risk https://github.com/stefanbohacek/fediverse-share-button/
Find a file
2024-05-17 09:41:13 -04:00
fediverse-share-button Added Firefish logo. 2024-05-17 09:39:11 -04:00
images Updated thumbnail image. 2024-05-17 09:25:48 -04:00
captain-definition Fixed demo site deployment. 2024-05-17 08:21:42 -04:00
Dockerfile First commit. 2024-05-17 08:19:39 -04:00
index.html Added project link. 2024-05-17 09:22:56 -04:00
LICENSE.md First commit. 2024-05-17 08:19:39 -04:00
README.md Formatted links. 2024-05-17 09:41:13 -04:00

A screenshot of the fediverse sharing prompt, which consists of an input field for domain name and a button with the text "Share" preceded by a Mastodon logo

Fediverse Sharing Button

Let your site's visitors share your work with the fediverse!

Features

  • minimalist design inspired by Bootstrap
  • shows a logo of supported fediverse software
  • lets you share selected text
  • remembers the last fediverse domain used
  • free (as in fediverse) to use!

How to use

  1. Download the files in this repo.
  2. Add the JavaScript code and CSS stylesheet to your page.
<link rel="stylesheet" href="./fediverse-share-button/styles.min.css">
<script src="./fediverse-share-button/script.min.js" defer class="fsb-script"></script>

Note that if you need to change the path at which the fediverse-share-button folder is uploaded

  1. Add a sharing prompt to your page.
<form class="fsb-prompt">
  <label>Share with the fediverse</label>
  <div class="fsb-input-group mb-3">
    <span class="fsb-input-group-text">https://</span>
    <input required
      type="text"
      name="fediverse-domain"
      placeholder="mastodon.social"
      class="fsb-input fsb-domain"
      aria-label="Amount (to the nearest dollar)">
    <button class="fsb-button"
      type="submit"><img src="./fediverse-share-button/icons/mastodon.svg"
        class="fsb-icon"></span>Share</button>
  </div>
  <p class="fsb-support-note fsb-d-none">This server does not support sharing. Please visit <a
      class="fsb-support-note-link"
      target="_blank"
      href=""></a>.</p>
</form>

Development

After making changes to the JS and CSS files, make sure to minify them.

npm install terser -g
npm install minify -g
terser fediverse-share-button/script.js > fediverse-share-button/script.min.js
minify fediverse-share-button/styles.css > fediverse-share-button/styles.min.css

To-do

  • Add missing icons, see icons/todo.txt.
  • Better development workflow.
  • Localization.

Attributions

Icons

JS and CSS code