From 1b63e57f84600a4a77aa077f82c41d40e0a89ef3 Mon Sep 17 00:00:00 2001 From: Jake White Date: Tue, 12 Dec 2017 20:21:14 -0500 Subject: [PATCH] Added NPA message & evs left Fixes #32 --- index.html | 5 +++-- script_res/ap_calc.css | 10 +++++----- script_res/ap_calc.js | 19 +++++++++++++------ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index 61e23b9..1e2c638 100644 --- a/index.html +++ b/index.html @@ -59,6 +59,7 @@ (adsbygoogle = window.adsbygoogle || []).push({}); +

Tweet with the hashtag #draftsquirrelboyforNPA to support a good cause ;)

Ultra Sun & Ultra Moon VGC calculator by Jake White (@squirrelboyVGC). Submit bug/feature reports/requests through Github or this thread, not through Twitter please :)

@@ -126,7 +127,7 @@ 236 236 236 -   +   
@@ -393,7 +394,7 @@

Field 236 236 236 -   +   

diff --git a/script_res/ap_calc.css b/script_res/ap_calc.css index 190aeff..24356d4 100644 --- a/script_res/ap_calc.css +++ b/script_res/ap_calc.css @@ -18,7 +18,7 @@ th, td { th { font-size: 0.8em; } -.title-text { +.title-text { font-weight: bold; font-size: 1.5em; height: 50px; @@ -207,7 +207,7 @@ select.toxic-counter { padding: 3px 3px; margin-left: 0.3em; } -.poke-info .ev-total { +.poke-info .ev-total, .poke-info .ev-left { font-size: 0.8em; } @@ -289,11 +289,11 @@ select.toxic-counter { position: absolute; top: 0; bottom: 0; right: 46px; border: 2px solid #999999; border-radius: 8px; - transition: all 0.3s ease-in 0s; + transition: all 0.3s ease-in 0s; } .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner { margin-left: 0; } .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch { - right: 0px; -} \ No newline at end of file + right: 0px; +} diff --git a/script_res/ap_calc.js b/script_res/ap_calc.js index 3173f2d..c0ad4e3 100644 --- a/script_res/ap_calc.js +++ b/script_res/ap_calc.js @@ -106,8 +106,15 @@ function calcEvTotal(poke) { var newClass = total > 510 ? 'overLimit' : 'underLimit'; + var left = 510-total; + + var newClassLeft = left < 0 ? 'overLimit' : 'underLimit'; + var evTotal = poke.find('.ev-total'); evTotal.removeClass('underLimit overLimit').text(total).addClass(newClass); + + var evLeft = poke.find('.ev-left'); + evLeft.removeClass('underLimit overLimit').text(left).addClass(newClassLeft); } function calcCurrentHP(poke, max, percent) { @@ -154,15 +161,15 @@ function autoSetAura() var ability2 = $("#p2 .ability").val() if(ability1 == "Fairy Aura" || ability2 == "Fairy Aura" ) $("input:checkbox[id='fairy-aura']").prop("checked", true) - else + else $("input:checkbox[id='fairy-aura']").prop("checked", lastAura[0]) if(ability1 == "Dark Aura" || ability2 == "Dark Aura") $("input:checkbox[id='dark-aura']").prop("checked", true) - else + else $("input:checkbox[id='dark-aura']").prop("checked", lastAura[1]) if(ability1 == "Aura Break" || ability2 == "Aura Break" ) $("input:checkbox[id='aura-break']").prop("checked", true) - else + else $("input:checkbox[id='aura-break']").prop("checked", lastAura[2]) } function autoSetTerrain() @@ -534,7 +541,7 @@ function calculate() { highestMaxPercent = maxPercent; bestResult = $(resultLocations[0][i].move); } - + result = damageResults[1][i]; minDamage = result.damage[0] * p2.moves[i].hits; maxDamage = result.damage[result.damage.length-1] * p2.moves[i].hits; @@ -570,7 +577,7 @@ $(".result-move").change(function() { if (result) { $("#mainResult").html(result.description + ": " + result.damageText + " -- " + result.koChanceText); if (result.parentDamage) { - $("#damageValues").text("(First hit: " + result.parentDamage.join(", ") + + $("#damageValues").text("(First hit: " + result.parentDamage.join(", ") + "; Second hit: " + result.childDamage.join(", ") + ")"); } else { $("#damageValues").text("(" + result.damage.join(", ") + ")"); @@ -828,7 +835,7 @@ $(".gen").change(function () { $("select.ability").find("option").remove().end().append("" + abilityOptions); var itemOptions = getSelectOptions(items, true); $("select.item").find("option").remove().end().append("" + itemOptions); - + $(".set-selector").val(getSetOptions()[gen > 3 ? 1 : gen === 1 ? 5 : 3].id); $(".set-selector").change(); });