-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
63 lines (63 loc) · 1.38 KB
/
index.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
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<title>Is GallowBoob on the front page of reddit?</title>
<style>
body {
text-align: center;
font-weight: bold;
font-family: sans-serif;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
h1 {
font-size: 2em;
margin-top: 2em;
}
#answer {
font-size: 4em;
text-transform: capitalize;
}
#posts {
padding: 0;
list-style: none;
}
</style>
</head>
<body>
<h1>Is GallowBoob on the front page of reddit?</h1>
<p id="answer">Checking...</p>
<ul id="posts"></ul>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
jQuery(document).ready( function( $ ) {
$.getJSON( 'https://www.reddit.com/r/all/.json?limit=50', function( r ) {
var posts = r.data.children;
var isFront = false;
$.each( posts, function( i, post ) {
var author = post.data.author;
if ( author === 'GallowBoob' ) {
$('#answer').text('yes.');
$('#posts').append(
$('<li>').append(
$('<a>')
.attr('href', 'http://reddit.com' + post.data.permalink)
.text(post.data.title)
)
);
isFront = true;
}
} )
if ( !isFront ) {
$('#answer').text('no.');
}
} );
} );
</script>
</body>
</html>