timeline.html
2.2 KB
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
<html>
<body>
<script>
alert("Hello, world!");
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://oauth.googlecode.com/svn/code/javascript/oauth.js"></script>
<script src="http://oauth.googlecode.com/svn/code/javascript/sha1.js"></script>
<script type="text/javascript">
$(function(){
fn_twitterTimeline();
});
function fn_twitterTimeline(){
var twitterPrm = {
api: 'https://api.twitter.com/1.1/statuses/user_timeline.json',
count:100,
callback:"fn_makedocTwitter",
consumerKey:"Q4xyL4HBupStqkUf3FaKeDlSL",
consumerSecret:"xB9ROWLAPlPW7tntBUsFgVZd9qcaCSDDAo5fFCH1qWg7oAwJLO",
accessToken:"1330868660072660992-0l3jauBmdEP16hXPviH5W1DMS46X9B",
tokenSecret:"zQjx5xtDHam5SUTSndp7uVqsTpbSJiD4OIKL8IYKg1ZtTSZ"
}
var oauthMessage={
method:"GET",
action:twitterPrm.api,
parameters:{
count: twitterPrm.count,
callback:twitterPrm.callback,
oauth_version:"1.0",
oauth_signature_method:"HMAC_SHA1",
oauth_consumer_key:twitterPrm.consumerKey,
oauth_token:twitterPrm.accessToken
}
};
OAuth.setTimestampandNonce(oauthMessage);
OAuth.SignatureMethod.sign(oauthMessage,{
consumerSecret: twitterPrm.consumerSecret,
tokenSecret:twitterPrm.tokenSecret
});
var twJsonpath=OAuth.addToURL(oauthMessage.action,oauthMessage.parameters);
$.ajax({
type:oauthMessage.method,
url:twJsonpath,
dataType:"jsonp",
jsonp:false,
cache:true
});
}
function fn_makedocTwitter(data){
<DIV id="search"></DIV>
var timeLine='';
var text;
var dateObj=new Data;
for(var i=0,len=data.length;i<len;i++){
text=data[i].text;
text=text.replace(/(s?https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:@&=+$,%#]+)/gi,'<a href="$1">$1</a>');
text=text.replace(/@(\w+)/gi,'<a href="http://twiiter.com/search?q=%23$1">#$1</a>');
text.text.replace(/@(\w+)/gi,'<a href="http://twitter.com/$1">@$1</a>');
timeLine+="<p>"+text+"</p><p>"+dateObj+"</p>";
}
$('#div_snstwitter').html(timeLine);
}
</script>
</body>
</html>