-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
133 lines (133 loc) · 3.76 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
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
<!DOCTYPE html>
<html>
<head>
<title>Poopipeedia</title>
<link rel="shortcut icon" sizes="16x16 32x32 48x48 96x96" href="poop.ico" />
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" name="viewport">
<script src="jquery-3.1.0.min.js"></script>
<script src="mustache.min.js"></script>
<script>
$( document ).ready( function () {
var offset;
var loadData = function () {
$( '.loading' ).show();
$( '.load-more' ).hide();
var params = {
action: 'query',
list: 'abuselog',
aflfilter: '46',
aflprop: 'ids|details',
afllimit: 50,
format: 'json'
};
if (offset) params.aflstart = offset;
$.get( {
url: 'https://en.wikipedia.org/w/api.php',
data: params,
dataType: 'jsonp'
} ).done( function ( data ) {
data.query.abuselog.forEach( function ( poop ) {
if ( poop.details.added_lines ) {
var view = {
id: poop.id,
article: poop.details.article_text,
username: poop.details.user_name,
timestamp: new Date(
poop.details.timestamp * 1000
).toUTCString().replace( 'GMT', '(UTC)' ),
added_lines: poop.details.added_lines
};
var template = $( '#poop' ).html();
Mustache.parse( template );
var $node = $( 'main' ).append(
Mustache.render( template, view )
);
$node.html(
$node.html().replace( /((?:p+[0o][0o]+p+|po(?:po)+)(?:ers?|ies?|s|ed|ing?)?\s*(?:heads?)?|(p[3e][3e]+)+d?)/ig, '<strong>$1</strong>' )
);
}
} );
offset = data.continue.aflstart;
$( '.load-more' ).show();
$( '.loading' ).hide();
} );
};
$( '.load-more' ).on( 'click', function (e) {
e.preventDefault();
loadData();
} );
loadData();
} );
</script>
</head>
<style type="text/css">
body {
font-family: sans-serif;
}
.header {
height: 60px;
line-height: 60px;
}
footer {
margin: 20px 0 30px;
}
img {
display: inline-block;
height: 50px;
width: 50px;
}
h1 {
display: inline-block;
margin: 0;
vertical-align: top;
}
article {
border-top: solid 1px black;
padding-bottom: 5px;
padding-top: 20px;
}
.added-lines strong {
color: red;
}
</style>
<body>
<header class="header">
<img src="poop.svg" />
<h1>Poopipeedia</h1>
</header>
<main></main>
<script id="poop" type="text/template">
<article>
<header>
<strong>
<a target='_blank' href='https://en.wikipedia.org/wiki/{{ article }}'>
{{ article }}
</a>
</strong>
</header>
<dl>
<dt>Username</dt>
<dd>
<a target='_blank' href='https://en.wikipedia.org/wiki/Special:Contributions/{{ username }}'>
{{ username }}
</a>
</dd>
<dt>Timestamp</dt>
<dd>
<a target='_blank' href='https://en.wikipedia.org/wiki/Special:AbuseLog/{{ id }}'>
{{ timestamp }}
</a>
</dd>
<dt>Change</dt>
<dd class='added-lines'>
{{ added_lines }}
</dd>
</dl>
</article>
</script>
<footer>
<div class="loading">Loading...</div>
<a class="load-more" href="#">Load more</a>
</footer>
</body>
</html>