From 4db5ac324bb0f667fc289b0480250c7d1053154b Mon Sep 17 00:00:00 2001 From: amiceli Date: Tue, 14 Jul 2020 17:47:27 +0200 Subject: [PATCH 01/18] Add default export for initializeShareon. It allows to initialize share button after window.load, for example on SPA dynamic element. --- src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 4634160..e0825ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,7 +44,7 @@ function initShareonChild(child: HTMLElement, preset: PublishPreset) { } } -window.onload = () => { +const initializeShareon = () : void => { const shareonContainers = document.getElementsByClassName('shareon'); for (let i = 0; i < shareonContainers.length; i += 1) { @@ -70,3 +70,7 @@ window.onload = () => { } } }; + +window.onload = () => { initializeShareon(); }; + +export default initializeShareon; From fe31d87512c5f1e926941acc492e78a0ac8c3c91 Mon Sep 17 00:00:00 2001 From: amiceli Date: Wed, 15 Jul 2020 19:00:58 +0200 Subject: [PATCH 02/18] publish temporary version waiting merge pull request on shareon original repo. --- README.md | 92 ++---------------------------------------------- package.json | 8 ++--- rollup.config.js | 20 +++++------ 3 files changed, 17 insertions(+), 103 deletions(-) diff --git a/README.md b/README.md index ec7c904..55f354f 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,7 @@ # shareon -Postal Horn emoji +I'm not shareon maintainer. -Lightweight, stylish and ethical share buttons. +I just publish a specific version waiting my pull request will be merged. -- **Small.** Dependency-free. CSS+JS bundle is only 6 KB minified and gzipped. -- **Stylish.** Uses official vector logos and colors with no visual mess. -- **Ethical.** Embeds no tracking code. JS is required only for the setup. - -shareon example - ----- -Observe the live demo here: [shareon.js.org](https://shareon.js.org) - -## Install - -Include the link to shareon's JS and CSS in your website: - -```html - - -``` - -or install it via NPM use it in a JS file that you will bundle: - -```sh -npm install shareon -# or -yarn add shareon -``` - -```js -require('shareon'); -``` - -## Usage - -> shareon was heavily inspired by [Likely](https://ilyabirman.net/projects/likely/), - and has a backwards-compatible API (excluding themes and sizes). - -Create a container with class `shareon` and populate it with elements, whose -classes match the names of social networks: - -```html -
- - - - - - - - - - - - -
-``` - -If you use ``, the buttons will get a `href`-attribute to them. In other cases -they will get a listener on `click` event, so you can use ` + + + + + + +``` + +If you use ``, the buttons will get a `href`-attribute to them. In other cases +they will get a listener on `click` event, so you can use `