-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
105 lines (67 loc) · 3.86 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
Tweet Display
===========
Tweet Display is a nifty widget, written in MooTools framework, that allows you to pull information via Twitters API
about a certain user. Presents the tweets in a UL-list. You may template the output however you want. However, please
remember that the template's HTML is looped. All data is transfered in JSON/P and is cached on the client using sessionStorage
Download custom built mootools-more from http://mootools.net/more/8b71d9032491a52b5b31d4323243a5c3
How to use
-----------------
Javascript snippet to initialize the class:
window.addEvent("domready", function() {
var TD = new TweetDisplay({
element: document.id("div#tweetdisplay"),
username: "23critters"
});
});
HTML snippet:
<div id="tweetdisplay">
</div>
CSS selector to style the active navigation anchor, eg:
DIV#tweetdisplay {background-color: #ccc;}
Options
-----------------
element: (string||object) Reference to DOM element container. if passing a string, supply the elements' id
actions: (object) A set of "instructions" if you want to pass information from Twitter via different parsers | default: {"text":"linkify", "created_at":"formatdate"}
locale: (string) When you parse the date, define which locale you'd like to use (requires More/Locale/Locale, but is already dependency of Date.js). More information at http://mootools.net/docs/more/Locale/Date
dateformat: (string) A model over how to format the printed date, more information at http://mootools.net/docs/more/Types/Date#Date:format | default: "%Y-%m-%d %H:%M:%S"
count: (integer) How many tweets to pull from Twitters API | default: 5
cachetimer: (integer) How many seconds should the cache be kept before being invalidated (nb! not purged) | default: 3600
cachekey: (string) a identifier for the cache. Good if you want to have different timers for your many TweetDisplays
template: (string) Path to the template containing the HTML | default: "TweetDisplay.html"
username: (string) Username of user from who to fetch information from | default: "23critters"
Methods
-----------------
The following methods are availible publicly:
linkify: takes string and returns http://, ftp://, file:// clickable. Also @usernames and #tags
formatdate: formats date according to specification at http://mootools.net/docs/more/Types/Date#Date:format
clear_cache: clears the cache (sessionStorage)
Version history
-----------------
Version 1.3
* Changed behaviour of clear_cache(). It now only removes keys from the sessionStorage that TweetDisplay has added, sorry for any inconvenience this may have caused
* Added two new options for controlling the cache of TweetDisplay, cachetimer and cachekey
Version 1.2
* Changed method of the request for the HTML template to "get" instead of "post". POST issued error 405 sometimes.
Version 1.1
* Incremented version number just to force Mootools Forge to display latest commit
Version 1.0
* Added cache! Will use sessionStorage in order to cache various requests when applicable.
* Enabled parsing of nested objects. Eg, use can use {{ user.id }} in order to print the user-id
* Please note: the option "actions" has had its keys places switched to [field_to_parse]:[method_to_call]
Version 0.9
* Added ability to format date according to chosen Locale
* Note: I will increment version number to 1.0 when I've resolved bug #1
Version 0.8
* Added the ability to send information from the JSON/P response to various methods, at this time there's only "linkify" and "formatdate"
* Added option to allow formation of dates
* Tweet texts should be linkable. URL, #tags and @usernames
Version 0.1
* First version
Known bugs
-----------------
Known bugs that hopefully will be squashed in future releases
* None atm
Wish list
-----------------
Future features I'd like to implement
* Please create an issue on github if you have any nifty ideas!