forked from elocnatsirt/indieracers.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtweetjs.js
30 lines (29 loc) · 1014 Bytes
/
tweetjs.js
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
// TweetJS.com - Display your tweets on your website using Javascript alone
// Copyright 2019 Infinite Loop Development Ltd - InfiniteLoop.ie
// Do not remove this notice.
TweetJs = {
ListTweetsOnUserTimeline : function(screenName, callback) {
TweetJs._callApi({
Action: "ListTweetsOnUserTimeline",
ScreenName: screenName
},
callback);
},
Search: function (query, callback) {
TweetJs._callApi({
Action: "Search",
Query: query
}, callback);
},
_callApi: function (request, callback) {
var xhr = new XMLHttpRequest();
URL = "https://www.tweetjs.com/API.aspx";
xhr.open("POST", URL);
xhr.onreadystatechange = function () {
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
callback(JSON.parse(xhr.response));
}
}
xhr.send(JSON.stringify(request));
}
};