-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
96 lines (79 loc) · 2.93 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.3.0/handlebars.min.js"></script>
<style>
.title { font-size: 2em; margin-right: 0.5em; }
#reviewer td { text-align: center; }
</style>
</head>
<body>
<h1>MozLinks 翻譯米糕松成就榜</h1>
<div id="stats">
<p>
<span class="title">完成率 <span class="perc">0</span> %</span>
<span class="reviewed">0</span> / <span class="all"></span>
</p>
<table id="reviewer">
<tr><td>Reviewer</td><td>完成數/認領數</td><td>完成率</td>
</table>
<ul id="reviewer">
<script id="reviewer-template" type="text/x-handlebars-template">
{{#each owner}}
<tr><td>{{name}}</td><td>{{done}}/{{owned}}</td><td>{{perc}}%</td>
{{/each}}
</script>
</ul>
</div>
<img src="images.jpg" alt="">
<script>
window.getDat = function(data){
window.rvdat = data.feed.entry;
};
$(function(){
window.setTimeout(function(){ location.reload(); }, 60000 * 5);
var entries = window.rvdat;
var len = entries.length - 2;
var owned = 0;
var owner = {};
var reviewed = 0;
// ["id", "updated", "category", "title", "content", "link", "gsx$_cn6ca", "gsx$articletitle", "gsx$articledate", "gsx$status", "gsx$owner", "gsx$reviewstatus", "gsx$publishurl"]
entries.forEach(function(row, i){
if (i < 2) return;
var own = row.gsx$owner.$t.trim();
if (own.length){
if (!owner[own]) {
owner[own] = { owned: 0, done: 0 };
};
owner[own].owned += 1;
};
if (row.gsx$owner.$t) owned += 1;
if (row.gsx$reviewstatus.$t == 'v') {
reviewed += 1;
if (own.length) owner[own].done += 1;
};
});
var $stat = $('#stats');
$stat.find('.perc').text(Math.round(reviewed/len * 1000)/10);
$stat.find('.reviewed').text(reviewed);
$stat.find('.all').text(len);
var source = $("#reviewer-template").html();
var reviewerhbs = Handlebars.compile(source);
var owners = [];
for (user in owner){
owner[user].name = user;
owner[user].perc = Math.floor( owner[user].done / owner[user].owned * 1000) / 10;
owners.push(owner[user]);
};
ownerDat = { owner: owners};
ownerDat.owner.sort(function(a, b){
return a.done < b.done;
});
$stat.find('#reviewer').append(reviewerhbs(ownerDat));
});
</script>
<script type="text/javascript" src="//spreadsheets.google.com/feeds/list/1xW2g3aE_3Bd9wZ5wiwTy3Kor861W6B9Kj8W7ZR9G1O4/2/public/values?alt=json-in-script&callback=getDat"></script>
</body>
</html>