Update readme with URL
This commit is contained in:
1 parent
4916f77a1d
commit
2681090f5e
3 files changed
+31
-79
No files matched your search
+27
-9
@@ -24,13 +24,13 @@
|
||||
</nav>
|
||||
<div class="uk-container">
|
||||
<div id="help-container" class="uk-padding-large uk-text-center uk-text-muted uk-margin-large-left uk-margin-large-right">
|
||||
<div>Use the three tabs to input your options for each equipment slot (head/chest/leg). Click the calculate button to populate a table with possible combinations. Click on the column headers to sort results. Use the green + to input additional items.</div>
|
||||
<div>Use the three tabs to input your options for each equipment slot (head/chest/leg). Click the calculate button to populate a table with possible combinations. Click on the column headers to sort results.<br/><br/><strong>Ctrl+Enter</strong> adds a new row to existing table, or use the green <strong>+</strong> to input additional items.</div>
|
||||
</div>
|
||||
<div id="equipment-container" class="uk-padding-large">
|
||||
<ul class="uk-flex-center" uk-tab>
|
||||
<li class="uk-active"><a href="">Head</a></li>
|
||||
<li><a href="">Chest</a></li>
|
||||
<li><a href="">Leg</a></li>
|
||||
<li class="uk-active" tbl="head-table"><a href="">Head</a></li>
|
||||
<li tbl="chest-table"><a href="">Chest</a></li>
|
||||
<li tbl="leg-table"><a href="">Leg</a></li>
|
||||
</ul>
|
||||
<ul class="uk-switcher">
|
||||
{% for slot in ["Head", "Chest", "Leg"] %}
|
||||
@@ -50,9 +50,9 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td><input type="text" class="uk-input"/></td>
|
||||
<td><input type="text" class="uk-input"/></td>
|
||||
<td><input type="text" class="uk-input"/></td>
|
||||
<td><input type="text" class="uk-input" autocomplete="off"/></td>
|
||||
<td><input type="text" class="uk-input" autocomplete="off"/></td>
|
||||
<td><input type="text" class="uk-input" autocomplete="off"/></td>
|
||||
<td><a class="uk-icon-button del-row-button" uk-icon="icon:minus-circle;ratio:1"></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -97,7 +97,7 @@
|
||||
</body>
|
||||
<script>
|
||||
// Support adding rows to the equipment tables
|
||||
function addEquipmentTableRow() {
|
||||
function addEquipmentTableRow(findByQuery=false) {
|
||||
let input_element = document.createElement("input");
|
||||
input_element.className="uk-input";
|
||||
input_element.type = "text";
|
||||
@@ -108,7 +108,8 @@
|
||||
delete_button.setAttribute("uk-icon", "icon:minus-circle;ratio:1");
|
||||
delete_button.addEventListener("click", deleteEquipmentTableRow, false);
|
||||
|
||||
let tbody = this.parentElement.previousElementSibling.children[2];
|
||||
// If called manually, find specific table, otherwise determine based on event element
|
||||
let tbody = findByQuery ? document.querySelector(findByQuery) : this.parentElement.previousElementSibling.children[2];
|
||||
let new_row = tbody.insertRow(-1);
|
||||
|
||||
// Append all of the child cells needed
|
||||
@@ -117,6 +118,11 @@
|
||||
new_row.insertCell(0).appendChild(input_element.cloneNode());
|
||||
new_row.insertCell(0).appendChild(input_element.cloneNode());
|
||||
new_row.insertCell(0).appendChild(document.createTextNode(tbody.children.length))
|
||||
|
||||
if(findByQuery) {
|
||||
// If this was a hotkey, then focus the new field
|
||||
new_row.children[1].firstChild.focus();
|
||||
}
|
||||
}
|
||||
|
||||
// Support deleting rows from the equipment table
|
||||
@@ -224,6 +230,7 @@
|
||||
let input_element = document.createElement("input");
|
||||
input_element.className="uk-input";
|
||||
input_element.type = "text";
|
||||
input_element.autocomplete = "off";
|
||||
|
||||
// Create the delete button
|
||||
let delete_button = document.createElement("a");
|
||||
@@ -271,6 +278,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function listenForHotkeys(e) {
|
||||
if(e.ctrlKey && e.which == 13) {
|
||||
// Determine the active tab
|
||||
let tbl_id = "table#" + document.querySelector(".uk-active").getAttribute("tbl") + " > tbody";
|
||||
addEquipmentTableRow(tbl_id);
|
||||
}
|
||||
}
|
||||
|
||||
// Add event listeners to our table buttons
|
||||
const add_row_buttons = document.querySelectorAll("a.add-row-button");
|
||||
for(let button of add_row_buttons) {
|
||||
@@ -288,6 +303,9 @@
|
||||
// Enable sorting for our results table
|
||||
var table_sort = new Tablesort(document.querySelector("table#results-table"), {descending: true});
|
||||
|
||||
// Configure keyboard hotkeys
|
||||
document.onkeyup = listenForHotkeys;
|
||||
|
||||
// Load any existing data from LocalStorage
|
||||
loadExistingData();
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user