All Projects → globocom → Share Bar

globocom / Share Bar

Licence: mit
A pure JS plugin to generate a share bar for social media, used by Globo.com.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Share Bar

Socioboard 4.0
Socioboard is world's first and open source Social Technology Enabler. Socioboard Core is our flagship product.
Stars: ✭ 475 (+200.63%)
Mutual labels:  social-network, social-media
Simplesharingbuttons
Share to Facebook, Twitter, Google+ and other social networks using simple HTML buttons.
Stars: ✭ 147 (-6.96%)
Mutual labels:  share, social-media
Twtxt
📕 twtxt is a Self-Hosted, Twitter™-like Decentralised microBlogging platform. No ads, no tracking, your content, your data!
Stars: ✭ 486 (+207.59%)
Mutual labels:  social-network, social-media
Aardwolf
Powering connected social communities with open software.
Stars: ✭ 379 (+139.87%)
Mutual labels:  social-network, social-media
Reddit Detective
Play detective on Reddit: Discover political disinformation campaigns, secret influencers and more
Stars: ✭ 129 (-18.35%)
Mutual labels:  social-network, social-media
Goodshare.js
🚀 А useful modern JavaScript solution for share a link from your website to social networks or mobile messengers. Easy to install and configuring on any of your website!
Stars: ✭ 420 (+165.82%)
Mutual labels:  share, social-network
Dfw1n Osint
Australian Open Source Intelligence Gathering Resources, Australias Largest Open Source Intelligence Repository for Cyber Professionals and Ethical Hackers
Stars: ✭ 63 (-60.13%)
Mutual labels:  social-network, social-media
anon.land
open source Imageboard just like was Voxed.net
Stars: ✭ 16 (-89.87%)
Mutual labels:  social-media, social-network
Klik Socialmediawebsite
Complete PHP-based Login/Registration system, Profile system, Chat room, Forum system and Blog/Polls/Event Management System.
Stars: ✭ 129 (-18.35%)
Mutual labels:  social-network, social-media
Hack The Media
This repo collects examples of intentional and unintentional hacks of media sources
Stars: ✭ 1,194 (+655.7%)
Mutual labels:  social-network, social-media
Cordova qq
A Cordova wrapper around the Tencent QQ SDK for Android and iOS. Provides access to QQ ssoLogin, QQ Sharing, QQZone Sharing etc.
Stars: ✭ 294 (+86.08%)
Mutual labels:  share, social-network
Dandelion
a diaspora* client for Android
Stars: ✭ 100 (-36.71%)
Mutual labels:  social-network, social-media
Socialhome
A federated social home
Stars: ✭ 282 (+78.48%)
Mutual labels:  social-network, social-media
Snscrape
A social networking service scraper in Python
Stars: ✭ 433 (+174.05%)
Mutual labels:  social-network, social-media
Twitter Cleanup
🛁 Clean-up inactive accounts and bots from your Twitter
Stars: ✭ 275 (+74.05%)
Mutual labels:  social-network, social-media
Happysocialmedia
Microservices Social Media / Network / Chatt, with .net core 2.2, Docker, Implement with Domain Driven Design with all best practices design and architetural patterns as DDD, CrossCutting IoC, SOLID, etc
Stars: ✭ 28 (-82.28%)
Mutual labels:  social-network, social-media
gotosocial
Golang fediverse server.
Stars: ✭ 400 (+153.16%)
Mutual labels:  social-media, social-network
pH4Social
📣 Social Networking Software built with Laravel PHP framework and Bootstrap.
Stars: ✭ 27 (-82.91%)
Mutual labels:  social-media, social-network
Share Selected Text
share selected text on twitter, buffer, and some others. Inspired by medium.com
Stars: ✭ 64 (-59.49%)
Mutual labels:  share, social-media
Friendica Addons
Addons for Friendica
Stars: ✭ 94 (-40.51%)
Mutual labels:  social-network, social-media

Travis Build Status Coverage Status

share-bar

A pure JS plugin to generate a share bar for social media, used by Globo.com.

Table of Contents

Browser Support

All ✔ 3.6+ ✔ 9+ ✔ 29+ ✔ 5+ ✔

How to Install

Install through NPM:

npm install @globocom/share-bar

How to Use

Once you added the CSS and JS from the plugin on the page, you can simply do:

new ShareBar({'facebookAppId': 'APP_ID'});

APP_ID can be automatically pulled from the page if you're using Facebook meta tags (meta tag open graph), but we strongly recommend you to pass it manually.

