diff --git a/web/js/common.js b/web/js/common.js
index 989bf56..8a0d941 100644
--- a/web/js/common.js
+++ b/web/js/common.js
@@ -202,3 +202,21 @@ function update_weapon_autocomplete(weapon_selector, predicate_fn, change_fn) {
}
});
}
+
+
+function set_sharpness_titles(weapon_data) {
+ if (weapon_data["sharpness"]) {
+ weapon_data["sharpness_title"] =
+ weapon_data["sharpness"].join(",");
+ weapon_data["sharpness_plus_title"] =
+ weapon_data["sharpness_plus"].join(",");
+ weapon_data["sharpness_all_title"] =
+ weapon_data["sharpness_title"] + " ("
+ + weapon_data["sharpness_plus_title"] + ")";
+ } else {
+ // gunner weapons have no sharpness
+ weapon_data["sharpness_title"] = "";
+ weapon_data["sharpness_plus_title"] = "";
+ weapon_data["sharpness_all_title"] = "";
+ }
+}
diff --git a/web/templates/weaponrow.ejs b/web/templates/weaponrow.ejs
index 2a4eef6..499d330 100644
--- a/web/templates/weaponrow.ejs
+++ b/web/templates/weaponrow.ejs
@@ -31,6 +31,7 @@
<%= Array(num_slots + 1).join("o")
%><%= Array(3 - num_slots + 1).join("-") %> |
+<% if (sharpness) { %>
@@ -49,6 +50,7 @@
+<% } %>
|
<%= defense ? "+" + defense + " Def" : "" %> |
<%= phial %> |
diff --git a/web/templates/weaponstats.ejs b/web/templates/weaponstats.ejs
index 21d9aa3..9182709 100644
--- a/web/templates/weaponstats.ejs
+++ b/web/templates/weaponstats.ejs
@@ -27,13 +27,9 @@
<% } %>
<% } %>
-<% if (defense) { %>+<%= defense %> Def<% } %> |
-
-
-
-
-
+<% if (sharpness) { %>
+
@@ -42,7 +38,7 @@
-
+
@@ -51,9 +47,9 @@
+<% } %>
|
-<%= sharpness_title %> |
-(<%= sharpness_plus_title %>) |
+<% if (defense) { %>+<%= defense %> Def<% } %> |
<% if (children.length) { %>
diff --git a/web/weaponlist.html b/web/weaponlist.html
index 1bf9689..4e3662e 100644
--- a/web/weaponlist.html
+++ b/web/weaponlist.html
@@ -212,20 +212,7 @@
+ "', failed component match");
return;
}
- if (data["sharpness"]) {
- data["sharpness_title"] =
- data["sharpness"].join(",");
- data["sharpness_plus_title"] =
- data["sharpness_plus"].join(",");
- data["sharpness_all_title"] =
- data["sharpness_title"] + " ("
- + data["sharpness_plus_title"] + ")";
- } else {
- // gunner weapons have no sharpness
- data["sharpness_title"] = "";
- data["sharpness_plus_title"] = "";
- data["sharpness_all_title"] = "";
- }
+ set_sharpness_titles(data);
data["wtype_short"] =
WEAPON_TYPE_ABBR[data["wtype"]];
data["ELEMENT_ABBR"] = ELEMENT_ABBR;
diff --git a/web/weaponplanner.html b/web/weaponplanner.html
index 4fd861b..c63c4fe 100644
--- a/web/weaponplanner.html
+++ b/web/weaponplanner.html
@@ -178,8 +178,7 @@
$("#weapon_stats").html("");
$.getJSON(DATA_PATH + "weapon/" + weapon_id + ".json",
function(data) {
- data["sharpness_title"] = data["sharpness"].join(",");
- data["sharpness_plus_title"] = data["sharpness_plus"].join(",");
+ set_sharpness_titles(data);
var html = template_stats.render(data);
$("#weapon_stats").html(html);
});