2024-05-17 15:25:48 +02: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 ](./images/fsb-640x120.png )
2024-05-17 14:19:39 +02:00
# 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.
```html
< link rel = "stylesheet" href = "./fediverse-share-button/styles.min.css" >
2024-05-17 15:21:24 +02:00
< script src = "./fediverse-share-button/script.min.js" defer class = "fsb-script" > < / script >
2024-05-17 14:19:39 +02:00
```
Note that if you need to change the path at which the `fediverse-share-button` folder is uploaded
3. Add a sharing prompt to your page.
```html
< form class = "fsb-prompt" >
< label > Share with the fediverse< / label >
2024-05-17 15:02:50 +02:00
< div class = "fsb-input-group mb-3" >
< span class = "fsb-input-group-text" > https://< / span >
2024-05-17 14:19:39 +02:00
< input required
type="text"
name="fediverse-domain"
placeholder="mastodon.social"
2024-05-17 15:11:21 +02:00
class="fsb-input fsb-domain"
2024-05-17 14:19:39 +02:00
aria-label="Amount (to the nearest dollar)">
2024-05-17 15:02:50 +02:00
< button class = "fsb-button"
2024-05-17 15:11:21 +02:00
type="submit">< img src = "./fediverse-share-button/icons/mastodon.svg"
2024-05-17 14:19:39 +02:00
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.
```sh
2024-05-17 14:37:57 +02:00
npm install terser -g
npm install minify -g
terser fediverse-share-button/script.js > fediverse-share-button/script.min.js
2024-05-17 14:19:39 +02:00
minify fediverse-share-button/styles.css > fediverse-share-button/styles.min.css
```
## To-do
2024-05-17 15:39:11 +02:00
- Add missing icons, see `icons/todo.txt` .
2024-05-17 14:19:39 +02:00
- Better development workflow.
- Localization.
## Attributions
### Icons
- fediverse.wake.st
- flowbite.com/icons
### JS and CSS code
- https://getbootstrap.com