Also, place the following markup where you want the share-bar to be:

<div class="share-bar"
    data-title="Content Title"
    data-url="Content URL"
    data-image-url="http://lorempixel.com/1080/700/"
    data-hashtags="#example #sharebar">
</div>

Take a look at our demo.

Options

The plugin also offers a few options for customization.

Selector

Allows to alter the default selector.

Default: .share-bar

new ShareBar({selector: '.meu-seletor'});

Theme

Allows to alter the default theme, using these options: natural, dark, minimal and minimal light.

Default: 'natural'

new ShareBar({theme: 'dark'});

classPopup

Allows to alter the CSS class when opening the share popup windows. This is only necessary when the default class is already in use.

Default: 'share-popup'

new ShareBar({classPopup: 'class-popup'});

buttonWidth

Allows to alter the reserved width for small buttons. This property does not change the actual button width, it only uses it to calculate how many buttons can fit in the share bar.

Default: 34

new ShareBar({buttonWidth: 50});

buttonFullWidth

Allows to alter the reserved width for expanded buttons. This property does not change the actual button width, it only uses it to calculate how many buttons can fit in the share bar.

Default: 110

new ShareBar({buttonFullWidth: 150});

buttonPadding

Allows to alter the reserved left padding for buttons. This property does not change the actual button width, it only uses it to calculate how many buttons can fit in the share bar.

Default: 4

new ShareBar({buttonPadding: 4});

maxSocialButtons

Allows to alter the maximum quantity of social networks visible in the share bar. This is only necessary if you want to show more than 6 social networks in the bar.

Default: 6

new ShareBar({maxSocialButtons: 10});

networks

Allows to alter the visible social networks in the share bar. This is the property you use to show or hide social network buttons in the share bar.

Default:

[
  'facebook',
  'twitter',
  'whatsapp',
  'google',
  'linkedin',
  'pinterest',
  'email'
]

Customize it like this:

new ShareBar({
  'networks': [
    'facebook',
    'twitter',
    function createSampleButton(container, buttonClass) {
      var data = this.getMetadataFromElement(container);
      buttonClass = buttonClass || '';

      this.createButton(
        container, 'sample', buttonClass,
        'http://www.sample.com/sample-sharer.php?u=' + data['url']
      );
    }
  ]
});

Note: The WhatsApp icon is only visible on screens with less than 768px of width and are touch capable.

context

Allows to alter the render context of the bar. This information is sent via utm_medium in the URL. This is useful when you have more than one sharebar on the page and you want to filter the actions on Google Analytics.

Default: 'desktop'

new ShareBar({context: 'mobile'});

campaign

Allows to alter the campaign metadata of the bar. This information is sent via utm_campaign in the URL. This is useful when you have more than one sharebar on the page and you want to filter the actions on Google Analytics.

Default: 'share-bar'

new ShareBar({campaign: 'custom-campaign'});

onCreateBar

A callback that fires when you create the bar. It receives the created bar as a parameter.

Default: function (bar) { return false; }

new ShareBar({
  onCreateBar: function (bar) {
    alert(bar.innerHTML);
  }
});

onCreateButton

A callback that fires after a share button is created. It receives the created button as a parameter.

Default: function (button) { return false; }

new ShareBar({
  onCreateBar: function (button) {
    alert(button.innerHTML);
  }
});

onShare

A callback that fires after a share button is clicked. It receives the clicked button as a parameter.

Default: function (button) { return false; }

new ShareBar({
  onShare: function (button) {
    alert(button.innerHTML);
  }
});

createBar

It's possible to call createBar to create the bar manually anytime you want.

const sharebar = new ShareBar({maxSocialButtons: 10});
sharebar.createBar(document.querySelector('.minha-barra'));

Note: For this to work, you need to have the HTML element shown above with the data-attributes already set.

Contributing

This project depends on NodeJS and NPM.

To install the project dependencies use:

$ make setup

To run the tests:

$ make test

To run a local server for local development use:

$ make run

Icons

The icons used in this project are SVGs embedded in the JavaScript.

Adding more icons to the project:

1 - Add your SVG to the image path

$ mv ~/caminho/da/imagem.svg caminho/do/share/src/img/

2 - Generate the SVG icons again with Grunt

$ grunt icon

3 - Alter the CSS and Fonts to accomplish the desired look

4 - If you want, add a callback function to the button

Version

To generate a new tag version, use this:

$ grunt bump

License

The MIT License (MIT)

Copyright (c) 2019 globo.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].