-
Notifications
You must be signed in to change notification settings - Fork 3
/
README
168 lines (133 loc) · 7.43 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# Twitter Feed v1.1.0
by Zachary Kniebel
Twitter Feed is a robust and highly customizable jQuery Twitter plugin for
rendering tweets passed as JSON objects. The plugin was designed with
performance and simplicity in mind, and is completely compatible with
Twitter's API 1.1* (more details, below). The plugin includes several
examples, including the server-side code necessary for making requests to
Twitter, written in both C# and PHP. For those using .NET, Twitter Feed
also comes with the initial commit of my new C# Twitter library, TweetNET.
More details on TweetNET may be found, below.
## TWITTER API 1.1 UPDATE NOTES:
As a result of the new security and authorization requirements that
Twitter included in their API 1.1 update, the support for performing
the actual AJAX request to retrieve a user's tweets has been removed.
Twitter strongly discourages client-side requests with their new API,
as client-side requests would require the exposure of the site's oAuth
secrets. As such, I have included support for supplying a the raw,
unparsed JSON response from Twitter to the plugin, and have provided
both instructions and samples for setting up the necessary account and
application on Twitter, and implementing the plugin with .NET and with
PHP. For updates and instructions, see the SETUP_INSTRUCTIONS file in
the Server-Side Examples directory.
## Features:
- Ability to show/hide Reply, Retweet and Favorite (all shown by
default)
- Ability to show/hide Date of tweet - can also be set to link to the
tweet (shown and rendered as link by default)
- Ability to supply markup to be inserted be inserted before or after
any optional links/date
- Ability to set the order in which optional links will/date be
displayed
- Ability to supply a CSS class to any text/markup rendered, including
the tweet body and all optional links/date
- Ability to specify callback function to be called either when the
function completes, or when each tweet is rendered
- note that any callbacks called when the fuction completes will be
called before the tweet is done loading (AJAX)
- Ability to specify number of tweets to display
## Twitter Feed Options Object
- count : the number of tweets to display
- rawData : the JSON result of the tweet request made to
Twitter (string)
- prepend : markup to insert before the tweet
- append : markup to insert after the tweet
- tweetBodyClass : a CSS class applied to the body of each retrieved
tweet
- date : an object representing optional link settings (see
Dates and Optional Link Settings)
- reply : an object representing optional link settings (see
Optional Link Settings)
- retweet : an object representing optional link settings (see
Optional Link Settings)
- favorite : an object representing optional link settings (see
Optional Link Settings)
- callbackOnEach : if true, the supplied callback function will be
called after each tweet is loaded
- callback : an optional callback function to be called after
each or all tweet(s) have loaded
## Dates
The plugin's included parseTweetDate function parses dates based based
on when the tweet was created, similar to the way Twitter does on their
own site. The date-ranges in the below table represent the time the
tweet was created, relative to the current time. These ranges are used
as conditional rules for parsing the dates in their corresponding
formats.
[Time Since Tweeting] : [Parsed Example]
1 second - 59 seconds : 43 seconds ago
1 minute - 59 minutes : 11 minutes ago
1 hour - 23 hours : 7 hours ago
1 day - XXXXXXXXXX : Feb 23 '12
If these formats are not to your liking, you need only replace the
parseTweetDate functoin with one of your own.
## Optional Link Settings (also applies to date)
Optional link settings are supplied in object literal form. All of the
objects representing optional
link settings have the following properties:
- show : if set to true, the link/date is shown (shown by default)
- cssClass : CSS class to be applied to the link/date
- order : number (zero-based index) indicating when link should be
rendered in ordering
- prepend : HTML markup to be inserted before the link/date
- append : HTML markup to be inserted after the link/date
- link : indicates whether or not the date should link to the tweet
(note: effective on date)
## TweetNET (initial release, only)
TweetNET is a work-in-progress library that I am working on, to better
assist developers in connecting with Twitter via C#. TweetNET IS NOT
REQUIRED for Twitter Feed, but may be useful for those using C# or
.NET, in general. I have included only the initial release in this
project, and will only be updating with bug fixes. The initial release
includes support for the statuses/user_timeline and statuses/show/:id
requests. For future releases, please view TweetNET's official
repository, at https://github.com/zkniebel/TweetNet.
## VERSION AND RELEASE NOTES:
-- added TweetNET v1.0 --
-- merged v1.1 into master --
v1.1.0
- Major modern browsers, IE7+ support
- Improvements to method of ordering optional links
- Updated support for parsing JSON in IE7 and earlier
-- created branch for v1.1 --
-- created branch for v1.0 (version backup) --
v1.0.2 (not named in commit comment)
- (Initial Commit: 2deb4ec6f1aacfc92b178f7e1f11b8b9dae39298)
- Major modern browsers, IE9+ support
- Improvements, optimizations and tweaks post Twitter API 1.1 update
- Example plugin call
v1.0.1 (beta):
- Major modern browsers, IE9+ support
- Twitter API 1.1 support
- Server-side examples, improved documentation
v1.0 (alpha):
- Major modern browsers, IE7+ support
- Twitter API 1.0 support
--------------------------------------------------------------------------
This software is protected under the MIT license, below, and under the
Open Source GPL v3.0 license (http://opensource.org/licenses/GPL-3.0).
Copyright (C) 2013 Zachary Kniebel
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.