-
Notifications
You must be signed in to change notification settings - Fork 1
/
twitter.html
84 lines (73 loc) · 2.42 KB
/
twitter.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Twitter widget</title>
<style>
body.collapsed{margin:0; padding: 0;}
canvas{width:100%;}
</style>
</head>
<body>
<script src="utils.js"></script>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<script>
var a = document.createElement("a"),
params = {};
user = getParameterByName("user"),
list = getParameterByName("list"),
user = user? user : "hhkaos",
list = list? list : null;
// https://developer.twitter.com/en/docs/twitter-for-websites/timelines/guides/parameter-reference
var paramList = ["show-replies", "chrome", "theme", "width", "height", "tweet-limit", "link-color", "border-color", "aria-police", "dnt"];
var l = paramList.forEach(function(elem, i){
var paramValue = getParameterByName(elem);
if(paramValue){
try{
params[elem]= eval(paramValue);
}catch(e){
params[elem] = paramValue;
}
}
})
if(getParameterByName("collapsed")){
document.querySelector('body').className="collapsed"
}
window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));
if(user && list){
timelineParams = {
sourceType: "list",
ownerScreenName: user,
slug: list
}
}else{
timelineParams = {
sourceType: "profile",
screenName: user
}
}
twttr.ready(function (twttr) {
twttr.widgets.createTimeline(
timelineParams,
document.getElementById("container"),
params
);
});
</script>
<div id="container"></div>
</body>
</html>