Giter Site home page Giter Site logo

ankalago / jquery.tweetparser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vincentloy/tweetparser.js

0.0 2.0 0.0 210 KB

tweetParser.js Parse an element containing a tweet and turn URLS, @user & #hashtags into working urls

License: MIT License

JavaScript 46.42% CSS 27.91% HTML 25.67%

jquery.tweetparser's Introduction

tweetParser.js

Parse Twitter Usernames, Hashtags and URLs Using jQuery tweetParser.js Parse elements containing a tweets and turn URLS, @users & #hashtags into working urls

PARAMETERS

Parameters Type default description
urlClass String tweet_link css Class used for url in the tweet
userClass String tweet_user css Class used for @user profil url in the tweet
hashtagClass String hashtag css Class used for hashtags url in the tweet
target HTML attribute for anchor tags _blank target used for all generated
searchWithHashtags Boolean true generate hashtag link, if true : "twitter.com/hashtag/", if false : "twitter.com/search?q="

INITIALISATION

You can install tweetParser.js with Bower

if you want to use bower just type :

bower install jquery.tweet-parser
Add jquery lib and tweetParser.min.js to your HTML document
    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.tweetParser.min.js"></script>
Your tweet in your html document
    <p class="tweets">This is my awesome text only tweet ! #web #twitter @twitter http://www.twitter.com/ !!</p>
getting started with tweetParser
    //basic usage
    $("p.tweets").tweetParser();
    
    //With parameters
    $("p.tweets").tweetParser({
        urlClass : "tweet_link", //this is default
        userClass : "tweet_user", //this is default
        hashtagClass : "hashtag", //this is default
        target : "_blank", //this is default
        searchWithHashtags : true //this is default
    });

RESULT EXAMPLE

Check out the demo or try it in codepen.io

you can customize your tweet with css classes used in parameters

Result After parsing tweets

Changelog

  • v1.1.0

    • searchWithHashtags parameter added

      You can now choose where hashtags links will point to. when searchWithHastags = true (default), tweetParser will generate the following link for each hashtags : "twitter.com/hashtag/THE_HASHTAG".
      if you set it to false, the link will be : "twitter.com/search?q=THE_HASHTAG"

    • code optimisation, remove useless var.

  • v1.0.0

    Initial Version

jquery.tweetparser's People

Contributors

ankalago avatar vincentloy avatar

Watchers

 avatar  avatar

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.