Showing
1 changed file
with
70 additions
and
0 deletions
... | @@ -8,6 +8,76 @@ alert("Hello, world!"); | ... | @@ -8,6 +8,76 @@ alert("Hello, world!"); |
8 | 8 | ||
9 | </script> | 9 | </script> |
10 | 10 | ||
11 | +<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> | ||
12 | +<script src="http://oauth.googlecode.com/svn/code/javascript/oauth.js"></script> | ||
13 | +<script src="http://oauth.googlecode.com/svn/code/javascript/sha1.js"></script> | ||
14 | +<script type="text/javascript"> | ||
15 | +$(function(){ | ||
16 | + fn_twitterTimeline(); | ||
17 | +}); | ||
18 | + | ||
19 | +function fn_twitterTimeline(){ | ||
20 | + var twitterPrm = { | ||
21 | + api: 'https://api.twitter.com/1.1/statuses/user_timeline.json', | ||
22 | + count:100, | ||
23 | + callback:"fn_makedocTwitter", | ||
24 | + | ||
25 | + consumerKey:"Q4xyL4HBupStqkUf3FaKeDlSL", | ||
26 | + consumerSecret:"xB9ROWLAPlPW7tntBUsFgVZd9qcaCSDDAo5fFCH1qWg7oAwJLO", | ||
27 | + accessToken:"1330868660072660992-0l3jauBmdEP16hXPviH5W1DMS46X9B", | ||
28 | + tokenSecret:"zQjx5xtDHam5SUTSndp7uVqsTpbSJiD4OIKL8IYKg1ZtTSZ" | ||
29 | + | ||
30 | + } | ||
31 | + var oauthMessage={ | ||
32 | + method:"GET", | ||
33 | + action:twitterPrm.api, | ||
34 | + parameters:{ | ||
35 | + count: twitterPrm.count, | ||
36 | + callback:twitterPrm.callback, | ||
37 | + oauth_version:"1.0", | ||
38 | + oauth_signature_method:"HMAC_SHA1", | ||
39 | + oauth_consumer_key:twitterPrm.consumerKey, | ||
40 | + oauth_token:twitterPrm.accessToken | ||
41 | + } | ||
42 | + | ||
43 | + }; | ||
44 | + OAuth.setTimestampandNonce(oauthMessage); | ||
45 | + OAuth.SignatureMethod.sign(oauthMessage,{ | ||
46 | + consumerSecret: twitterPrm.consumerSecret, | ||
47 | + tokenSecret:twitterPrm.tokenSecret | ||
48 | + }); | ||
49 | + | ||
50 | + var twJsonpath=OAuth.addToURL(oauthMessage.action,oauthMessage.parameters); | ||
51 | + | ||
52 | + $.ajax({ | ||
53 | + type:oauthMessage.method, | ||
54 | + url:twJsonpath, | ||
55 | + dataType:"jsonp", | ||
56 | + jsonp:false, | ||
57 | + cache:true | ||
58 | + }); | ||
59 | +} | ||
60 | + | ||
61 | +function fn_makedocTwitter(data){ | ||
62 | + <DIV id="search"></DIV> | ||
63 | + var timeLine=''; | ||
64 | + var text; | ||
65 | + var dateObj=new Data; | ||
66 | + for(var i=0,len=data.length;i<len;i++){ | ||
67 | + text=data[i].text; | ||
68 | + text=text.replace(/(s?https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:@&=+$,%#]+)/gi,'<a href="$1">$1</a>'); | ||
69 | + text=text.replace(/@(\w+)/gi,'<a href="http://twiiter.com/search?q=%23$1">#$1</a>'); | ||
70 | + text.text.replace(/@(\w+)/gi,'<a href="http://twitter.com/$1">@$1</a>'); | ||
71 | + timeLine+="<p>"+text+"</p><p>"+dateObj+"</p>"; | ||
72 | + | ||
73 | + } | ||
74 | + $('#div_snstwitter').html(timeLine); | ||
75 | +} | ||
76 | + | ||
77 | + | ||
78 | +</script> | ||
79 | + | ||
80 | + | ||
11 | </body> | 81 | </body> |
12 | 82 | ||
13 | </html> | 83 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment