Giter VIP home page Giter VIP logo

jquery.tweetable.js's Introduction

jquery.tweetable.js

A simple li'l plugin that lets you make site content easily tweetable.

Inspired (and by inspired I mean I stole this) from a recent New York Times article doing the exact same thing.

You can see a demo of the plugin in action here.

Usage

Dependencies

I mean, jquery is in the name and everything ...

The Basics

Using the plugin is super duper easy:

$('[data-tweetable]').tweetable();

That will grab all elements with the data-tweetable attribute and create clickable links out of them. If the attribute in question has a value (e.g. data-tweetable='I love lamp'), the tweet's text will be set to that value; otherwise, it is set to whatever text is within the given element.

(If you're using a selector which is not an attribute, then be sure to set dataAttr so it knows where to pick up the text.)

The links are unstyled by default, but those links also are created with a given class (by default tweetable) so you can style them to your heart's content.

Options

Options are pretty simple, and you can pass them as so:

$('.awesome-text').tweetable({
	via: 'justinmduke'
});

The defaults:

// Defaults
{
	dataAttr: 'data-tweetable',
	linkClass: 'tweetable',
	via: null,
	related: null,
	url: window.location.pathname
}

The first two should be fairly obvious: via, related, and url all correspond to what you're passing to Twitter in terms of data.

jquery.tweetable.js's People

Contributors

chrisvanpatten avatar jmduke avatar

Stargazers

GAURAV avatar  avatar Adam Farnsworth avatar Adrian Martinez avatar Christi Richards avatar Victor avatar Jef Lippiatt avatar Kames Geraghty avatar Julie avatar Filipe Oliveira avatar Eveline Almeida avatar matt knox avatar Dafyd Jones avatar Ajmal Afif avatar makoto avatar Matej Latin avatar Joseph Spens avatar James Pudson avatar Dave Medema avatar Dennis Eusebio avatar Hameed Rahamathullah avatar Jon Goldsmith avatar Andrew Solomon avatar Erick Patrick avatar Lauren Proctor avatar Parker avatar screamwork avatar Miguel avatar Gio avatar  avatar Tyler Reinhard avatar Ricardo Ramírez avatar Jon B avatar Seth J Gore avatar Juanjo Seijas avatar Aurel L. avatar Lucas Timmons avatar Marco Mocca avatar Yousuf Tafhim avatar Liam Chapman avatar Nikita Bayev avatar Neil Cauldwell avatar Ronnin Li avatar 像树一样成长! avatar Nicole avatar Taha Gozutok avatar Carlos Moran avatar Stefaney Roberts avatar ken_c_lo / TAEKO AKATSUKA avatar machida avatar Shinichi Kogai avatar Luis Balam avatar Boris avatar Sebastian Laube avatar CJ Clayton avatar Shenouda Bertel avatar Vamsi Krishna B avatar jibin.hou avatar Cristiano Baptista avatar Devin Halladay avatar David Bustozoni avatar Alexander Khlebnikov avatar Nils Hörrmann avatar Lee avatar Miguel Amaral avatar Jb avatar Marc Abreu avatar Nicholas Frota avatar Shun Yamaguchi avatar Mike Trummer avatar Andy Foster avatar Katie Harron avatar Łukasz Bondarewicz avatar Pierre Abi-aad avatar Tom Sullivan avatar Gab Stehr avatar Rendy Tan avatar Alexis Galbourdin avatar Bruno Rocha avatar Dermot McGuire avatar Pedro Oliveira avatar Gladson avatar Michael Demarais avatar Jepser Bernardino avatar Aniket Pant avatar Jeff Greco avatar Shaw avatar Cortney Robinson avatar Michael Tri avatar Martin Michálek avatar Robert Wade avatar Christian Kessler IV avatar Jiri Melcak avatar  avatar Krzysztof Furtak avatar Igor Petrov avatar Tomáš Musiol avatar Henning Leutz avatar Vio Cassel avatar Sean Goresht avatar

Watchers

Yiannis M avatar James Cloos avatar David Yarde avatar ClassUI avatar Dougal avatar Steph Charbo avatar Kashif Khan avatar José Carlos avatar Lee avatar Tuna Aras avatar Hasan Yasin Türkyılmaz avatar

jquery.tweetable.js's Issues

URL isn't putting in a URL

Perhaps I misunderstand what the URL attribute is for, but my assumption was that whatever the URL attrib. is would be placed as a URL in the Tweet so that, once Tweeted, people will be able to click back to the page.

No matter what I put in "URL", I can't get a link to show up.

If that's not what URL is for, is this something we can see being added?

Add Hashtags

Would be great to be able to add hashtags to the tweet as well. If I try to add a hashtag to the data-tweetable string, my entire quote disappears.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.