/
index.html
351 lines (271 loc) · 9.99 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
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>D3Acts</title>
<link href='http://fonts.googleapis.com/css?family=IM+Fell+French+Canon+SC' rel='stylesheet' type='text/css'>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/vader/jquery-ui.css" rel="Stylesheet" />
<style type="text/css">
@font-face{
font-family: "EXL";
src: url('EXL.eot');
src: local("Exocet Light"), url('EXL.ttf') format("truetype");
}
body{ font: 110% 'IM Fell French Canon SC', serif; font-weight: bold; margin: 20px; background-image:url('fire.jpg');}
td{padding:2px;}
table {border-collapse:collapse;}
.post-score {
padding: 3px 3px 3px 2px;
height: 15px;
line-height: 1.3;
margin-right: 10px;
text-align: center;
min-width: 20px;
}
.progress-bar {
width: 300px;
height:15px;
padding: 5px;
}
.shadowbox {
-moz-box-shadow: 3px 3px 3px 3px #ccc;
-webkit-box-shadow: 3px 3px 3px 3px #ccc;
box-shadow: 3px 3px 3px 3px #ccc;
background-color: #eee;
padding:15px;
}
.tag {
font-size: .9em;
padding: 3px 4px;
margin: 5px;
border-width: 0px 1px 1px 0px;
background-color: white;
color: #666;
border-color: #666;
border-style: solid;
cursor: auto;
text-decoration: none;
line-height: 180%;
}
.small-button { font-size:12px; }
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript" src="../js/api.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/sitelist.js"></script>
<script type="text/javascript" src="../js/jquery.iecors.js"></script>
<script type="text/javascript" src="../js/jquery.cookies.min.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26396490-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript" language="javascript">
var user_site = "gaming";
var user_id = 0;
var api = StackExchangeAPI;
var api_call = StackExchangeAPI.call;
var api_reset_access_token = StackExchangeAPI.reset_access_token;
var api_revoke_access = StackExchangeAPI.revoke_access;
var api_abort_queue = StackExchangeAPI.abort_queue;
var api_init = StackExchangeAPI.init;
var api_auth = StackExchangeAPI.auth
var vote_list_common_args = {pagesize:100, order:'desc', sort:'votes', fromdate: '1337036400' };
var answer_score_dict = {};
function on_answer_question_list_success(json, output_id) {
if(!('items' in json)) {
$('#'+output_id).html("An error occurred...");
return;
}
var output_html = "";
var count = 0;
for(var item_id in json['items']) {
var item = json.items[item_id];
if(!('tags' in item)) continue;
if($.inArray('diablo-3', item.tags) < 0) {
continue;
}
if(!(item.question_id in answer_score_dict[output_id])) continue;
var answer = answer_score_dict[output_id][item.question_id];
var item_path = '/a/'+answer.answer_id+'/'+user_id;
output_html = output_html +
"<span class=\"post-score\">"+answer.score+
'</span> <a target="_blank" href="'+stackexchange_site_array[user_site].site_url+
item_path+'">'+item['title']+"</a><br>\n";
count++;
}
output_html += "<br><br>Total: "+count+"<br>\n";
if(output_html.length) {
$('#'+output_id).html(output_html);
} else {
$('#'+output_id).html("None of your answers are close to this milestone :(");
}
}
function on_answer_list_success(json, output_id) {
if(!('items' in json)) {
$('#'+output_id).html("An error occurred...");
return;
}
var question_id_list = [];
if(!(output_id in answer_score_dict)) {
answer_score_dict[output_id] = {};
}
for(var item_id in json['items']) {
var item = json.items[item_id];
if('question_id' in item) {
question_id_list.push(item.question_id);
}
if('answer_id' in item) {
answer_score_dict[output_id][item.question_id] =
{answer_id:item.answer_id, score:item.score};
}
}
if(question_id_list.length) {
var question_ids = question_id_list.join(";");
var args = $.extend({site: user_site, filter:'!0Zd_)EEBmLz6jqAEaF6x_JEh3'},
vote_list_common_args);
api.call("/questions/"+question_ids, args,
function(json) { on_answer_question_list_success(json, output_id); },
on_error);
} else {
$('#'+output_id).html("None of your answers are close to this milestone :(");
}
}
function on_question_list_success(json, output_id) {
if(!('items' in json)) {
$('#'+output_id).html("An error occurred...");
return;
}
output_html = "";
var count = 0;
for(var item_id in json['items']) {
var item = json['items'][item_id];
var reject = 0;
if(!('tags' in item)) continue;
if($.inArray('diablo-3', item.tags) < 0) {
continue;
}
var item_path = '/q/'+item['question_id']+'/'+user_id;
count++;
output_html = output_html +
"<span class=\"post-score\">"+item['score']+
'</span> <a target="_blank" href="'+stackexchange_site_array[user_site].site_url+
item_path+'">'+item['title']+"</a><br>\n";
}
output_html += "<br>Total: "+count+"<br>\n";
if(count) {
$('#'+output_id).html(output_html);
} else {
$('#'+output_id).html("None of your questions are close to this milestone :(");
}
}
function refresh_all() {
answer_score_dict = {};
api_call("/users/"+user_id+"/questions/",
$.extend({site: user_site, min: '3', max: '4', filter:'!0Zd_)EEBmLz6jqAEaF6x_JEh3'}, vote_list_common_args),
function (json) { on_question_list_success(json, "question_list_bronze") });
api_call("/users/"+user_id+"/questions/",
$.extend({site: user_site, min: '6', max: '7', filter:'!0Zd_)EEBmLz6jqAEaF6x_JEh3'}, vote_list_common_args),
function (json) { on_question_list_success(json, "question_list_silver") });
api_call("/users/"+user_id+"/answers/",
$.extend({site: user_site, min: '3', max: '4', filter:'!mRNa90ViDb'}, vote_list_common_args),
function (json) { on_answer_list_success(json, "answer_list_bronze") });
api_call("/users/"+user_id+"/answers/",
$.extend({site: user_site, min: '6', max: '7', filter:'!mRNa90ViDb'}, vote_list_common_args),
function (json) { on_answer_list_success(json, "answer_list_silver") });
}
function reset_output() {
$("#account").html("(No account information loaded yet)");
$("#question_list_bronze").html('<img src="../common/load.gif">');
$("#question_list_silver").html('<img src="../common/load.gif">');
$("#answer_list_bronze").html('<img src="../common/load.gif">');
$("#answer_list_silver").html('<img src="../common/load.gif">');
}
function clear_output() {
$("#question_list_bronze").html('');
$("#question_list_silver").html('');
$("#answer_list_bronze").html('');
$("#answer_list_silver").html('');
}
function on_auth_success(json) {
if(!('items' in json) || json.items.length == 0) {
$("#account").html('<span style="color:red">You don\'t have an account on this site!</span>');
clear_output();
return;
}
var user = json.items[0];
user_id = user['user_id'];
$("#account").html('<a target="_blank" href="'+stackexchange_site_array[user_site].site_url+'/users/'+user_id+'">'+
user['display_name'] + "</a>");
refresh_all();
}
function on_auth_fail(request, status, error) {
clear_output();
$("#account").html('<span style="color:red">Your access token is invalid or has been revoked! Try getting a new one with the "Reset Access Token" button.</span>');
}
function on_error(request, status, error) {
alert("An error has occurred!");
}
$(document).ready(function() {
var client_id = 74;
var args = {key:encodeURI('tD7YpcY3WuQGUz*f47P21g((')};
$("#refresh").click(function (e) {
api_abort_queue();
reset_output();
api_auth(user_site, on_auth_success, on_auth_fail);
e.preventDefault();
}).button();
$("#token_reset").click(function (e) {
api_abort_queue();
api_reset_access_token(client_id);
e.preventDefault();
}).button();
$("#revoke").click(function (e) {
clear_output();
api_abort_queue();
api_revoke_access();
alert("Your authorization has been revoked.");
e.preventDefault();
});
api_init(client_id, args);
api_auth(user_site, on_auth_success, on_auth_fail);
});
</script>
</head>
<body>
<div class="shadowbox">
<h1 style="font-family: 'EXL', Georgia;">The Journey to Hell & Beyond</h1>
<p>
Your account on Gaming: <span id="account">(No account information loaded yet)</span>
<a href="#" class="small-button" id="refresh">Refresh</a>
<a href="#" class="small-button" id="token_reset">Reset Access Token</a>
</p>
<div class="badgelist">
<h3>Questions close to +5</h3>
<div id="question_list_bronze"><img src="../common/load.gif"></div>
</div>
<div class="badgelist">
<h3>Answers close to +5</h3>
<div id="answer_list_bronze"><img src="../common/load.gif"></div>
</div>
<div class="badgelist">
<h3>Questions close to +8</h3>
<div id="question_list_silver"><img src="../common/load.gif"></div>
</div>
<div class="badgelist">
<h3>Answers close to +8</h3>
<div id="answer_list_silver"><img src="../common/load.gif"></div>
</div>
<hr>
<p>This application uses an "access token" to access your account information
on the StackExchange network. If you'd like, you can <a href="#" id="revoke">revoke</a>
this permission.</p>
<div id="pagefooter"></div>
</div>
</body>
</html>