Categories: CSSScriptWeb Design

Social Sharing Libraray For Popular Social Networks – Ensemble SocialShare

Ensemble SocialShare is a tiny, configurable, multilingual social sharing library for popular social media networks like Facebook, X (Twitter), Messenger, Whatsapp, Telegram, and Linkedin.

Users also have options to share your site info with their friends via Email, Copy Link, and Web Share API.

Table of Contents

Toggle

How to use it:

1. Load the required JavaScript and CSS files in the document.

<link rel="stylesheet" href="./dist/css/ensemble-social-share.css" />
<script src="./dist/js/ensemble-social-share.min.js"></script>

2. Load the iconic font for the social icons.

<link rel="stylesheet" href="iconset.tmp.css" />

3. Create a container to hold the social icons.

<div class="social-share" data-social-share></div>

4. Initialize the Ensemble SocialShare and done.

const element = document.querySelector('.social-share');
new ensemble.SocialShare(element);

5. Config the social sharing component with the following options.

new ensemble.SocialShare(element,{

    // namespace
    ns: 'share',
    fx: true,

    // root element
    root: 'body',

    // default classname
    className: 'social-share',

    // link to share
    // defaults to location.href
    link: '',

    // page title to share
    // defaults to window.title
    title: '',

    // description to share
    description: '',

    // actions to display
    displays: null,

    // action intents
    intents: {
      'facebook': 0,
      'twitter': 0,
      'whatsapp': 1,
      'messenger': 1,
      'telegram': 1,
      'linkedin': 0,
      'send-email': 2,
      'copy-link': 3,
      'web-share': 4
    },

    // URI strings
    uriform: {
      'facebook': 'https://facebook.com/sharer.php?u=%url%',
      'ex': 'https://x.com/share?url=%url%&text=%title%',
      'whatsapp': 'https://api.whatsapp.com/send?text=%text%',
      'messenger': 'fb-messenger://share/?link=%url%&app_id=%app_id%',
      'telegram': 'https://telegram.me/share/url?url=%url%&text=%text%',
      'linkedin': 'https://www.linkedin.com/sharing/share-offsite?mini=true&url=%url%&title=%title%&ro=false&summary=%summary%',
      'send-email': 'mailto:?subject=%subject%&body=%text%'
    },

    // selector to find link
    selectorLink: {
      element: 'link[rel="canonical"]',
      attribute: 'href'
    },

    // selector to find title
    selectorTitle: null,

    // selector to find description
    selectorDescription: {
      element: 'meta[name="description"]',
      attribute: 'content'
    },

    // Custom parameters for label
    label: {},

});

6. Localize the social sharing component.

new ensemble.SocialShare(element,{

    locale: {
      label: 'Share',
      share: 'Share on %s',
      send: 'Send to %s',
      subject: 'An interesting thing',
      text: 'Hi! There is something may interesting you: %s',
      email: 'Send via email',
      copy: 'Copy link',
      copied: 'Copied link!',
      'whatsapp': 'WhatsApp',
      'linkedin': 'LinkedIn',
      'web-share': 'Share'
    },

});

7. Event handlers.

new ensemble.SocialShare(element,{

    onInit: function() {},
    onIntent: function() {}

});

Changelog:

04/12/2025

  • refactor

v0.0.3 (10/03/2023)

  • added ‘ex’ X (Twitter)

The post Social Sharing Libraray For Popular Social Networks – Ensemble SocialShare appeared first on CSS Script.

rssfeeds-admin

Share
Published by
rssfeeds-admin

Recent Posts

DPRK Cyber Spies Infiltrate Global Companies via Fake Job Scams, Sidestepping U.S. Sanctions

Cybersecurity researcher ZachXBT ignited this probe by tying the domain luckyguys[.]site to crypto payments linked…

6 minutes ago

Vercel Confirms Security Breach After Customer Accounts Were Compromised

App hosting platform Vercel has confirmed a security breach after attackers gained unauthorized access to…

6 minutes ago

GitLab Security Update Patches Multiple Vulnerabilities Allowing Session Hijacks

On April 22, 2026, GitLab released security patch versions 18.11.1, 18.10.4, and 18.9.6 for both…

6 minutes ago

Lazarus Hackers Weaponize AI In Sneaky Coding Challenge Attacks On Devs

North Korea-linked Lazarus hackers are using fake coding challenges to infect developers with malware, steal…

7 minutes ago

Hackers Hijack YouTube and Fake Wallpaper App To Unleash notnullOSX Malware Onslaught

A new macOS threat called notnullOSX is being spread through a fake wallpaper app and…

8 minutes ago

Needle Stealer Spreads via Bogus TradingClaw On Fraudulent TradingView Clone

Cybercriminals are exploiting the popularity of TradingView, a leading platform for financial charting and trading…

8 minutes ago

This website uses cookies.