Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이해님
/
term-project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Yulim KIM
2020-11-30 16:43:43 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
acc10f38dfc3c38031fb9d472773210ae33f6417
acc10f38
1 parent
3a203ea5
add key (이게 맞는지는 잘모르겠음ㅜ)
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
views/timeline.html
views/timeline.html
View file @
acc10f3
...
...
@@ -8,6 +8,76 @@ 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>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment