# Find formula used on a website's weightlifting calculator

Discussion in 'Programming & Scripting' started by Extreme Realism, Feb 10, 2019 with 1 replies and 371 views.

Messages:
131
Ratings:
16

Replies:
2
Views:
443

Replies:
4
Views:
261

Replies:
3
Views:
273

Replies:
1
Views:
131

Replies:
4
Views:
2,382
3. ### shindaRetiredRetired

Messages:
2,219
Ratings:
1,213
Have fun...

Code:
```           jQuery('#max').keyup(function(){
var output = jQuery('#instructions').html();
var maxr =  parseInt(jQuery('#max').val());
var low = maxr-30;
var high = maxr+70;

var p = new Array();
var pr = new Array();

p[0] = 925;
pr[0] = 2;

p[1] = 885;
pr[1] = 3;

p[2] = 850;
pr[2] = 4;

p[3] = 750;
pr[3] = 6;

p[4] = 650;
pr[4] = 8;

p[5] = 550;
pr[5] = 10;

var counter = 0;

if(maxr > 50) {
jQuery(".entry-content p").slideUp();
//awardAction("pyramid", window.location.href);
for(var x=low; x<high; x = x+10){
counter++;
output += "<div style='float:left;width:168px; margin-right:15px; margin-top:15px;'>";
output += "<div style='border-bottom:solid 1px #666666'><strong>1RM = "+x+"</strong></div>";
for(var t = p.length-1; t>= 0; t--) {
var weight =  Math.round(Math.floor((p[t] * x / 1000))/5)*5;
output += weight + " x " +  pr[t] +  " <span style='font-size:70%'> (" +  (p[t]/10) + "%)</span><br>";
}

var weight =  Math.round(Math.floor((p[3] * x / 1000))/5)*5;
output += weight + " x " +  pr[3] +  " <span style='font-size:70%'> (" +  (p[3]/10) + "%)</span><br>";

output += "</div>";
if(counter % 3 == 0) output += "<br clear='all'><br>";
}

jQuery('#pyramidOutput').html(output);