You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
4.6 KiB
138 lines
4.6 KiB
<html>
|
|
<head>
|
|
<title>Poogie's Weapon Planner</title>
|
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
|
|
|
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
|
|
|
|
<script type="text/javascript" src="js/ejs_production.js"></script>
|
|
|
|
<script type="text/javascript" src="js/common.js"></script>
|
|
|
|
<style>
|
|
label {
|
|
font-weight: bold;
|
|
}
|
|
|
|
body {
|
|
font-family: sans, sans-serif;
|
|
}
|
|
|
|
td.plus {
|
|
background-color: LightCyan;
|
|
}
|
|
|
|
td.minus {
|
|
background-color: LightPink;
|
|
}
|
|
|
|
td.num {
|
|
text-align: right;
|
|
}
|
|
|
|
/*@media (max-width: 600) {*/
|
|
.flexbox {
|
|
display: flex;
|
|
flex-direction: row;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
</style>
|
|
|
|
<script type="text/javascript">
|
|
var DATA_PATH = get_base_path() + "/jsonapi/";
|
|
|
|
var template_path = new EJS({ url: "templates/weaponpath.ejs" });
|
|
|
|
$(document).ready(function(){
|
|
setup_weapon_autocomplete("#weapon_type", "#weapon",
|
|
load_qs, show_trees);
|
|
});
|
|
|
|
function load_qs() {
|
|
var wtype = $.QueryString["weapon_type"];
|
|
var weapon = $.QueryString["weapon"];
|
|
if (wtype) {
|
|
$("#weapon_type").val(wtype);
|
|
}
|
|
if (weapon) {
|
|
$("#weapon").val(weapon);
|
|
show_trees(weapon);
|
|
}
|
|
}
|
|
|
|
function show_trees(weapon_name) {
|
|
weapon_id = WEAPON_NAME_IDX[weapon_name][0];
|
|
$("#results").html("");
|
|
$.getJSON(DATA_PATH + "weapon/" + weapon_id + "_tree.json",
|
|
function(data) {
|
|
all_components = Object.keys(
|
|
data[data.length-1]["components"]);
|
|
all_components.sort();
|
|
for (i=0; i<data.length; i++) {
|
|
delta = {};
|
|
path = data[i];
|
|
components = path["components"]
|
|
path["path_string"] = "";
|
|
for (j=0; j<path["path"].length; j++) {
|
|
if (j != 0) {
|
|
path["path_string"] += " -> ";
|
|
}
|
|
path["path_string"] += path["path"][j]["name"];
|
|
}
|
|
path["all_components"] = all_components;
|
|
path["component_list"] = Object.keys(components);
|
|
if (i > 0) {
|
|
prev_comps = data[i-1]["components"];
|
|
$.each(components, function(name, quantity) {
|
|
if (name in prev_comps) {
|
|
delta[name] = components[name]
|
|
- prev_comps[name];
|
|
}
|
|
});
|
|
}
|
|
path["delta"] = delta;
|
|
path["component_list"].sort();
|
|
var html = template_path.render(path);
|
|
$("#results").append(html);
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div>
|
|
<table>
|
|
<tr>
|
|
<td><label for="type">Type:</label></td>
|
|
<td><select id="weapon_type" name="weapon_type">
|
|
<option value="All">All</option>
|
|
<option value="Great Sword">Great Sword</option>
|
|
<option value="Long Sword">Long Sword</option>
|
|
<option value="Sword and Shield">Sword and Shield</option>
|
|
<option value="Dual Blades">Dual Blades</option>
|
|
<option value="Hammer">Hammer</option>
|
|
<option value="Hunting Horn">Hunting Horn</option>
|
|
<option value="Lance">Lance</option>
|
|
<option value="Gunlance">Gunlance</option>
|
|
<option value="Switch Axe">Switch Axe</option>
|
|
<option value="Charge Blade">Charge Blade</option>
|
|
<option value="Insect Glaive">Insect Glaive</option>
|
|
<option value="Light Bowgun">Light Bowgun</option>
|
|
<option value="Heavy Bowgun">Heavy Bowgun</option>
|
|
<option value="Bow">Bow</option>
|
|
</select></td>
|
|
</tr>
|
|
<tr>
|
|
<td><label for="weapon">Weapon:</label></td>
|
|
<td><input id="weapon" name="weapon" weapon="text" size="20" />
|
|
<input type="submit" value="Ask Poogie" /></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div id="results" class="flexbox"></div>
|
|
</body>
|
|
</body>
|