From 91a862e70d88cecf99e48760043f7143fee717b6 Mon Sep 17 00:00:00 2001 From: stevenhaskell Date: Thu, 1 Nov 2018 13:27:43 -0400 Subject: [PATCH] Updated Progress on script that fixes weights under 5lb heavier than the bar. The script now works but theres an issue when you use the bar weight. Offset displays the bar weight. Still need to investigate. --- ...ght Calculation Script-Edited-Jquery-V4.js | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/js/Weight Calculation Script-Edited-Jquery-V4.js b/js/Weight Calculation Script-Edited-Jquery-V4.js index 0cdbfd9..c7bb394 100644 --- a/js/Weight Calculation Script-Edited-Jquery-V4.js +++ b/js/Weight Calculation Script-Edited-Jquery-V4.js @@ -121,6 +121,17 @@ //animates plates back on animatePlatesIn(); } + // Script for weights under 5lbs heavier then the bar. Still needs tweaking. + var bar = jQuery(".input-bar").val(); + var bartest = parseInt(bar)+4; + if (jQuery(".input-weight").val() <= bartest) { + jQuery(".input-final").html(bar); + var offset = Math.abs(jQuery(".input-weight").val() - bar); + if (jQuery(".input-weight").val() !== bar) { + console.log("FIRED"); + jQuery(".input-difference").text(offset); + } + } } @@ -157,14 +168,9 @@ jQuery(".input-weight").val(bar); jQuery(".input-final").html(bar); } - jQuery(".b-infoentry__reset, .b-platevisual__weightfinal").show(); -/* Script for weights under 5lbs heavier then the bar not working - if (jQuery(".input-weight").val() <= bar+5) { - console.log("fired"); - var offset = jQuery(".input-weight").val() - bar; - jQuery(".input-difference").text(offset); - }*/ + jQuery(".b-infoentry__reset, .b-platevisual__weightfinal").show(); + if (jQuery(".b-platevisual__weightdifference").text() != "Offset: 0 LBS") { jQuery(".b-platevisual__weightdifference").show(); } else {