This repository has been archived by the owner on Feb 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
twitter.html
176 lines (160 loc) · 5.17 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html>
<head>
<style rel="stylesheet" type="text/css">
body {
width: 100%;
overflow: hidden;
}
body, * {
margin: 0;
padding: 0;
font-family: "lucida grande",tahoma,verdana,arial,sans-serif;
line-height: 1.28;
font-size: 11px;
color: #666;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
#wrapper {
background: white;
border: 1px solid #ccc;
}
.section {
margin: 10px;
}
.section.header {
margin: 0;
padding-bottom: 10px;
padding: 10px;
background: rgb(249, 248, 238);
border-bottom: 1px solid rgb(239, 235, 224);
}
.section.header span {
font-size: 14px;
font-weight: bold;
}
.section.top .title-and-button {
margin-left: 5px;
vertical-align: top;
display: inline-block;
max-width: 219px;
}
.section.top .title {
display: block;
font-weight: bold;
font-size: 16px;
}
.section.top .description {
color red;
margin-top: 10px;
}
.section.top .logo {
border: 1px solid #ccc;
display: inline-block;
vertical-align: top;
}
.section.top .logo img {
vertical-align: top;
}
.section.top .logo:hover {
text-decoration: none;
}
.section.people p {
margin-bottom: 5px;
}
.section.people {
min-height: 100px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
padding-top: 5px;
}
.section.footer a {
padding-left: 20px;
background: url(http://flattr.com/_img/favicon.ico) no-repeat center left;
display: block;
line-height: 16px;
}
.section.footer {
padding-top: 10px;
border-top: 1px solid #ccc;
}
</style>
</head>
<body>
<div id="wrapper">
<div class="section header">
<span>Support with microdonations</span>
</div>
<div class="section top">
<a class="logo" href="#" target="_blank">
</a>
<div class="title-and-button">
<a class="title" href="#" target="_blank"></a>
<a class="FlattrButton" rev="flattr;button:compact" href="#"></a>
</div>
<div class="description">
</div>
</div>
<div class="section footer">
<a href="https://flattr.com/" target="_blank">Flattr - Social microdonations</a>
</div>
</div>
<script type="text/javascript">
var showHeader = location.href.indexOf('noheader') === -1;
if (!showHeader) {
document.querySelector('.section.header').style.display = 'none';
}
function injectFlattrScript() {
var s = document.createElement('script');
var t = document.getElementsByTagName('script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto&popout=0';
t.parentNode.insertBefore(s, t);
}
function extractScreenNameFromUrl(url) {
var ret = false;
var matches1 = url.match(/screen_name=(.*)&/i);
var matches2 = url.match(/screen_name=(.*)/i);
if (matches1 && matches1.length === 2) {
ret = matches1[1];
} else if (matches2 && matches2.length === 2) {
ret = matches2[1];
}
return ret;
}
var screen_name = extractScreenNameFromUrl(location.href);
var twitterCallback = function(response) {
var twitterUrl = 'https://twitter.com/' + screen_name;
var displayName = screen_name;
if (response.name) {
displayName = response.name + ' (@' + screen_name + ')';
}
if (response.description) {
document.querySelector('.top .description').innerHTML = response.description;
} else {
document.querySelector('.top .description').style.display = 'none';
}
document.querySelector('.top .title').innerHTML = displayName;
document.querySelector('.top .title').setAttribute('href', twitterUrl);
document.querySelector('.top .logo').setAttribute('href', response.profile_image_url);
document.querySelector('.top .FlattrButton').setAttribute('href', twitterUrl);
var img = document.createElement('img');
img.setAttribute('width', '40');
img.setAttribute('height', '40');
img.setAttribute('src', response.profile_image_url);
document.querySelector('.top .logo').appendChild(img);
injectFlattrScript();
};
var script = document.createElement('script');
script.src = 'https://api.twitter.com/1/users/show.json?screen_name=' + screen_name + '&include_entities=false&callback=twitterCallback';
script.async = true;
document.getElementsByTagName('head')[0].appendChild(script);
</script>
</body>
</html>