GithubHelp home page GithubHelp logo

vaporic / tweetie Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sonnyt/tweetie

0.0 1.0 0.0 622 KB

Simple jQuery Twitter feed plugin

Home Page: sonnyt.com/Tweetie

PHP 72.47% HTML 17.74% JavaScript 9.79%

tweetie's Introduction

Tweetie

jQuery Tweetie - Simple Twitter Feed Plugin that works with new Twitter 1.1 API.

#Features

  • Easly template tweets using mustache-like {{date}} syntax
  • Format tweet timestamp using Linux/Unix %d/%m/%Y time formatting syntax
  • Set tweet count
  • Hide replies and only show your own tweets
  • Fetch tweets from a list.

Demo

#Usage New Twitter API requires oAuth Token Key, so it's three step process.

Step 1

First, you need consumer and consumer secret keys. Get them from dev.twitter.com/apps.

Step 2

Edit api/config.php file and replace variables with your Consumer and oAuth Keys.

    // Consumer Key
    define('CONSUMER_KEY', 'CONSUMER_KEY_HERE');
    define('CONSUMER_SECRET', 'CONSUMER_SECRET_HERE');

    // User Access Token
    define('ACCESS_TOKEN', 'ACCESS_TOKEN_HERE');
    define('ACCESS_SECRET', 'ACCESS_SECRET_HERE');

Step 3

Initlize just like any other plugin.

$('.tweet').twittie();

#Options

Option Default Description
username null Option to load tweets from another account or list owner's username.
list null List name to load tweets from. If you define list name you also must define the username of the list owner in the username option.
hashtag null Option to load tweets with a specific hashtag.
count 10 Number of tweets you want to display.
hideReplies false Set true if you want to hide "@" replies as well. Or leave it false to just to show your tweets and no replies.
dateFormat %b/%d/%Y Your date forma, refernce this table for available formats.
template {{date}} - {{tweet}} Format how you want to show your tweets. Feel free to add HTML, see this table for more refrence.
apiPath /api/tweet.php Path to your tweet.php file.

If you want to fetch tweets from a specific Twitter list, you must define the list name in the list option and username of the list owner.

Callback

It's very easy to add callback function, for example:

$('.tweet').twittie(function() {
	alert('loaded!');
});

If you have options defined, than callback function is placed as a second parameter, for example:

$('.tweet').twittie({
	'count': 1,
	'hideReplies': true
}, function() {
	alert('loaded!');
});

Templating

For now only two templating variables are available, more coming soon. You add as many HTML elements as you would like.

Template Description
{{tweet}} Tweet content
{{date}} Formatted tweet date
{{avatar}} User's Avatar Image
{{url}} Direct URL to the tweet
{{retweeted}} Returns true or false if tweet is retweeted
{{screen_name}} Screen name of person who posted the tweet
{{user_name}} Username of person who posted the tweet

Date Format

Format Description
%d Date, 1,2,3...
%m Month number 1,2,3...
%b Abbreviated month Jan, Feb, Mar...
%B Full month January, February, March...
%y Last two digits of year, 11,12,13...
%Y Full year 2011, 2012, 2013...

So, the default %b/%d/%Y would output as Feb/22/2013

tweetie's People

Contributors

sonnyt avatar jenbuzz avatar julienmelissas avatar brunobatista avatar chrisschramm avatar nazarkinroman avatar tobiasartz avatar

Watchers

Hugo Epinosa 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.