forked from thatswhatyouget/tpp-progress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
catch-report.html
180 lines (171 loc) · 9.4 KB
/
catch-report.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
<html>
<head>
<title>TPP Progress Chart - Catch Report</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.7.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.6.0/react-dom.min.js"></script>
<script src="transforms/tpp-transforms.js"></script>
<script src="bin/tpp-structure.js"></script>
<script src="bin/twitch-videos.js"></script>
<script src="bin/tpp-progress.js"></script>
<script src="bin/tpp-scraper.js"></script>
<script src="bin/tpp-data.js"></script>
<script src="display/tpp-display.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/tpp-progress.css" />
<link rel="stylesheet" href="css/pokemon.css" />
<link rel="icon" href="img/icon.png" type="image/png">
<link rel="shortcut icon" href="img/icon.png" type="image/png">
<meta property="og:title" content="TPP Progress Chart" />
<meta property="og:url" content="http://thatswhatyouget.github.io/tpp-progress/" />
<meta property="og:image" content="http://thatswhatyouget.github.io/tpp-progress/img/icon.png" />
<meta property="og:type" content="website" />
<meta charset="utf-8" />
<style>
.progressChart .run .event[data-label].catchreport {
display:none;
}
.progressChart .run .event[data-label].catchreport.ready {
display:block;
}
.progressChart .run .event[data-label].catchreport,
.progressChart .run .event[data-label].catchreport:hover {
background-color: black;
}
.progressChart .run .event[data-label].catchreport::before,
.progressChart .run .event[data-label].catchreport::after {
content: attr(data-percentage);
border: solid 1px black;
color: black;
background-color: white;
border-radius: 0 0 30px 30px;
font-size: .6em;
height: 25px;
width: 50px;
box-sizing: border-box;
line-height: 15px;
position: absolute;
font-weight: bold;
left: 1px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
transform: translateX(-50%);
bottom: 100%;
z-index: 4;
padding: 0;
transition: margin .2s ease-in-out;
}
.progressChart .run .event[data-label].catchreport::after {
content: attr(data-label);
margin-bottom: 25px;
font-size: 1.15em;
background-color: indianred;
border-radius: 30px 30px 0 0;
line-height: 25px;
}
.progressChart .run .event[data-label].catchreport:hover::after {
margin-bottom: 35px;
}
.progressChart .run .event.catchreport img {
display: none;
width: 0;
height: 0;
}
</style>
</head>
<body>
<div class="title">
<h1>Twitch Plays Pokemon</h1>
<div class="subtitle">
Catch Report
<a href="index.html">See Full Progress Chart</a>
</div>
</div>
<div class="title">
<strong>Progress Chart</strong>
<div class="credits">
<span>Original Design: <a href="https://www.reddit.com/user/jim_needs_me" target="_blank">jim_needs_me</a></span>
<span>Interactive version: <a href="https://www.reddit.com/user/VorpalNorman" target="_blank">VorpalNorman</a></span>
</div>
<div class="credits">
Contributors:
<a href="https://www.reddit.com/user/TheSwordUser" target="_blank">TheSwordUser</a>,
<a href="https://www.reddit.com/user/UDie2day" target="_blank">UDie2day</a>,
<a href="https://www.reddit.com/user/AsterJ" target="_blank">AsterJ,</a>
<a href="https://www.reddit.com/user/Rabbeseking" target="_blank">Rabbeseking</a>,
<a href="https://www.reddit.com/user/Tiesoul" target="_blank">Tiesoul</a>,
<a href="https://www.reddit.com/user/Persona_Alio" target="_blank">valence_d</a>,
<a href="https://www.reddit.com/user/ChezMere" target="_blank">ChezMere</a>,
<a href="https://www.reddit.com/user/T-chan" target="_blank">T-chan</a>,
<a href="https://www.reddit.com/user/yoshord" target="_blank">yoshord</a>, and <a href="https://www.reddit.com/user/Sauzels"
target="_blank">Sauzels</a>
</div>
<div class="credits">
Default sprites are from <a href="http://bulbapedia.bulbagarden.net/" target="_blank">Bulbapedia</a> and <a href="http://twitchplayspokemon.org/"
target="_blank">twitchplayspokemon.org</a>. Pokemon sprites are from <a href="http://pldh.net/dex/sprites/index"
target="_blank">PLDHnet's SpriteDex</a>.
<br/> All custom sprites can be clicked for links to their sources.
</div>
<div class="credits">
<span class="doItLive">Most</span> run data provided by <a href="http://twitchplayspokemon.org/" target="_blank">twitchplayspokemon.org</a>.
</div>
</div>
<div class="charts">
<script>
var day = Math.floor(QueryString.day || 0);
var data = tppData.map(function (c) {
var newC = { Scale: day ? c.Scale == TPP.Scale.Weeks ? c.Scale : TPP.Scale.Days : c.Scale, Name: c.Name, SingularName: c.SingularName, Offset:c.Offset};
if (day) newC.Offset = -(day - 1);
newC.Runs = c.Runs.filter(function (r) { return (!r.Revisit || r.CopyEvents) && (!r.Unfinished || r.Ongoing) && ((r.Scraper && r.Scraper.pokemon) || ((r.DexTotal || !QueryString.fulldex) && r.Events.filter(function (e) { return e.Group == "Pokemon"; }).length)); })
.map(function (r) {
var startFrom = Duration.parse((r.Events.filter(function(e) {
return e.Group == "Hosts" && (!day || Duration.parse(e.Time, r.StartTime).TotalDays < day);
}).sort(function(e) {
return Duration.parse(e.Time, r.StartTime).TotalSeconds;
}).pop() || { Time: 0 }).Time || "2014-01-01T00:00:00Z", r.StartTime).TotalDays;
function countMons(singleDay) {
var mons = r.Events.filter(function(e) { var t = Duration.parse(e.Time, r.StartTime).TotalTime(c.Scale); return e.Group == "Pokemon" && e.Name != "Egg" && (!day || t < day) && (t >= startFrom);});
if (singleDay) {
mons = mons.filter(function(e) { var t=Duration.parse(e.Time, r.StartTime).TotalTime(c.Scale); return t >= singleDay - 1;});
console.log("* On Day " + singleDay + ", " + r.HostName + " caught **" + mons.length + "** Pokémon: " + mons.map(function(m) { return m.Name }).join(", "));
}
return mons.length;
};
r.Ongoing = true;
r.Events.push({
Group: "Catch Report",
Name: countMons(),
Time: Duration.parse(r.Duration, r.StartTime).toString(),
});
var runElement = null;
var realDrawRun = drawRun
drawRun = function (runInfo, run, scale, events) {
if (!runElement && events !== false && runInfo == r) runElement = run;
return realDrawRun(runInfo, run, scale, events);
}
if (day) setTimeout(function() {$(runElement).click(function(e) {if (e.altKey) countMons(day); });},1000);
var realScaleRun = scaleRun;
scaleRun = function(run, ppd) {
if (run == runElement) {
var search = ' .catchreport';
var runDur = Duration.parse(r.Duration, r.StartTime), count = countMons();
var scaleChar = "d";
if (c.Scale == TPP.Scale.Weeks) scaleChar = "w";
$(run).find(search).attr('data-label', count).addClass('ready')
.attr('data-time', !day || runDur.TotalTime(c.Scale) < day ? !day || runDur.TotalTime(c.Scale) >= day - 1 ? runDur.toString() : day - 1 + scaleChar : day + scaleChar)
.attr('data-percentage', r.DexTotal ? count == r.DexTotal ? "100%" : ((count / r.DexTotal) * 100).toFixed(1) + "%" : r.Region == "Denjuu World" ? "Friends" : "Caught");
}
return realScaleRun(run, ppd);
}
return r;
});
return newC;
}).filter(function (c) { return (day ? c.SingularName != "Revisit" : true) && c.Runs.length; });
if (day) globalPpd = 1024;
createCharts(data);
</script>
</div>
<ul class="controls">
<script>drawControls(defaultControls(dayMenu(data)));</script>
</ul>
</body>
</html>