forked from malkaroy-vrrp/bananocalculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
323 lines (296 loc) · 11.5 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
<html lang="en">
<head>
<title>F@H Points-to-Banano Calculator</title>
<meta name="description" content="There is no conversion rate. There is no ratio. This is how many Banano you'll get for your points. Stop asking. This is it. Bookmark this so you'll never have to look for it again." />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://d3js.org/d3.v3.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"></head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FSYSR80F3P"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-FSYSR80F3P');
</script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js">
</script>
<body onload="createTable('infoTable')">
<div class="container-fluid" style="width:90%;">
<div class="row">
<div class="col-sm-8">
<h1>F@H Points-to-Banano Calculator <small>"There Is No Ratio"</small>
</h1>
<div class="row">
<div class="col-sm-2">
<label class="col-2 col-form-label">
<select id="pointsMode" class="form-control" oninput="updateValues()">
<option value="ppd">Points Per Day</option>
<option value="pp">Pending Points</option>
</select>
</label>
<div class="col-2">
<input class="form-control" type="number" min="0" step="1000" value="0" id="pendingpoints" oninput="updateValues()">
</div>
<div class="col-2">
<label class="col-2 col-form-label">Hours Per Work Unit</label>
<input class="form-control" type="number" min="0.1" step="0.1" value="0.1" id="foldduration" oninput="updateValues()">
</div>
</div>
<div class="col-sm-2">
<h2 align="center">
<span id="roofOutput">???</span>
<br>
<small><b>Ceiling Payout</b></small>
</h2>
<p align="center">This is the highest payout for someone within 5% of your pending points.</p>
</div>
<div class="col-sm-3">
<h2 align="center">
<span id="averageOutput">???</span>
<br>
<small><b>Average Payout</b><br></small>
</h2>
<p align="center">This is the average payout for someone within 5% of your pending points.</p>
</div><div class="col-sm-3">
<h2 align="center">
<span id="medianOutput">???</span>
<br>
<small><b>Median Payout</b></small>
</h2>
<p align="center">This is the median payout for someone within 5% of your pending points.</p>
</div>
<div class="col-sm-2">
<h2 align="center">
<span id="floorOutput">???</span>
<br>
<small><b>Floor Payout</b></small>
</h2>
<p align="center">This is the lowest payout for someone within 5% of your pending points.</p>
</div>
</div>
<div class="row">
<h2><small>Other Things To Know</small></h2>
<ul>
<li><b><span id='lowpointswarning' style="color:red"></span><span id="text">All numbers displayed are in BAN per Day.</span> The total number of Folders who were paid last cycle within 5% of your Points is <span id="rangepopulation">0</span>.</b></li>
<li>The data being displayed is based on the latest payout data (Refer to the table on the right). "Pending Points" are the points you have accumulated since the last time you were paid by BananoMiner. You can find out how many pending points you have by going to <a href="https://www.nanners.cc/">Nanners.cc</a>. "Points Per Day" calculations are done on the assumption that the points are evenly distributed among the 2, 12-hour pay periods that typically happen in one day.</li>
<li>(*) Number in parentheses are included in the number of Folders Paid. They are Folders who were paid 0 BAN for their work. It was an error that has since been fixed. The table outlining the statistics of recent payouts may contain inaccuracies.</li>
</ul>
<p>If you'd like to donate some BAN, click <button class="btn" onclick="addressToClipboard()">here</button> to copy my BAN address to your clipboard.
</div>
<canvas id="myChart" style="width:80%;"></canvas>
</div>
<h2><small>Folders Within 5% Of Input Points</small></h2>
<div class="col-sm-4" style="height:45%; overflow-y:scroll;">
<table class="table table-striped">
<thead>
<tr>
<th>Username</th>
<th>Points</th>
<th>Payout</th>
</tr>
</thead>
<tbody id="payoutTable">
</tbody>
</table>
</div>
<h2><small>BananoMiner.com BAN Distribution History</small></h2>
<div class="col-sm-4" style="height:45%; overflow-y:scroll;">
<table class="table table-striped">
<thead>
<tr>
<th>Payout</th>
<th>BAN Distributed</th>
<th>Folders Paid*</th>
</tr>
</thead>
<tbody id="infoTable">
</tbody>
</table>
</div>
</div>
</div>
<script>
let Everything = [];
d3.csv("scrapes/latest.csv", function(data) {
for (var i = 1; i < data.length; i++) {
Everything.push(data[i]);
}
// populate data from search params once CSV data loaded
let params = new URLSearchParams(window.location.search);
if (params.get("mode") && params.get("points")) {
updateValuesInternal(params.get("mode"), params.get("points"));
pointsModeElement.value = params.get("mode");
pendingPointsElement.value = params.get("points");
}
});
//let infoTableArray = []
let pendingPointsElement = document.getElementById("pendingpoints");
let banPriceElement = document.getElementById("banprice");
let pointsModeElement = document.getElementById("pointsMode");
let foldDurationElement = document.getElementById("foldduration");
let withinRangeArray = [];
$(document).ready(function(){
$('[data-toggle="popover"]').popover();
});
function updateValues() {
updateValuesInternal(pointsModeElement.value, pendingPointsElement.value);
}
function updateValuesInternal(pointsMode, pendingPoints) {
if (pointsMode == "pp") {
pendingPoints = parseFloat(pendingPoints);
} else if (pointsMode == "ppd") {
pendingPoints = parseFloat(pendingPoints) / 2;
};
if(pendingPoints >= 3000){
let withinRangeList = [];
withinRangeArray = [];
for (var i = 0; i < Everything.length; i++) {
if(Math.abs(parseFloat(Everything[i]['points']) - pendingPoints) <= (pendingPoints * 0.05)){
withinRangeArray.push([Everything[i]['username'], Everything[i]['points'], Everything[i]['payout']]);
withinRangeList.push(parseFloat(Everything[i]['payout']));
}
}
console.log("Payouts of everyone within 5% of Points");
console.log(withinRangeList);
var floorOutput = Math.min(...withinRangeList);
var roofOutput = Math.max(...withinRangeList);
var averageOutput = 0;
for(var i = 0; i < withinRangeList.length; i++){
averageOutput += withinRangeList[i];
}
averageOutput = averageOutput / withinRangeList.length;
var medianOutput = withinRangeList.sort()[Math.floor(withinRangeList.length/2)];
var rangepopulation = withinRangeList.length;
} else {
var floorOutput = 0;
var roofOutput = 0;
var averageOutput = 0;
var medianOutput = 0;
var rangepopulation = 0;
}
if(foldDurationElement.value > 12 && pointsMode == "ppd"){
document.getElementById("lowpointswarning").innerHTML = "Payouts occur every 12 hours. Completing a Work Unit less often than this means you will not be included in all payouts.";
averageOutput = (averageOutput * (12 / foldDurationElement.value));
medianOutput = (medianOutput * (12 / foldDurationElement.value));
roofOutput = (roofOutput * (12 / foldDurationElement.value));
floorOutput = (floorOutput * (12 / foldDurationElement.value));
} else {
document.getElementById("lowpointswarning").innerHTML = "";
}
if(pointsMode == "ppd"){
averageOutput = averageOutput * 2;
medianOutput = medianOutput * 2;
roofOutput = roofOutput * 2;
floorOutput = floorOutput * 2;
}
createPayTable(withinRangeArray, 'payoutTable')
document.getElementById("averageOutput").innerHTML = averageOutput.toFixed(2) + " BAN";
document.getElementById("medianOutput").innerHTML = medianOutput.toFixed(2) + " BAN";
document.getElementById("roofOutput").innerHTML = roofOutput.toFixed(2) + " BAN";
document.getElementById("floorOutput").innerHTML = floorOutput.toFixed(2) + " BAN";
document.getElementById("rangepopulation").innerHTML = rangepopulation;
if (pointsMode == "ppd") {
document.getElementById("text").innerHTML = "All numbers displayed are in BAN per Day.";
} else {
document.getElementById("text").innerHTML = "All numbers displayed are for one payout. Payouts occur at noon and midnight UTC.";
}
}
//makes an HTML table from the array
function createPayTable(array, elementid) {
var Table = document.getElementById(elementid);
Table.innerHTML = "";
for(var i = 0; i < array.length ; i++){
var row = document.createElement('tr');
row.setAttribute("id", "myTr" + i);
document.getElementById(elementid).appendChild(row);
for(var j = 0; j < array[i].length; j++){
var cell = document.createElement('td');
var content = document.createTextNode(array[i][j]);
cell.appendChild(content);
document.getElementById("myTr" + i).appendChild(cell);
};
};
};
function createTable( elementid) {
//let infoTableArray = [];
d3.csv('scrapes/totals.csv', function(error, infoTableArrayRAW) {
// If error is not null, something went wrong.
if (error) {
console.log(error); //Log the error.
} else {
//Call some other functions that generate the visualization
var infoTableArray = [];
for(var i = 0; i < infoTableArrayRAW.length ; i++){
infoTableArray.push([infoTableArrayRAW[i]['Fold_date'],infoTableArrayRAW[i]['Total_points'],infoTableArrayRAW[i]['Total_Folders']])
};
var Table = document.getElementById(elementid);
Table.innerHTML = "";
for(var i = 0; i < infoTableArray.length ; i++){
var row = document.createElement('tr');
row.setAttribute("id", "myTr" + i);
document.getElementById(elementid).appendChild(row);
for(var j = 0; j < infoTableArray[i].length; j++){
var cell = document.createElement('td');
var content = document.createTextNode(infoTableArray[i][j]);
cell.appendChild(content);
document.getElementById("myTr" + i).appendChild(cell);
};
};
var xValues = [];
var payoutValues = [];
var folderValues = [];
for(var i = 0; i <= 60; i++){
xValues.push(infoTableArray[i][0]);
payoutValues.push(infoTableArray[i][1]);
folderValues.push(infoTableArray[i][2]);
}
xValues = xValues.reverse();
payoutValues = payoutValues.reverse();
folderValues = folderValues.reverse();
new Chart("myChart", {
type: 'line',
data: {
labels: xValues,
datasets: [{
label: 'BAN Distributed',
yAxisID: 'A',
data: payoutValues,
borderColor: "yellow",
fill: true
}, {
label: 'Number of Folders',
yAxisID: 'B',
data: folderValues,
borderColor: "orange",
fill: true
}]
},
options: {
scales: {
yAxes: [{
id: 'A',
type: 'linear',
position: 'left',
}, {
id: 'B',
type: 'linear',
position: 'right'
}]
}
}
});
}
});
};
function addressToClipboard(){
var promise = navigator.clipboard.writeText('ban_3r7xbz8u5wj4wgkhmojzq6mmiq7ekawtarnfgwsneeck8ktn6zy58ax3ejkn');
};
</script>
</body>
</html>