diff --git a/web_app/js/sif_tools.js b/web_app/js/sif_tools.js index 9a1dd2f..4c54596 100644 --- a/web_app/js/sif_tools.js +++ b/web_app/js/sif_tools.js @@ -346,7 +346,11 @@ function is_same_day(m1, m2) function calculate_gems() { var verbose = $("#gems_verbose").is(':checked'); - var current_gems = parseInt($("#current_gems").val()); + var current_gems_text = $("#current_gems").val(); + var current_gems = 0; + if (current_gems_text != "") { + current_gems = parseInt(current_gems_text); + } if (isNaN(current_gems)) { alert("Error: invalid number of current gems. Please check your input and try again."); return; @@ -354,7 +358,15 @@ function calculate_gems() var mode = $("input[name=gem-mode]:checked").val(); if (mode === "DATE") { var target_date = $("#gem_desired_date").val(); + if (target_date === "") { + alert("Error: invalid date. Please check and try again."); + return; + } var target_date_object = moment(new Date(target_date)); + if (!target_date_object.isValid()) { + alert("Error: invalid date. Please check and try again."); + return; + } var now = moment(new Date()); if (target_date_object.isBefore(now) || is_same_day(now, target_date_object)) { @@ -384,15 +396,15 @@ function calculate_gems() // record verbose output if desired if (verbose) { if (is_gem_day(now) && is_bday) { - verboseText += sprintf("%02d/%02d/%04d: free gem as login bonus AND it's %s's birthday! You get 6 gems, which brings you to %d gems.\n", month(now), day(now), year(now), name, gems); + verboseText += sprintf("%02d/%02d/%04d
Free gem as login bonus AND it's %s's birthday! You get 6 gems, which brings you to %d gems.

", month(now), day(now), year(now), name, gems); } if (is_bday && !is_gem_day(now)) { - verboseText += sprintf("%02d/%02d/%04d: it's %s's birthday! You get 5 gems, which brings you to %d gems.\n", month(now), day(now), year(now), name, gems); + verboseText += sprintf("%02d/%02d/%04d
It's %s's birthday! You get 5 gems, which brings you to %d gems.

", month(now), day(now), year(now), name, gems); } if (is_gem_day(now) && !is_bday) { - verboseText = verboseText + sprintf("%02d/%02d/%04d: free gem as login bonus, which brings you to %d gems.\n", month(now), day(now), year(now), gems); + verboseText = verboseText + sprintf("%02d/%02d/%04d
Free gem as login bonus, which brings you to %d gems.

", month(now), day(now), year(now), gems); } } @@ -402,10 +414,10 @@ function calculate_gems() resultsString = resultsString + sprintf("
You will have %d love gems on %02d/%02d/%04d. Good things come to those who wait!", gems, month(target_date_object), day(target_date_object), year(target_date_object)); $("#gem-result-summary").html(resultsString); if (verbose) { - $("#gem-result-verbose-area").val(verboseText); + $("#gem-result-verbose-area").html(verboseText); $("#gem-result-textarea").show(); } else { - $("#gem-result-verbose-area").val(verboseText); + $("#gem-result-verbose-area").html(verboseText); $("#gem-result-textarea").hide(); } } else if (mode === "GEMS") { @@ -440,15 +452,15 @@ function calculate_gems() // record verbose output if desired if (verbose) { if (is_gem_day(now) && is_bday) { - verboseText += sprintf("%02d/%02d/%04d: free gem as login bonus AND it's %s's birthday! You get 6 gems, which brings you to %d gems.\n", month(now), day(now), year(now), name, gems); + verboseText += sprintf("%02d/%02d/%04d
Free gem as login bonus AND it's %s's birthday! You get 6 gems, which brings you to %d gems.

", month(now), day(now), year(now), name, gems); } if (is_bday && !is_gem_day(now)) { - verboseText += sprintf("%02d/%02d/%04d: it's %s's birthday! You get 5 gems, which brings you to %d gems.\n", month(now), day(now), year(now), name, gems); + verboseText += sprintf("%02d/%02d/%04d
It's %s's birthday! You get 5 gems, which brings you to %d gems.

", month(now), day(now), year(now), name, gems); } if (is_gem_day(now) && !is_bday) { - verboseText = verboseText + sprintf("%02d/%02d/%04d: free gem as login bonus, which brings you to %d gems.\n", month(now), day(now), year(now), gems); + verboseText = verboseText + sprintf("%02d/%02d/%04d
Free gem as login bonus, which brings you to %d gems.

", month(now), day(now), year(now), gems); } } } @@ -457,10 +469,10 @@ function calculate_gems() $("#gem-result-summary").html(resultsString); if (verbose) { - $("#gem-result-verbose-area").val(verboseText); + $("#gem-result-verbose-area").html(verboseText); $("#gem-result-textarea").show(); } else { - $("#gem-result-verbose-area").val(verboseText); + $("#gem-result-verbose-area").html(verboseText); $("#gem-result-textarea").hide(); } } diff --git a/web_app/sif_tools.html b/web_app/sif_tools.html index 59e9f43..22efb81 100644 --- a/web_app/sif_tools.html +++ b/web_app/sif_tools.html @@ -4,7 +4,7 @@ - SIFTools + SIF Tools @@ -17,133 +17,133 @@ + - - - -
- - -
-
-

Rank Calculator

- Current Rank:    -
- Current EXP (optional):    -
- Desired Rank:    -
- Game Version:    - -

-
Calculate
-

-
-

Results

- EXP required:   -

- You will need to play the following number of songs in order to get this amount of EXP:

- EASY:   -
- NORMAL:   -
- HARD:   -
- EXPERT:   -

- At this rank you will have - LP and - friend slots.

-
Reset
-
-
+ -
-
- Current Love Gems:    -

- Mode:
- Number of gems on date?
- Date you will have this many gems?

-
- Date:    -
-
- Number of gems desired:    -
-

- Verbose Mode
-

-
Calculate
-

-
-

Results

- -

-
-

+ +
+ + +
+
+

Rank Calculator

+ Current Rank:    +
+ Current EXP (optional):    +
+ Desired Rank:    +
+ Game Version:    + +

+
Calculate
+

+
+

Results

+ EXP required:   -

+ You will need to play the following number of songs in order to get this amount of EXP:

+ EASY:   -
+ NORMAL:   -
+ HARD:   -
+ EXPERT:   -

+ At this rank you will have - LP and - friend slots.

+
Reset
+
+
+
+
+
+ Current Love Gems (optional):    +

+ Mode:
+ Number of gems on date?
+ Date you will have this many gems?

+
+ Date:    +
+
+ Number of gems desired:    +
+

+ Verbose Mode
+

+
Calculate
+

+
+

Results

+ -

+
+
-
+
Reset
-
-
+
-
-
- Card Rarity:    - -
- Current Level:    -
- Current EXP (optional):    -

- Mode:
- EXP needed to get to a level?
- Level reached after feeding EXP?

-
- Desired level:    -
-
- EXP:    -
-

-
Calculate
-

-
-

Results

- -

-
Reset
-
-
-
+
+
+ Card Rarity:    + +
+ Current Level:    +
+ Current EXP (optional):    +

+ Mode:
+ EXP needed to get to a level?
+ Level reached after feeding EXP?

+
+ Desired level:    +
+
+ EXP:    +
+

+
Calculate
+

+
+

Results

+ -

+
Reset
+
+
+
-
-
+
+

Enter Event End Date/Time (in UTC):


- - + +

Start Timer

Timer Not Running

-
-
-
-
Clear Timer
+
+
+
Clear Timer
+
-
-

-
-
-
+
+

+
+
+
\ No newline at end of file