.shirtText {
position: absolute;
top: 17%;
left: 0;
width: 100%;
text-align: center;
font-family: 'Black Ops One', cursive;
color: #211d1d;
font-size: 40px;
max-width: 860px;
}@media screen and (min-width: 1100px) {
.shirtText {
top: 19%;
}
}@media screen and (min-width: 1400px) {
.shirtText {
top: 21%;
}
}
TPC Rating: {{ tpcRatingDisplayValue }}%  Points: {{ exercisePoints }}   TPC 24  Gunfight Speed ✓  Fail  PPS {{ tpc24PointsPerSecondDisplay }} Exercise Rating {{ tpc24ShooterPercentageDisplay }}% Hits 
 TPC WB25  Gunfight Speed ✓  Fail  PPS {{ tpcWb40PointsPerSecondDisplay }} Exercise Rating {{ tpcWb40ShooterPercentageDisplay }}%  Hits/Misses  A C D Miss 
window.addEventListener("load", function (event) {
// You can change these values as the par time changes.
let tpc24ParPointsPerSecond = 22.5;
let tpc24PassingPPS = 10;
let tpc24MaxPoints = 120;let tpcWb40ParPointsPerSecond = 9.3;
let tpcWb40PassingPPS = 4;
let tpcWb40MaxPoints = 200;let totalPointsAvailable = 320;
///////////
// Don't edit below
///////////$(".tpcLoader").hide();
$("#app").show();Vue.component('shot-string', {
template: '
String {{ index+1 }} ',
props: ['stringTime', 'index'],
data() {
return {
localStringTime: this.stringTime
}
},
watch: {
localStringTime(value) {
this.$emit('update:stringTime', value);
}
}
});var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!',
tpc24: new Array(3).fill(0),
tpcWb40: new Array(5).fill(0),
tpc24Hits: 0,
tpc24Points: 0,
tpc24PointsPerSecond: 0,
tpc24Percent: 0,
tpc24RawPercent: 0,
tpc24ParPointsPerSecond: tpc24ParPointsPerSecond,
tpc24Passing: false,
tpcWb40HitsA: 0,
tpcWb40HitsC: 0,
tpcWb40HitsD: 0,
tpcWb40HitsM: 0,
tpcWb40Points: 0,
tpcWb40PointsPerSecond: 0,
tpcWB40Percent: 0,
tpcWB40RawPercent: 0,
tpcWb40ParPointsPerSecond: tpcWb40ParPointsPerSecond,
tpcWb40Passing: false,
matchPointsValue: 0,
tpcRatingValue: 0
},
computed: {
// a computed getter
tpc24ShooterPercentage: function () {
if (this.tpc24Hits == 0) {
return 0;
}var time = this.tpc24.reduce(this.add, 0);
this.tpc24PointsPerSecond = parseFloat(((this.tpc24Hits * 5) / time).toFixed(4));
// if(this.tpc24PointsPerSecond >= tpc24PassingPPS){
//     this.tpc24PointsPerSecond = tpc24PassingPPS;
// }
this.tpc24Passing = this.tpc24PointsPerSecond >= tpc24PassingPPS;
this.tpc24RawPercent = this.tpc24PointsPerSecond / this.tpc24ParPointsPerSecond;
this.tpc24Percent = parseFloat((this.tpc24RawPercent * 100).toFixed(2));
if (this.tpc24Percent >= 100) {
this.tpc24Percent = 100;
}this.matchPoints();
this.tpcRating();return this.tpc24Percent;
},
tpcWb40ShooterPercentage: function () {
if (this.tpcWb40HitsA == 0 && this.tpcWb40HitsC == 0 && this.tpcWb40HitsD == 0 && this.tpcWb40HitsM == 0) {
return 0;
}var time = this.tpcWb40.reduce(this.add, 0);
var points = this.tpcWb40HitsA * 5 + this.tpcWb40HitsC * 3 + this.tpcWb40HitsD * 1 + this.tpcWb40HitsM * -10;
this.tpcWb40PointsPerSecond = parseFloat((points / time).toFixed(4));
// if(this.tpcWb40PointsPerSecond >= tpcWb40PassingPPS){
//     this.tpcWb40PointsPerSecond = tpcWb40PassingPPS;
// }
this.tpcWb40Passing = this.tpcWb40PointsPerSecond >= tpcWb40PassingPPS;
this.tpcWb40RawPercent = this.tpcWb40PointsPerSecond / this.tpcWb40ParPointsPerSecond;this.tpcWb40Percent = parseFloat((this.tpcWb40RawPercent * 100).toFixed(2));if (this.tpcWb40Percent >= 100) {
this.tpcWb40Percent = 100;
}
this.matchPoints();
this.tpcRating();
return this.tpcWb40Percent;
},
matchPointsInt() {
return this.matchPointsValue.toFixed(0);
},
exercisePointsRounded() {
var rounded = Math.round(this.tpc24ShooterPercentage + this.tpcWb40ShooterPercentage);
if (rounded >= 200) {
return 200;
} else {
return rounded;
}
},
exercisePoints() {
return this.tpc24ShooterPercentage + this.tpcWb40ShooterPercentage;
},
tpcRatingDisplayValue() {
if (this.tpcRatingValue >= 100) {
return 100;
} else {
return this.tpcRatingValue;
}
},
matchPointsDisplayValue() {
if (this.matchPointsValue >= totalPointsAvailable) {
return totalPointsAvailable;
} else {
return this.matchPointsValue;
}
},
tpc24PointsPerSecondDisplay() {
if (this.tpc24PointsPerSecond >= tpc24ParPointsPerSecond) {
return tpc24ParPointsPerSecond;
} else {
return this.tpc24PointsPerSecond;
}
},
tpc24ShooterPercentageDisplay() {
if (this.tpc24ShooterPercentage >= 100) {
return 100;
} else {
return this.tpc24ShooterPercentage;
}
},
tpcWb40PointsPerSecondDisplay() {
if (this.tpc24PointsPerSecond >= tpcWb40ParPointsPerSecond) {
return tpcWb40ParPointsPerSecond;
} else {
return this.tpcWb40PointsPerSecond;
}
},
tpcWb40ShooterPercentageDisplay() {
if (this.tpcWb40ShooterPercentage >= 100) {
return 100;
} else {
return this.tpcWb40ShooterPercentage;
}
}},
methods: {
add(a, b) {
return a + b;
},
matchPoints: function () {
// (120 * TPC24%) + (200 * TPCWB40%)
var localMatchPoints = ((tpc24MaxPoints * this.tpc24RawPercent) + (tpcWb40MaxPoints * this.tpcWb40RawPercent)).toFixed(4);
if (isNaN(localMatchPoints)) {
localMatchPoints = 0;
}
this.matchPointsValue = localMatchPoints;
},
tpcRating: function () {
var localTpcRating = (this.matchPointsValue / totalPointsAvailable * 100).toFixed(2);
if (isNaN(localTpcRating)) {
localTpcRating = 0;
}
this.tpcRatingValue = localTpcRating;
}
}
})
});