npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

share-selected-text

v1.1.5

Published

share selected text on twitter, buffer, stumbleupon, digg, tumblr & reddit. Inspired by medium.com

Downloads

93

Readme

ShareSelectedText.js

share selected text on twitter, buffer, and some others. Inspired by medium.com

share selected text - ShareSelectedText.js

I made this small javascript library for my personal blog, the existing libraries doesn't fit my needs, so I created that one.

ShareSelectedText.js currently support the following social medias & services:

  • twitter
  • buffer
  • reddit
  • stumbleupon
  • tumblr
  • digg
  • linkedin
  • facebook

You can open an issue or follow the contribution guidelines if you want to add another service or social media

Getting started

Add the CSS file (you have to put the dist/fonts directory and the shareSelectedText.min.css file in the same directory)

<link rel="stylesheet" href="dist/shareSelectedText.min.css"/>

Add the Javascript file before body HTML closing tag.

<script src="dist/shareSelectedText.js"></script>

Then, you can init the plugin :

// plugin initialization with default options
shareSelectedText('.my-super-selector', {
    tooltipClass: '',    // cool, if you want to customize the tooltip
    sanitize: true,      // will sanitize the user selection to respect the Twitter Max length (recommended) 
    buttons: [           // services that you want to enable you can add : 
        'twitter',       // - twitter, tumblr, buffer, stumbleupon, digg, reddit, linkedin, facebook
        'buffer'
    ],
    anchorsClass: '',    // class given to each tooltip's links
    twitterUsername: '', // for twitter widget, will add 'via @twitterUsername' at the end of the tweet.
    facebookAppID: '', // Can also be an HTML element inside the <head> tag of your page : <meta property="fb:APP_ID" content="YOUR_APP_ID"/>
    facebookDisplayMode: 'popup', //can be 'popup' || 'page'
    tooltipTimeout: 250  //Timeout before that the tooltip appear in ms
});

Other Builds

Contribution Guidelines

To contribute please consider to respect the following rules:

  • Work in a different branch, well named, based on current develop branch (I personally use git-flow).
  • respect the .erLintrc rules.
  • If you add a new social media or service:
    • add the service or social media SVG icon in dev/icons
    • compile the font using fontcustom install fontcustom the run fontcustom compile in the icons directory, the run gulp build:copy:fonts in project root directory.
    • Don't forget to add service's name and url.
  • small changes are better than huge changes.

And don't forget that you are awesome!

Changelog

  • v1.1.1

    • Make tooltip not clickable when not active (@DustinArmstrong)
  • v1.1.0

  • v1.0.0

    • initial release
  • v1.0.1

    • avoid font icons name conflicts by adding sst- prefix