Update documentation HTML
parent
b7b48837b9
commit
df28dfdd15
376
docs/index.html
376
docs/index.html
|
@ -1,292 +1,144 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="description" content="Lightweight, stylish and ethical share buttons for popular social networks">
|
<meta name="description" content="Lightweight, stylish and ethical share buttons for popular social networks">
|
||||||
<meta name="keywords" content="share buttons, sharing, social networks, share via, share on">
|
<meta name="keywords" content="share buttons, sharing, social networks, share via, share on">
|
||||||
<meta name="author" content="Nikita Karamov">
|
<meta name="author" content="Nikita Karamov">
|
||||||
|
|
||||||
<title>shareon – Lightweight, stylish and ethical share buttons</title>
|
<title>shareon – Lightweight, stylish and ethical share buttons</title>
|
||||||
|
|
||||||
<meta property="og:title" content="shareon">
|
<meta property="og:title" content="shareon">
|
||||||
<meta property="og:url" content="https://shareon.js.org">
|
<meta property="og:url" content="https://shareon.js.org">
|
||||||
<meta property="og:image" content="https://raw.githubusercontent.com/NickKaramoff/shareon/main/assets/banner.png">
|
<meta property="og:image" content="https://raw.githubusercontent.com/NickKaramoff/shareon/main/assets/banner.png">
|
||||||
<meta property="og:description" content="Lightweight, stylish and ethical share buttons for popular social networks">
|
<meta property="og:description" content="Lightweight, stylish and ethical share buttons for popular social networks">
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
<meta name="twitter:creator" content="@NickKaramoff">
|
<meta name="twitter:creator" content="@NickKaramoff">
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://igoradamenko.github.io/awsm.css/css/awsm.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/combine/npm/modern-normalize@1.1.0,npm/simpledotcss@1.0.1,npm/shareon@1.6.2/dist/shareon.min.css">
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/shareon@1.6.2/dist/shareon.min.js" defer></script>
|
||||||
|
|
||||||
<style>
|
|
||||||
.shareon > a:hover {
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:not([disabled]):hover {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<link rel="manifest" href="/site.webmanifest">
|
|
||||||
<link rel="icon" href="/favicon.ico">
|
<link rel="icon" href="/favicon.ico">
|
||||||
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
||||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||||
|
<link rel="manifest" href="/site.webmanifest">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<p>
|
<h1>shareon 📯</h1>
|
||||||
<img src="https://raw.githubusercontent.com/NickKaramoff/shareon/main/assets/logo.svg"
|
<p>Lightweight, stylish and ethical share buttons</p>
|
||||||
alt="shareon logo — the Postal Horn emoji"
|
<nav>
|
||||||
width="64"
|
<a href="https://www.npmjs.com/package/shareon" target="_blank">
|
||||||
height="64">
|
npm
|
||||||
</p>
|
</a>
|
||||||
<h1>shareon</h1>
|
<a href="https://github.com/NickKaramoff/shareon" target="_blank">
|
||||||
<p>Lightweight, stylish and ethical share buttons</p>
|
GitHub
|
||||||
<nav>
|
</a>
|
||||||
<ul>
|
</nav>
|
||||||
<li>
|
</header>
|
||||||
<a href="https://www.npmjs.com/package/shareon" target="_blank">npm</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="https://github.com/NickKaramoff/shareon" target="_blank">github</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<article>
|
<section>
|
||||||
<h2>
|
<p>
|
||||||
<a id="what-is-it" href="#what-is-it" aria-hidden="true"></a>
|
shareon are share buttons for popular social networks.
|
||||||
What is it?
|
</p>
|
||||||
</h2>
|
|
||||||
|
|
||||||
<p>
|
<div class="shareon"
|
||||||
<code>shareon</code> are share buttons for popular social networks.
|
data-title="shareon — lightweight, stylish and ethical share buttons"
|
||||||
</p>
|
style="text-align: center">
|
||||||
|
<a class="facebook">Share</a>
|
||||||
|
<a class="linkedin"></a>
|
||||||
|
<a class="mastodon" data-via="@NickKaramoff@fosstodon.org">Toot</a>
|
||||||
|
<a class="messenger" data-fb-app-id="3619024578167617"></a>
|
||||||
|
<a class="odnoklassniki"></a>
|
||||||
|
<a class="pinterest">Pin</a>
|
||||||
|
<br>
|
||||||
|
<a class="pocket"></a>
|
||||||
|
<a class="reddit"></a>
|
||||||
|
<a class="telegram"></a>
|
||||||
|
<a class="twitter" data-via="NickKaramoff"></a>
|
||||||
|
<a class="viber"></a>
|
||||||
|
<a class="vkontakte">Отправить</a>
|
||||||
|
<a class="whatsapp"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="shareon" data-title="shareon — lightweight, stylish and ethical share buttons"
|
<p>
|
||||||
style="text-align: center">
|
Unlike many other share buttons, shareon are:
|
||||||
<a class="facebook"></a>
|
</p>
|
||||||
<a class="linkedin"></a>
|
|
||||||
<a class="mastodon" data-via="@NickKaramoff@fosstodon.org"></a>
|
|
||||||
<a class="messenger" data-fb-app-id="3619024578167617"></a>
|
|
||||||
<a class="odnoklassniki"></a>
|
|
||||||
<a class="pinterest"></a>
|
|
||||||
<a class="pocket"></a>
|
|
||||||
<a class="reddit"></a>
|
|
||||||
<a class="telegram"></a>
|
|
||||||
<a class="twitter" data-via="NickKaramoff"></a>
|
|
||||||
<a class="viber"></a>
|
|
||||||
<a class="vkontakte"></a>
|
|
||||||
<a class="whatsapp"></a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>
|
<ul>
|
||||||
Unlike many other share buttons, <code>shareon</code> are:
|
<li><b>lightweight</b>, clocking in at around 7 KB gzipped</li>
|
||||||
</p>
|
<li><b>stylish</b>, by having no visual features other than official colours and logos</li>
|
||||||
|
<li><b>ethical</b>, since they do not insert any pesky tracking code</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<ul>
|
<p>
|
||||||
<li><b>lightweight</b>, clocking in at only 6 KB gzipped code (JS+CSS)</li>
|
Upon initialization, shareon just populates the buttons with generated URLS. The speed and easy customization make shareon the perfect choice for your blog, news site, or project page!
|
||||||
<li><b>stylish</b>, by having no visual features other than official colors and logos</li>
|
</p>
|
||||||
<li><b>ethical</b>, since they do not insert any pesky tracking code</li>
|
</section>
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p>
|
<section>
|
||||||
The whole JavaScript code is quick and simple: it only populates the buttons with set up links. The
|
<h2>Get started</h2>
|
||||||
speed
|
<ol>
|
||||||
and easy customization make <code>shareon</code> the perfect choice for your blog, news site or project
|
<li>
|
||||||
page!
|
Include the links to shareon's JS and CSS in your website:
|
||||||
</p>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article>
|
<pre><code><link href="https://cdn.jsdelivr.net/npm/shareon@2/shareon.css"
|
||||||
<h2>
|
|
||||||
<a id="install" href="#install" aria-hidden="true"></a>
|
|
||||||
Install
|
|
||||||
</h2>
|
|
||||||
<p>
|
|
||||||
Include the link to shareon's JS and CSS in your website:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre><code><link href="https://cdn.jsdelivr.net/npm/shareon@1/dist/shareon.min.css"
|
|
||||||
rel="stylesheet">
|
rel="stylesheet">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/shareon@1/dist/shareon.min.js"
|
<script type="module"
|
||||||
type="text/javascript"></script></code></pre>
|
src="https://cdn.jsdelivr.net/npm/shareon@2"></script></code></pre>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Create a container with class <code>shareon</code> and populate it with elements, whose classes match the names of the social networks:
|
||||||
|
|
||||||
<p>or install it via NPM and use it in a JS file that you will later bundle:</p>
|
<pre><code><div class="shareon">
|
||||||
<pre><code>const shareon = require('shareon');</code></pre>
|
<a class="facebook"></a>
|
||||||
<pre><code>import shareon from 'shareon';</code></pre>
|
<a class="linkedin"></a>
|
||||||
</article>
|
<a class="mastodon"></a>
|
||||||
|
<!-- FB App ID is required for the Messenger button to function -->
|
||||||
<article>
|
<a class="messenger" data-fb-app-id="0123456789012345"></a>
|
||||||
<h2>
|
<a class="odnoklassniki"></a>
|
||||||
<a id="initialization" href="#initialization" aria-hidden="true"></a>
|
<a class="pinterest"></a>
|
||||||
Initialization
|
<a class="pocket"></a>
|
||||||
</h2>
|
<a class="reddit"></a>
|
||||||
<p>
|
<a class="telegram"></a>
|
||||||
By default, shareon will initialize every button after page load.
|
<a class="twitter"></a>
|
||||||
It also exports the <code>shareon</code> function, that will let
|
<a class="viber"></a>
|
||||||
you repopulate your buttons with updated information (for example,
|
<a class="vkontakte"></a>
|
||||||
if you changed the page title):
|
<a class="whatsapp"></a>
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre><code>// shareon auto-initializes
|
|
||||||
|
|
||||||
window.title = "Cool new window title";
|
|
||||||
shareon();</code></pre>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
If you want to postpone the initialization, you can import the
|
|
||||||
<code>noinit</code>-version of the package. You'll need to
|
|
||||||
manually call the <code>shareon</code> function when you want the
|
|
||||||
buttons to be initialized:
|
|
||||||
</p>
|
|
||||||
<pre><code><!-- notice the 'noinit' section of the url for JS -->
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/shareon@1/dist/noinit/shareon.min.js"
|
|
||||||
type="text/javascript"></script>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/shareon@1/dist/shareon.min.css"
|
|
||||||
rel="stylesheet">
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
// do something important
|
|
||||||
shareon();
|
|
||||||
</script></code></pre>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
or, if you're using Node:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre><code>const shareon = require('shareon');
|
|
||||||
// or
|
|
||||||
import shareon from 'shareon';
|
|
||||||
|
|
||||||
// do something important
|
|
||||||
shareon();</code></pre>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article>
|
|
||||||
<h2>
|
|
||||||
<a id="usage" href="#usage" aria-hidden="true"></a>
|
|
||||||
Usage
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<aside>
|
|
||||||
<p>
|
|
||||||
<code>shareon</code> was heavily inspired by
|
|
||||||
<a href="https://ilyabirman.net/projects/likely/">Likely</a>,
|
|
||||||
and has a backwards-compatible API
|
|
||||||
</p>
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Create a container with class <code>shareon</code> and populate it with elements, whose classes match
|
|
||||||
the
|
|
||||||
names of social networks:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre><code><div class="shareon">
|
|
||||||
<a class="facebook"></a>
|
|
||||||
<a class="linkedin"></a>
|
|
||||||
<a class="mastodon"></a>
|
|
||||||
<!-- FB App ID is required for the Messenger button to function -->
|
|
||||||
<a class="messenger" data-fb-app-id="0123456789012345"></a>
|
|
||||||
<a class="odnoklassniki"></a>
|
|
||||||
<a class="pinterest"></a>
|
|
||||||
<a class="pocket"></a>
|
|
||||||
<button class="reddit"></button>
|
|
||||||
<button class="telegram"></button>
|
|
||||||
<button class="twitter"></button>
|
|
||||||
<button class="viber"></button>
|
|
||||||
<button class="vkontakte"></button>
|
|
||||||
<button class="whatsapp"></button>
|
|
||||||
</div></code></pre>
|
</div></code></pre>
|
||||||
<div class="shareon">
|
</li>
|
||||||
<a class="facebook"></a>
|
<li>
|
||||||
<a class="linkedin"></a>
|
Refine your buttons with extra parameters:
|
||||||
<a class="mastodon"></a>
|
|
||||||
<a class="messenger" data-fb-app-id="3619024578167617"></a>
|
|
||||||
<a class="odnoklassniki"></a>
|
|
||||||
<a class="pinterest"></a>
|
|
||||||
<a class="pocket"></a>
|
|
||||||
<button class="reddit"></button>
|
|
||||||
<button class="telegram"></button>
|
|
||||||
<button class="twitter"></button>
|
|
||||||
<button class="viber"></button>
|
|
||||||
<button class="vkontakte"></button>
|
|
||||||
<button class="whatsapp"></button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p>
|
<ul>
|
||||||
If you use <code><a></code>, the buttons will get a `href`-attribute to them. In other cases they
|
<li>add <code>data-url</code> to any button to change the shared URL</li>
|
||||||
will get a listener on <code>click</code> event, so you can use <code><button></code>s if you
|
<li>add <code>data-title</code> to any button to change the shared title</li>
|
||||||
wish.
|
<li>you <strong>MUST</strong> add <code>data-fb-app-id</code> to the FB Messenger button to make sharing even possible</li>
|
||||||
</p>
|
<li>add <code>data-media</code> to an Odnoklassniki, Pinterest, or VK button to customize the pinned picture</li>
|
||||||
|
<li>add <code>data-text</code> to a WhatsApp, Mastodon, Telegram, or Viber button to add custom message text</li>
|
||||||
|
<li>add <code>data-via</code> to a Twitter or Mastodon button to mention a user</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<p>
|
Use extra parameters on the whole container or on the specific buttons:
|
||||||
By default, the URL and the title of the page will be used in sharing dialogs. To change this, you can
|
|
||||||
use
|
|
||||||
the <code>data-url</code> and <code>data-title</code> attributes. Use them on the whole container or on
|
|
||||||
the specific buttons:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre><code><div class="shareon" data-url="https://example.com">
|
<pre><code><div class="shareon" data-url="https://example.com">
|
||||||
<a class="whatsapp" data-title="Custom WhatsApp title"></a>
|
<a class="whatsapp" data-title="Custom WhatsApp title"></a>
|
||||||
<a class="twitter" data-title="Custom Twitter title"></a>
|
<a class="twitter" data-title="Custom Twitter title"></a>
|
||||||
</div></code></pre>
|
</div></code></pre>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Go to the <a href="https://github.com/NickKaramoff/shareon#readme">GitHub repo</a> for more detailed documentation!
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
<div class="shareon" data-url="https://example.com">
|
<footer>
|
||||||
<a class="whatsapp" data-title="Custom WhatsApp title"></a>
|
<p>
|
||||||
<a class="twitter" data-title="Custom Twitter title"></a>
|
shareon was created by <a href="https://karamoff.dev/" target="_blank">Nikita Karamov</a> and is licenced under BSD-3-Clause
|
||||||
</div>
|
</p>
|
||||||
|
</footer>
|
||||||
<p>
|
|
||||||
Apart from the URL and title, some networks support extra parameters:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>you <strong>have to</strong> add <code>data-fb-app-id</code> to the FB Messenger button to make sharing even possible</li>
|
|
||||||
<li>add <code>data-media</code> to an Odnoklassniki, Pinterest, or VK button to customize the pinned picture</li>
|
|
||||||
<li>add <code>data-text</code> to a WhatsApp, Mastodon, Telegram, or Viber button to add custom message text</li>
|
|
||||||
<li>add <code>data-via</code> to a Twitter or Mastodon button to mention a user</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Here are all the custom parameters in their glory:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre><code><div class="shareon" data-url="https://example.com/custom-url">
|
|
||||||
<a class="facebook" data-title="Custom Facebook title"></a>
|
|
||||||
<a class="messenger" data-fb-app-id="0123456789012345"></a>
|
|
||||||
<a class="pinterest" data-media="https://picsum.photos/500">Pin</a>
|
|
||||||
<a class="telegram" data-text="Check this out!"></a>
|
|
||||||
<a class="twitter" data-via="MyNickname"></a>
|
|
||||||
<a class="mastodon" data-via="@MyNickname@myserver.social"></a>
|
|
||||||
<a class="whatsapp" data-url="https://my-cool-website.com">Send</a>
|
|
||||||
</div></code></pre>
|
|
||||||
<div class="shareon" data-url="https://example.com/custom-url">
|
|
||||||
<a class="facebook" data-title="Custom Facebook title"></a>
|
|
||||||
<a class="messenger" data-fb-app-id="3619024578167617"></a>
|
|
||||||
<a class="pinterest" data-media="https://picsum.photos/500">Pin</a>
|
|
||||||
<a class="telegram" data-text="Check this out!"></a>
|
|
||||||
<a class="twitter" data-via="MyNickname"></a>
|
|
||||||
<a class="mastodon" data-via="@MyNickname@myserver.social"></a>
|
|
||||||
<a class="whatsapp" data-url="https://my-cool-website.com">Send</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</article>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<footer>
|
|
||||||
<p>by <a href="https://karamoff.dev" target="_blank">Nikita Karamov</a></p>
|
|
||||||
<p>Website built with <a href="https://igoradamenko.github.io/awsm.css/index.html" target="_blank">awsm.css</a>
|
|
||||||
</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<!-- These files are autocopied on build and will be present on the website -->
|
|
||||||
<!-- See https://github.com/NickKaramoff/shareon/blob/main/.github/workflows/node.yml#L29 -->
|
|
||||||
<link href="shareon.min.css" rel="stylesheet">
|
|
||||||
<script src="shareon.min.js" type="text/javascript"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue