+
-
+
-
+
diff --git a/css/sidebar.css b/css/sidebar.css
index 420939c..69940f5 100644
--- a/css/sidebar.css
+++ b/css/sidebar.css
@@ -1,8 +1,11 @@
+:root {
+ --sidebar-width: 3.5vw;
+}
/* sidebar stuff */
.sidebar {
height: 100%; /* 100% Full-height */
- width: 3.5vw; /* 0 width - change this with JavaScript */
+ width: var(--sidebar-width); /* 0 width - change this with JavaScript */
position: fixed; /* Stay in place */
top: 0;
left: 0;
@@ -38,5 +41,8 @@
}
@media screen and (max-width: 992px) {
+ :root {
+ --sidebar-width: 0px;
+ }
.sidebar {display: none;}
}
diff --git a/css/sq2bs.css b/css/sq2bs.css
index 87c7514..1689a5d 100644
--- a/css/sq2bs.css
+++ b/css/sq2bs.css
@@ -101,6 +101,19 @@ input {
input.equipment-input {
font-weight: bold;
+ background-color: hsl(0, 0%, 21%) !important;
+ border-radius: 0.375rem !important;
+ border-color: rgba(33, 37, 41, 1) !important;
+ min-height: calc(1.2 * var(--scaled-fontsize) + 2px);
+ padding: 0rem 0.5rem;
+ font-size: var(--scaled-fontsize);
+}
+
+.my-container {
+ position: fixed; /* Stay in place */
+ left: var(--sidebar-width);
+ overflow-y: scroll;
+ height: 100%;
}
.text-right {
@@ -124,6 +137,9 @@ input.equipment-input {
cursor: pointer;
}
+:root {
+ --scaled-fontsize: 2.5rem;
+}
.scaled-font {
font-size: 2.5rem;
}
@@ -180,8 +196,11 @@ input.equipment-input {
}
@media screen and (min-width: 1200px) and (max-width: 1400px) {
+ :root {
+ --scaled-fontsize: 1rem;
+ }
.scaled-font {
- font-size: .8rem;
+ font-size: 1rem;
}
.box-title {
@@ -231,6 +250,9 @@ input.equipment-input {
}
@media screen and (min-width: 1400px) {
+ :root {
+ --scaled-fontsize: 1rem;
+ }
.scaled-font {
font-size: 1rem;
}
@@ -407,4 +429,4 @@ input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
-}
\ No newline at end of file
+}
diff --git a/js/computation_graph.js b/js/computation_graph.js
index 6e7f844..fcefe03 100644
--- a/js/computation_graph.js
+++ b/js/computation_graph.js
@@ -15,13 +15,14 @@ class ComputeNode {
this.inputs = [];
this.children = [];
this.value = 0;
- this.compute_func = null;
- this.callback_func = null;
this.name = name;
this.update_task = null;
this.update_time = Date.now();
}
+ /***
+ * Request update of this compute node. Pushes updates to children.
+ */
update(timestamp) {
if (timestamp < this.update_time) {
return;
@@ -32,16 +33,25 @@ class ComputeNode {
for (const input of this.inputs) {
value_map.set(input.name, input.get_value());
}
- this.value = this.compute_func(this.value_map);
+ this.value = this.compute_func();
for (const child of this.children) {
child.update();
}
- this.callback_func(this.value);
}
+ /***
+ * Get value of this compute node. Can't trigger update cascades (push based update, not pull based.)
+ */
get_value() {
return this.value
}
+
+ /***
+ * Abstract method for computing something. Return value is set into this.value
+ */
+ compute_func() {
+ throw "no compute func specified";
+ }
}
/***
@@ -69,12 +79,39 @@ class ItemStats extends ComputeNode {
* Make an item stat pulling compute node.
*
* @param name: Name of this node.
- * @oaram item_input_field: Input field (html element) to listen for item names from.
+ * @param item_input_field: Input field (html element) to listen for item names from.
+ * @param none_item: Item object to use as the "none" for this field.
*/
- constructor(name, item_input_field) {
+ constructor(name, item_input_field, none_item) {
super(name);
this.input_field.setAttribute("onInput", "calcSchedule('"+name+"');");
this.input_field = item_input_field;
+ this.none_item = none_item;
+ }
+
+ compute_func() {
+ // built on the assumption of no one will type in CI/CR letter by letter
+
+ let item_text = this.input_field.value;
+ let item;
+
+ if (item_text.slice(0, 3) == "CI-") {
+ item = getCustomFromHash(item_text);
+ }
+ else if (item_text.slice(0, 3) == "CR-") {
+ item = getCraftFromHash(item_text);
+ }
+ else if (itemMap.has(item_text)) {
+ item = itemMap.get(item_text);
+ }
+ else if (tomeMap.has(item_text)) {
+ item = tomeMap.get(item_text);
+ }
+
+ if (!item) {
+ return this.none_item;
+ }
+ return item;
}
}
diff --git a/js/sq2bs.js b/js/sq2bs.js
index 50675c8..25ac2d2 100644
--- a/js/sq2bs.js
+++ b/js/sq2bs.js
@@ -118,6 +118,7 @@ function update_field(field) {
// built on the assumption of no one will type in CI/CR letter by letter
// resets
document.querySelector("#"+field+"-choice").classList.remove("text-light", "is-invalid", 'Normal', 'Unique', 'Rare', 'Legendary', 'Fabled', 'Mythic', 'Set', 'Crafted', 'Custom');
+ document.querySelector("#"+field+"-choice").classList.add("text-light");
document.querySelector("#" + field + "-img").classList.remove('Normal-shadow', 'Unique-shadow', 'Rare-shadow', 'Legendary-shadow', 'Fabled-shadow', 'Mythic-shadow', 'Set-shadow', 'Crafted-shadow', 'Custom-shadow');
item = document.querySelector("#"+field+"-choice").value