-
Notifications
You must be signed in to change notification settings - Fork 0
/
tumblr.html
284 lines (254 loc) · 5.69 KB
/
tumblr.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Tumblr Cascade</title>
<style type="text/css">
* {
font-size:100%;
}
html, body {
margin:0;
padding:0;
}
body {
overflow-x:hidden;
background:#000;
color:#FFF;
}
#head {
opacity:0.6;
-moz-opacity:0.6;
-webkit-opacity:0.6;
z-index:2500;
font-size:0.8em;
position:fixed;
left:5px;
bottom:5px;
background:#000;
padding:1.5em;
text-align:left;
}
#head h1 {
margin:0;
padding:0;
font-size:2.0em;
}
#head #description {
margin:0;
padding:0.5em 0;
}
#head p {
margin:0;
padding:0;
}
#head a {
color:#FFF;
}
#head a:hover {
color:#FF0;
}
#description {
color:#FFF;
}
.navigation {
font-size:1.5em;
text-align:center;
}
.navigation a {
border-top:2px solid #666;
border-bottom:2px solid #666;
background:#000;
display:block;
padding:0.5em;
color:#FFF;
background:#000;
}
.navigation a:hover {
color:#000;
background:#FF0;
}
.post {
position:relative;
}
.photo {
font-size:3.0em;
}
.quote {
}
.quote blockquote {
margin:0;
padding:1.0em;
font-size:5.0em;
line-height:0.8em;
letter-spacing:-0.11em;
}
.quote .source {
padding:1.0em;
text-align:center;
font-size:0.8em;
}
.quote .source a {
color:#FFF;
}
.video {
padding:50px;
text-align:center;
}
.date {
border-bottom:2px solid #FF0;
font-size:0.5em;
color:#FFF;
background:#000;
padding:1.2em;
}
.date a {
color:#fff;
}
a img {
border:none;
}
.caption {
display:none;
}
#copyright {
position:fixed;
right:2px;
bottom:2px;
color:#FFF;
z-index:2501;
font-size:0.8em;
}
#copyright p {
margin:0;
padding:0;
}
#copyright a {
color:#FFF;
}
#setusername {
font-size:2.0em;
text-align:center;
margin:3.0em auto;
padding:1.0em;
}
#setusername p {
margin:0;
padding:1.0em;
line-height:2.5em;
}
#setusername input {
width:5.0em;
font-size:0.8em;
border:none;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools-yui-compressed.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var username = /tumblr.html\?(.+)/.test(location.href) ? RegExp.$1 : "";
var api_base = "http://#{username}.tumblr.com/api/read/json".replace(/#{username}/, username);
var count = 0;
var callback = null;
function api_callback(data) {
callback(data);
callback = null;
count = count + 50;
};
function api_read(callback) {
if(!window.callback) {
window.callback = callback;
document.getElement('head').appendChild(new Element('script', {
src : api_base + "?callback=api_callback&num=50&start=" + count,
type : "text/javascript"
}));
} else {
api_read.delay(1000, callback);
}
};
function load_nextpage() {
api_read(function(data){
tumblelog = data.tumblelog;
var h1 = document.getElement('h1 a')
h1.innerHTML = tumblelog.title;
h1.set('href', "http://" + username + ".tumblr.com/");
document.getElement('#description').innerHTML = tumblelog.description;
data['posts'].filter(function(post){return post['type'].test(/(photo|quote)/)}).each(function(post){
var post_element = new Element('div').addClass('post');
post_element.appendChild(new Element('div', {text:post['date']}).addClass('date'));
var html = "";
switch(post['type']) {
case 'photo' :
html = $('temp_photo').get('value').replace(/#{imageurl}/g, post['photo-url-highres'] || post['photo-url-500']);
break;
case 'quote' :
html = $('temp_quote').get('value').replace(/#{quote-text}/g, post['quote-text']).replace(/#{quote-source}/g, post['quote-source']);
break;
}
var post_body = new Element('div');
post_body.innerHTML = html;
post_element.appendChild(post_body);
$('posts').appendChild(post_element);
});
});
}
window.addEvent('domready', function() {
if(username) {
$('setusername').destroy();
load_nextpage();
(function () {
window.scrollTo(0, document.getElement('body').getScroll()['y'] + 1);
}).periodical(5);
} else {
$('start').addEvent('click', function() {
location.href = location.href + "?" + $('username').get('value');
});
}
});
window.addEvent('scroll', function(event){
var win_h = document.getElement('body').getSize()['y'];
var total_h = document.getElement('#heightcheck').getSize()['y'];
var a_scroll = document.getElement('body').getScroll()['y'];
if(total_h - a_scroll - win_h < 300) load_nextpage();
});
</script>
</head>
<body>
<div id="heightcheck">
<div id="head">
<h1><a href=""></a></h1>
<div id="description"></div>
</div>
<div id="setusername">
<p>
<input id="username" type="text" size="20">.tumblr.com<br>
<button id="start">Cascade</button>
</p>
</div>
<div id="posts"></div>
<div id="copyright">
<p><a href="/tumblr.html">Tumblr Cascade</a> by <a href="http://twitter.com/closer009">closer</a></p>
</div>
<textarea id="temp_photo" style="display:none;">
<div class="photo" style="background-image:url(#{imageurl})">
<img src="#{imageurl}" alt=""/>
</div>
</textarea>
<textarea id="temp_quote" style="display:none;">
<div class="quote">
<blockquote>#{quote-text}</blockquote>
<div class="source">#{quote-source}</div>
</div>
</textarea>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-333086-9");
pageTracker._trackPageview();
} catch(err) {}</script>
</div>
</body>
</html>